[No] TTF font support

Moderator: Developers

TTF font support

Postby UsernameAK » Sun May 07, 2017 10:07 am

Add the TrueType font support. This will be helpful for graphical mods (TTF is good for menus).
User avatar
UsernameAK
Cat
 
Joined: 15 Jul 2015
Location: Ukraine
Discord: /bin/cat#8891

Re: TTF font support

Postby Graf Zahl » Sun May 07, 2017 10:18 am

If it wasn't just such a shitload of work to get that into the engine...
Find someone who might help out and we're good to go. But on realistic terms: Not going to happen...
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: TTF font support

Postby Enjay » Sun May 07, 2017 10:21 am

@UsernameAK, Given that's a pretty clear "no", you might be interested in bagheadspidey's Doom Crap.

http://baghead.drdteam.org/tools.xml

It can make ZDoom fonts out of system fonts. The quality of the results can vary but you might find something that works for you.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: TTF font support

Postby UsernameAK » Sun May 07, 2017 2:24 pm

I suggest that for high-quality non-pixelated fonts
User avatar
UsernameAK
Cat
 
Joined: 15 Jul 2015
Location: Ukraine
Discord: /bin/cat#8891

Re: TTF font support

Postby Rachael » Sun May 07, 2017 3:12 pm

UsernameAK - since a lot of your suggestions appear to be right off the cuff, I am going to help you out a bit, here. Since you seem to want so many crazy features in GZDoom, and these mean old devs don't seem to want to listen to you - you should be able to implement them yourself. It's never too late to learn C++, and here, I will give you a starting point:

http://www.learncpp.com/ - This has a series of tutorials to start. If your school/college/tech school/whatever offers any C++ courses, I would highly recommend registering for them if possible. Talk to your adviser about it and see what's available.
https://support.microsoft.com/en-us/hel ... -downloads - Of course, in order to actually use C++, you need a compiler. This should help you get started.

I hope this is helpful for you!

Of course, for this particular suggestion you will obviously need to learn how to actually read the font's format. http://scripts.sil.org/cms/scripts/page ... -chapter08

These resources, along with plenty of Googling, should help put you in the right direction for getting the features you want in the engine.
User avatar
Rachael
QZDoom + Webmaster
 
Joined: 13 Jan 2004

Re: TTF font support

Postby UsernameAK » Mon May 08, 2017 6:34 am

Rachael wrote:It's never too late to learn C++, and here, I will give you a starting point:

I know C++. But GZDoom code is very complicated. It takes about 10-30 minutes to find out how the feature is implemented. I have tried to implement something: viewtopic.php?f=18&t=55233 , but I didn't have enough knowledge of OpenGL and it was shitty.

Rachael wrote:Of course, for this particular suggestion you will obviously need to learn how to actually read the font's format. http://scripts.sil.org/cms/scripts/page ... -chapter08

Why not to use libraries?

Rachael wrote:https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads - Of course, in order to actually use C++, you need a compiler. This should help you get started.

I use Linux so don't suggest Visual Studio for me.
User avatar
UsernameAK
Cat
 
Joined: 15 Jul 2015
Location: Ukraine
Discord: /bin/cat#8891

Re: TTF font support

Postby Rachael » Mon May 08, 2017 6:43 am

GZDoom code is not that complicated. If you find it complicated, start with simple stuff first - tweak the monster AI or something, and then work your way into it. I think the most complicated part about it is coaxing the renderers to either draw your fonts directly, or draw them through a raster. For 2D, there's 2 hardware renderers and one direct-to-buffer renderer that it will have to be done with.

As for using libraries - that is a good idea - as long as you can coax the libraries to render to those buffers I mentioned.
User avatar
Rachael
QZDoom + Webmaster
 
Joined: 13 Jan 2004

Re: TTF font support

Postby Graf Zahl » Mon May 08, 2017 6:46 am

Rachael wrote:GZDoom code is not that complicated. If you find it complicated, start with simple stuff first - tweak the monster AI or something, and then work your way into it. I think the most complicated part about it is coaxing the renderers to either draw your fonts directly, or draw them through a raster. There's 2 hardware renderers and one direct-to-buffer renderer that it will have to be done with.

As for using libraries - that is a good idea - as long as you can coax the libraries to render directly to those buffers I mentioned.


I think the only way to implement this without code explosion is to render entire texts into a texture and then use the existing drawing code to render these textures.
I have implemented TTF support for hardware accelerated backends on Android and iOS and it has always been a major pain in the ass.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: TTF font support

Postby UsernameAK » Mon May 08, 2017 6:49 am

Libraries can be used just to parse the fonts and rasterize them (for example, freetype2).
User avatar
UsernameAK
Cat
 
Joined: 15 Jul 2015
Location: Ukraine
Discord: /bin/cat#8891

Re: TTF font support

Postby Rachael » Mon May 08, 2017 6:50 am

In that case, the entire code can be simplified just by drawing to a texture of appropriate size first, then, and then passing that texture into the existing 2D drawers for each of the renderer types. It'll be easier to deal with the OpenGL and Direct3D renderers than it will be for the direct renderer (the vid_hw2d==false one) but it should be doable.

Since you use Linux, don't worry about the Direct3D renderer - if you can get the OpenGL one working, we can get the D3D one working ourselves, as long as you use the texture method.
User avatar
Rachael
QZDoom + Webmaster
 
Joined: 13 Jan 2004

Re: TTF font support

Postby UsernameAK » Mon May 08, 2017 7:06 am

Okay, what about the font scaling? How to make it to don't scale the font?
User avatar
UsernameAK
Cat
 
Joined: 15 Jul 2015
Location: Ukraine
Discord: /bin/cat#8891

Re: TTF font support

Postby Rachael » Mon May 08, 2017 7:12 am

It depends on the size of the texture. As long as you pass a texture in of the right size, it shouldn't try to scale it. You'll have to look at it and see how it deals with the existing pre-rastered fonts. I know for that GZDoom the texture coordinates are simply 0.0 to 1.0, which makes it much easier to deal with because then all you have to figure out is the number of pixels between start and end. I am not sure how the non-hardware renderer deals with it, though, but I think most of the relevant code for that is either in v_video.cpp or called by it.
User avatar
Rachael
QZDoom + Webmaster
 
Joined: 13 Jan 2004

Re: TTF font support

Postby Marisa Kirisame » Thu Sep 27, 2018 5:42 am

I'd like to un-[No] this. Would the use of SDL2_ttf be acceptable?
User avatar
Marisa Kirisame
ZScript Magician
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa Kirisame#4689
Twitch ID: magusmarisa

Re: TTF font support

Postby Rachael » Thu Sep 27, 2018 5:56 am

My first reaction: Another external library, ugh!
User avatar
Rachael
QZDoom + Webmaster
 
Joined: 13 Jan 2004

Re: TTF font support

Postby Graf Zahl » Thu Sep 27, 2018 6:33 am

Marisa Kirisame wrote:Would the use of SDL2_ttf be acceptable?


No.
To be clear: If there was a WORKING and FULLY FEATURED text rendering functionality here, it'd fill the last gap that's needed, i.e. Linux support.
But unfortubnately this is just a wrapper around FreeType. And FreeType is merely a glyph renderer, which is not sufficient to render text correctly. For that you need a real font layout engine that can substitute missing characters from other fonts and handle ligatures and other special cases.

On Windows and Mac that part is not a problem - the native font rendering of the OS can do all of it automatically. But on Linux it all depends on third party libraries which are mostly poorly documented.
I find it somewhat fitting that SDL again went the cheapest and least complete route possible.

So even if this was sufficient I'd go right to the source (i.e. FreeType) than to depend on some shitty wrapper library.

To summarize: If you can provide a drop-in Linux handler that gets a string, a font and some basic font properties and returns a properly rendered text from it (by that I mean that even Chinese or more exotic characters show up correctly if the system has a font for them), we are in business. But I feel that without Linux support it won't be really useful.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Next

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 3 guests