New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion: Use SDL_ttf for font rendering #130

Closed
tobbi opened this Issue Sep 7, 2015 · 25 comments

Comments

Projects
None yet
7 participants
@tobbi
Copy link
Member

tobbi commented Sep 7, 2015

I think it might be more efficient, if we were to ditch our own font rendering code for SDL_ttf.

I think this would require a rewrite of our rendering code and converting the font files to ttf.

  • Source or create a TTF file to replace current images
  • Implement in code
  • Update requirements (if SDL_ttf needs installing too)
@Karkus476

This comment has been minimized.

Copy link
Member

Karkus476 commented Sep 8, 2015

May it fix #97 ?

@tobbi

This comment has been minimized.

Copy link
Member

tobbi commented Sep 8, 2015

It might. It might fix #94 as well.

@tobbi

This comment has been minimized.

Copy link
Member

tobbi commented Sep 8, 2015

Karkus476: If you want to be helpful, you may try to get fontforge to load and create ttf files out of the data/engine/fonts directory... I couldn't get it to run on my Mac.

@Karkus476

This comment has been minimized.

Copy link
Member

Karkus476 commented Sep 8, 2015

Yeah, that makes it sound like a pretty good idea. If it's done we need to update the website so people know to get that as a dependency

@tobbi

This comment has been minimized.

Copy link
Member

tobbi commented Sep 8, 2015

Yes, but that will be done afterwards. After you created the ttf fonts, I can try to play around with SDL_ttf in order to get things going. I'm not sure how much of a trouble this is.

@Karkus476

This comment has been minimized.

Copy link
Member

Karkus476 commented Sep 8, 2015

Okay, I'll see if I can create the font files

@Karkus476

This comment has been minimized.

Copy link
Member

Karkus476 commented Sep 8, 2015

Font forge can't open the .png (or the .stf files, not as if that would make sense.)

@maxteufel

This comment has been minimized.

Copy link
Member

maxteufel commented Sep 8, 2015

can't open the .png

Well, TTF and all other common font file types (OTF, WOFF) use vector graphics to ensure the font looks good even when using a very big size.

.stf

These files are used by SuperTux's custom font rendering system (and are afaik not used by any other software).

This means one would have to re-draw the letters as vector graphics (or use other open-source fonts). Furthermore, TTF doesn't support (multiple) colors inside one single letter (OTF does).

@Karkus476

This comment has been minimized.

Copy link
Member

Karkus476 commented Sep 8, 2015

Yeah I thought TTF might use vector graphics. That is one downfall to this plan...

@tobbi

This comment has been minimized.

Copy link
Member

tobbi commented Sep 8, 2015

You can find the glyphs in PNG format here:
data/images/engine/fonts/

@Karkus476

This comment has been minimized.

Copy link
Member

Karkus476 commented Sep 8, 2015

You can't convert png to ttf!

@tobbi

This comment has been minimized.

Copy link
Member

tobbi commented Sep 8, 2015

I was hoping that FontForge would be able to open the glyphs, vector-trace them and then create a ttf out of this.

@maxteufel

This comment has been minimized.

Copy link
Member

maxteufel commented Sep 8, 2015

You could use Inkscape to trace the PNGs and then try to import it in FontForge.

@Karkus476

This comment has been minimized.

Copy link
Member

Karkus476 commented Sep 8, 2015

tobbi: Not in fontforge

@Karkus476

This comment has been minimized.

Copy link
Member

Karkus476 commented Sep 8, 2015

Well I've traced the png but font forge is stubborn and wont let me import it. It's not as simple as just tracing the bitmap, all the letters need to be in the correct format.

@maxteufel

This comment has been minimized.

@Karkus476

This comment has been minimized.

Copy link
Member

Karkus476 commented Sep 8, 2015

I can't do it, someone else can try, or we could use a placement ttf font for testing purposes until we can create/convert a proper one.

@Karkus476

This comment has been minimized.

Copy link
Member

Karkus476 commented Sep 8, 2015

@maxteufel You seem to know what you're doing, could you try to do it?

@giby

This comment has been minimized.

Copy link
Contributor

giby commented Sep 8, 2015

I'll do that at some point.... please keep the original font... ST respects the work of earlier dev...

@Mathnerd314

This comment has been minimized.

Copy link
Contributor

Mathnerd314 commented Sep 8, 2015

@Grumbel Is the console font (andale10.png, andale12.png, console2.png) Andale Mono? We're probably not allowed to distribute it if that's the case...

@Grumbel

This comment has been minimized.

Copy link
Member

Grumbel commented Sep 9, 2015

@Mathnerd314 Yes, that's Andale Mono, font copyright however allows that kind of stuff (kind of, maybe). We can replace that with Inconsolata or any of the other free monospace fonts around.

As for the SuperTux font, I would keep that bitmap, it looks nice and works as is. With TTF colors, outlines, shadows and stuff get a lot more complicated and you no longer can do font animations.

@Flakebi

This comment has been minimized.

Copy link
Member

Flakebi commented Sep 12, 2015

supertuxkart/stk-code#2311 is maybe interesting here too. It would be interesting to know the performance impact, although it would differ for st, it can give some hints.

@maxteufel maxteufel removed this from the 0.5.0 milestone Jun 18, 2016

@maxteufel

This comment has been minimized.

Copy link
Member

maxteufel commented Jun 20, 2016

Some work has been done in the feature/modern_fonts_v2 branch using a custom version of SDL_ttf (see the SuperTux/SDL_ttf repository) that uses libraqm (also see comments on #97). The branch will probably need some CMake adjustments to deal with shipping the custom library.

@tobbi

This comment has been minimized.

Copy link
Member

tobbi commented Jul 1, 2016

@Savsish Is your comment related to this branch only or to other branches. If the latter, open a new issue about it.

@maxteufel

This comment has been minimized.

Copy link
Member

maxteufel commented Oct 22, 2018

This has been completed and merged.

@maxteufel maxteufel closed this Oct 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment