Custom fonts

Open source, lightweight PHP framework for Manialink and Web development.

Moderator: NADEO

Post Reply
User avatar
BLiNNeMaNS
Posts: 422
Joined: 04 Jul 2011, 22:24
Contact:

Custom fonts

Post by BLiNNeMaNS »

1st thing 1st:
I'm working on a title, i want that title to have a custom feel/font/gui.
Best way to do this i think is by using manialib.

I've been thinking of where i'd ask this question for a long time, still don't know where it fits best.
As ManiaLib also uses icons and loads them like a rollover image (xy coords + size of icon) i figured it's probably a similar way.

example:
Image
i can select 1 letter at a time and assign them to quads.

However, there's a few problems i came across in my thinking progress.

Transparency
my guess is i need either a dds or a tga, which probably isn't a standard manialib image. As it's for my custom title, that won't be a problem.

If i overlay the letters (make background transparent) i am only creating single colour squares as the overlay isn't using the layer underneath.
If i inverse the txt (make letters transparent) and choose an underlay colour i can have any txt colour i got, but can't use it in a transparent way as the background is a solid colour. if i make background transparent i get the same result as overlay.

So i guess i need to use a dds with a layermask. But then i still don't know how to alter the colour.

different sizes
the M and the i don't use the same quadsize, not too big of a problem, but still, i want to do it nicely

loading the font
As it's going to be used in a title i reckon there's some sort of preloader i need to run.
my 1st idea was to use the oldschool custom font system for webpages:
wait for text to load, then 1 by 1 overlay it with a custom letter image

That of course isn't the proper practice. i want to override the standard font for the gui/mt in my title and not just for ingame popup txt. (not in the chat window as i don't want to mess up names)

the question
Is this possible to do at all?
and if so, is it possible to get an example script?

Sidenote: only using fonts i'm allowed to use (either CC, made by me or with the authors consent)
User avatar
BLiNNeMaNS
Posts: 422
Joined: 04 Jul 2011, 22:24
Contact:

Re: Custom fonts

Post by BLiNNeMaNS »

k, with a little searching i've come up with a possible solution.

in ManiaPlanet\Menu\Media\Font there's 4 folders named Fontname_Textures
those folders host Fontstyle_00.dds and counting upwards.

So i guess adding a new dds font there, then fiddling with manialib some more will do it partially (for dialogues/ui)
and maybe by adding a manialink in mediatracker i can even make a scrolling message with a custom font out of it.

(maybe toy around with styleparser)
The_Big_Boo
Posts: 1041
Joined: 15 Jun 2010, 15:46

Re: Custom fonts

Post by The_Big_Boo »

Fonts and images rollovers are hardcoded in the game, ManiaLib is just using them by setting style/substyle attributes.

So, as far as I know, it's not possible to have a custom font in manialinks unfortunately.
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
User avatar
BLiNNeMaNS
Posts: 422
Joined: 04 Jul 2011, 22:24
Contact:

Re: Custom fonts

Post by BLiNNeMaNS »

well, fonts are hardcoded in internetbrowsers too.. yet, custom fonts are available now.

as maniaplanet is the portal between the client and the web it's kind of an advanced browser api/sdk, so it should be able to do.

And as far as i can tell StyleParser takes fonts from the font directory and uses them.


Because i want to use them in my title i can preload those custom fonts with the title, else, i agree, it probably would be hard to impossible. Although..

the normal way is possible (custom image roll over) with maniaplanet webservices sdk and domloading, using dds is harder.
The_Big_Boo
Posts: 1041
Joined: 15 Jun 2010, 15:46

Re: Custom fonts

Post by The_Big_Boo »

ManiaPlanet browser offers a lot less features than a real browser. ManiaPlanet is using images for its font instead of formats like TrueType and others. Custom image rollover is only available in web browsers, not in ManiaPlanet browser.

About the StyleParser, fonts are used only if you want to generate images from a ManiaPlanet styled text, it's based on the GD PHP library so nothing related to manialinks. Anyway, the purpose of the StyleParser is to help converting ManiaPlanet styles to html tags (or images) thus for a web browser. I wrote it (or at least, I re-wrote it from scratch and improved it) so you can't have a better answer about what it can and cannot do.

So, actually, you can at best dynamically generate images for your manialinks but you can't have a real custom font which will replace the ManiaPlanet one.
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
User avatar
BLiNNeMaNS
Posts: 422
Joined: 04 Jul 2011, 22:24
Contact:

Re: Custom fonts

Post by BLiNNeMaNS »

I know it currently doesn't have custom rollover images, but that doesn't mean it isn't possible. Like all ports between client and servercontent scripting (and thinking out of the box) is the key.


and i know the parser is for creating images. and i know it's very heavy on the client, but it's still possible to create images on the fly, save them and use in next mapload. If you add the mapID to the filename you can use it the next time it loads. (preset the texture to that name)


only meant the styleparser to be the 2nd possibility to create content for rollover images, not as an addon to the answer.

sidenote: there's multiple ways to create an image rollover. the way that's possible is the same way fonts are displayed.
not possible: have 2 separate images
possible: have 1 image twice the height with both images in it. then just change the y axis on rollover.
Post Reply

Return to “ManiaLib”

Who is online

Users browsing this forum: No registered users and 1 guest