Feature request: font selection gui
Moderator: OpenTTD Developers
Feature request: font selection gui
Is it possible to make in-game menu for choosing font for freetype? Preview will be good.
Also as I unferstand it's not possible to select font style? Some fonts don't have separate bold font for example.
Also as I unferstand it's not possible to select font style? Some fonts don't have separate bold font for example.
Re: Feature request: font selection gui
Well, I started to make an in-game menu for it. It'll under game options, and probably it will have preview.. I'll post a screenshot soon...Quark wrote:Is it possible to make in-game menu for choosing font for freetype? Preview will be good.
Also as I understand it's not possible to select font style? Some fonts don't have separate bold font for example.
-------------------------------------------------------------
patch ChangeLog
- 0.1.0 - Initial release - gui, dropdown, apply...
0.2.0 - added bounding boxes
0.3.0 - added preview to the drop-down list
0.3.1 - updated to r10622
0.3.2 - fixed a bug with the 32bpp blitter
0.4.0 - option to antialias, for r10645
0.5.0 - selectable font style, for r10654
0.5.1 - for r???, based on the win version (forgot to release)
0.5.2 - nothing new, just compiles with r11643
- Attachments
-
- fontselect_window_v.0.5.2.diff
- The lastest version of the patch - v. 0.5.2 (for Unix and Windows)
- (77.14 KiB) Downloaded 3197 times
Last edited by DirtY iCE on 16 Dec 2007 11:48, edited 7 times in total.
Last edited by DirtY iCE on Boomtime, the 65th day of The Aftermath in the YOLD 3173, edited 782,469,123.3691 times in total.
Re: Feature request: font selection gui
And how do it find the fonts to put in the list?DirtY iCE wrote:Well, I started to make an in-game menu for it. It'll under game options, and probably it will have preview.. I'll post a screenshot soon...
Is it portable code or hardcoded for one OS?
Re: Feature request: font selection gui
Well, on Windows it can retrieved from registry, on Linux font-config can list the available fonts, and for other OS-es they will a custom-font option, where you can specific the font (as in openttd.cfg)...Bjarni wrote:And how do it find the fonts to put in the list?
Is it portable code or hardcoded for one OS?
Last edited by DirtY iCE on Boomtime, the 65th day of The Aftermath in the YOLD 3173, edited 782,469,123.3691 times in total.
Screenshoot
I'm struggling with the preview, and now it's only works with FontConfig, but it's near to finished state...
- Attachments
-
- The drop-down font selector.
- fontselect2.png (19.51 KiB) Viewed 12405 times
-
- The config window with a normal, a custom and an invalid font.
- fontselect1.png (27.33 KiB) Viewed 12406 times
Last edited by DirtY iCE on Boomtime, the 65th day of The Aftermath in the YOLD 3173, edited 782,469,123.3691 times in total.
- Born Acorn
- Tycoon
- Posts: 7597
- Joined: 10 Dec 2002 20:36
- Skype: bornacorn
- Location: Wrexham, Wales
- Contact:
Suggestion
Wow that looks great.
If this should be really helpful for all languages, the text shown in the preview should be defined in the language files. This would allow to preview speciel characters and charset.
If this should be really helpful for all languages, the text shown in the preview should be defined in the language files. This would allow to preview speciel characters and charset.
Re: Screenshoot
Good work, but can you make font preview in drop-down list?DirtY iCE wrote:I'm struggling with the preview, and now it's only works with FontConfig, but it's near to finished state...
Re: Suggestion
I've already done it that way..Juhl wrote:If this should be really helpful for all languages, the text shown in the preview should be defined in the language files. This would allow to preview special characters and charset.

show preview in the drop-down list looks cool, but it eats a lot of memory and CPU to load..Quark wrote:Good work, but can you make font preview in drop-down list?
Last edited by DirtY iCE on Boomtime, the 65th day of The Aftermath in the YOLD 3173, edited 782,469,123.3691 times in total.
Re: Suggestion
Then make an on/off button so people can decide if they want to do so. People with high end computers might wants this and people with low end computers will not. I presume that you can free the memory allocated to this when the window is closed.DirtY iCE wrote:show preview in the drop-down list looks cool, but it eats a lot of memory and CPU to load..
Re: Suggestion
Maybe I'll do that, but first I have to made preview work correctlyBjarni wrote:Then make an on/off button so people can decide if they want to do so. People with high end computers might wants this and people with low end computers will not. I presume that you can free the memory allocated to this when the window is closed.

- Attachments
-
- The font select window with Hungarian translation.
- fontselect_hu.png (4.05 KiB) Viewed 12287 times
Last edited by DirtY iCE on Boomtime, the 65th day of The Aftermath in the YOLD 3173, edited 782,469,123.3691 times in total.
Well, it likes as a working thing
I made the drop-down menu sorted, the preview works (I didn't know about that glyph cache), and the apply button works. But listing available fonts only works with FontConfig.. And I don't know how winapi work, so I think someone has to write that piece of code...
Just a small code cleanup and I'll upload the first patch (maybe tomorrow).. but until that I post some screenshot...
And a question: why doesn't this forum allow me to upload file, that name contain : (colon)?

Just a small code cleanup and I'll upload the first patch (maybe tomorrow).. but until that I post some screenshot...
And a question: why doesn't this forum allow me to upload file, that name contain : (colon)?
- Attachments
-
- The sorted list
- fontselect_sortedlist.png (7.03 KiB) Viewed 12140 times
-
- The font select window with working preview
- fontselect3.png (5.6 KiB) Viewed 12151 times
Last edited by DirtY iCE on Boomtime, the 65th day of The Aftermath in the YOLD 3173, edited 782,469,123.3691 times in total.
Ok, ok, I post a diff file
Well, I just started to type a reply with the diff file, when I found a bug 
But now, everything is working for me, but this piece of code are STILL EXPERIMENTAL, and it can (or may
) contain bugs, packed segfaults, and so on.. So use it at your OWN RISK!
If you try it, and it works, be happy! Or, if you found any bug, please send it to me (only the bug report.. I have many bugs at my home, so I don't need more) through e-mail or IM.

But now, everything is working for me, but this piece of code are STILL EXPERIMENTAL, and it can (or may

If you try it, and it works, be happy! Or, if you found any bug, please send it to me (only the bug report.. I have many bugs at my home, so I don't need more) through e-mail or IM.
- Attachments
-
- My e-mail address.
- email.png (416 Bytes) Viewed 12042 times
Last edited by DirtY iCE on 10 Feb 2007 19:33, edited 1 time in total.
Last edited by DirtY iCE on Boomtime, the 65th day of The Aftermath in the YOLD 3173, edited 782,469,123.3691 times in total.
- belugas
- OpenTTD Developer
- Posts: 1507
- Joined: 05 Apr 2005 01:48
- Location: Deep down the deepest blue
- Contact:
Re: Ok, ok, I post a diff file
Hell of a good job 
Congrats

Congrats
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
Hi,
I'm a bit happy because I can announce the v. 0.2 of my patch.
I've added a feature that I only call bounding boxes. It does the following: it adds 3 boxes under each font preview. The green box means the font size with the original font. The orange box is a little bigger, and it means a size that usable in most cases, and the red box means, the font is too big...
I've uploaded the patch to my first post.
I'm a bit happy because I can announce the v. 0.2 of my patch.
I've added a feature that I only call bounding boxes. It does the following: it adds 3 boxes under each font preview. The green box means the font size with the original font. The orange box is a little bigger, and it means a size that usable in most cases, and the red box means, the font is too big...
I've uploaded the patch to my first post.
- Attachments
-
- Fontselect dialog with boundig boxes on and off.
- boundingbox.png (20.13 KiB) Viewed 11723 times
Last edited by DirtY iCE on Boomtime, the 65th day of The Aftermath in the YOLD 3173, edited 782,469,123.3691 times in total.
Wow, great job 
I've moved tahoma/tahoma bold .ttf files to my linux installation, but couldn't find a way to set bold tahoma w/o exact path to it... searched how i may do it with font-config or sth like it, but found this topic... imo without that gui freetype support for amateur users would be rather useless
Btw, i've compiled ottd with fontconfig support, but when i set "Tahoma Bold" as font - it doesn't find it. Only when i manually set path to "/usr/share/fonts/truetype/microsoft/Tahoma_Bold.ttf".
If someone had faced this problem, please write how you've workarounded it.

I've moved tahoma/tahoma bold .ttf files to my linux installation, but couldn't find a way to set bold tahoma w/o exact path to it... searched how i may do it with font-config or sth like it, but found this topic... imo without that gui freetype support for amateur users would be rather useless

Btw, i've compiled ottd with fontconfig support, but when i set "Tahoma Bold" as font - it doesn't find it. Only when i manually set path to "/usr/share/fonts/truetype/microsoft/Tahoma_Bold.ttf".
If someone had faced this problem, please write how you've workarounded it.
- It's hot as hell in here.
- You see it too? For me, it's always like this.
-------------------
ICQ: 302028069
Jabber: DarkFenX@jabber.org
- You see it too? For me, it's always like this.
-------------------
ICQ: 302028069
Jabber: DarkFenX@jabber.org
Hi, I'm here again:)
I've started to made the preview in the drop-down list, I actually did it, but it looks a quite funny...
DarkFenX: well, you're lucky! I needed to copy the bold font to an another directory, because it always reverted to the normal font - even with filename... but it only did it with bold fonts.. Italic fonts works nicely..
anyway, we should add a style option for the fonts.. but I don't know, what're the developers think about that
I've started to made the preview in the drop-down list, I actually did it, but it looks a quite funny...
DarkFenX: well, you're lucky! I needed to copy the bold font to an another directory, because it always reverted to the normal font - even with filename... but it only did it with bold fonts.. Italic fonts works nicely..
anyway, we should add a style option for the fonts.. but I don't know, what're the developers think about that

- Attachments
-
- Font preview in drop-down menu.
- prev_in_drpdwn.png (7.89 KiB) Viewed 11505 times
Last edited by DirtY iCE on Boomtime, the 65th day of The Aftermath in the YOLD 3173, edited 782,469,123.3691 times in total.
Either Fontconfig, or the Fontconfig parser is gay; you need to type your fontname as "Tahoma, Bold" (not the comma, which seperates the font-name from the type).DarkFenX wrote:Btw, i've compiled ottd with fontconfig support, but when i set "Tahoma Bold" as font - it doesn't find it. Only when i manually set path to "/usr/share/fonts/truetype/microsoft/Tahoma_Bold.ttf".
If someone had faced this problem, please write how you've workarounded it.
I have no idea if you could actually force a style to a font if that font does not exist internally. Eg if 'System' only exists in normal style how to apply 'bold' or 'italics' to it. Not sure if FreeType2 has support for that.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Thx, "Tahoma, Bold" worked as it supposed to 

- It's hot as hell in here.
- You see it too? For me, it's always like this.
-------------------
ICQ: 302028069
Jabber: DarkFenX@jabber.org
- You see it too? For me, it's always like this.
-------------------
ICQ: 302028069
Jabber: DarkFenX@jabber.org
Who is online
Users browsing this forum: No registered users and 1 guest