Skip to content
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

RFC: TTF support in our GUI #163

Closed
wants to merge 6 commits into from
Closed

RFC: TTF support in our GUI #163

wants to merge 6 commits into from

Conversation

lordhoto
Copy link
Contributor

@lordhoto lordhoto commented Jan 7, 2012

As the description already states, this pull request intends to get your opinions about TTF support for our GUI. It is definitely not in a state to be merged right now.

This adds a new (optional) dependancy on FreeType2 for the TTF support. I added Bitstreams Vera to our modern theme, so people can give this a try easily.

The big question is: Do we want this? I.e. are we fine with optionally depending on FreeType2?

I wouldn't want to talk too much about implementation details here, since there's already a few things I want to tackle:

  • At least split the change from filename => basename for the "font" property in the theme XML files into its own commit. Maybe even revert this and go back to the old way, where the file was directly specified.
  • Similar for the "scalable_font" prop, which was introduced to support TTF, without breaking ports, which do not feature FreeType2. Since we only support TTF files right now, we might just specify the filename directly.
  • Supporting different charsets in the TTF code. This is relatively easy since all we need to do is to load the glyphs as the charset requires. This could be done with two additional static tables for the two charsets our non ISO-8859-1 translations use.
  • General cleanup/refactoring of the code ;-).

@sev-
Copy link
Member

sev- commented Jan 7, 2012

Couple of questions: 1. Does it provide antialiased fonts? 2. Any screenshots?

@lordhoto
Copy link
Contributor Author

lordhoto commented Jan 7, 2012

  1. Yes.
  2. http://lordhoto.users.sourceforge.net/scummvm-aa.png (with AA fonts)
    http://lordhoto.users.sourceforge.net/scummvm-no-aa.png (without AA)

Currently AA is always enabled though.

@bgK
Copy link
Member

bgK commented Jan 7, 2012

The output looks good to me. As far as the PS3 is concerned, FreeType2 is a reasonable dependency.

@sev-
Copy link
Member

sev- commented Jan 7, 2012

The look is cool, but I don't like Verdana in this context. Fonts from original mock-ups look the best IMHO: http://scummvm.svn.sourceforge.net/viewvc/scummvm/media/trunk/originals/gui/scummvm5.png?revision=56141&view=markup

@lordhoto
Copy link
Contributor Author

lordhoto commented Jan 7, 2012

Yeah, I just used Bistream Vera as an example, since it's a free font. It wasn't meant to be the final font. I don't like it that much either to be honest. But for a quick check it's fine IMHO. The bold version of the standard Vera font might be a bit more similar to what we currently have: http://lordhoto.users.sourceforge.net/scummvm-aa-bd.png

If we can find a better (free) font we can use, then it would definitly be cool. I am not sure what the font used for the mock-ups is though, so it's hard to say whether we can use it.

EDIT: If you have a nicer font you want me to try I could put up some screens for that.

@lordhoto
Copy link
Contributor Author

lordhoto commented Jan 9, 2012

Ok I added support for using non ISO-8859-1 charsets now. One problem with the current Vera font is that it doesn't support some chars of ISO-8859-2, thus all languages using that will fall back to the bdf font, and it doesn't support much of the ISO-8859-5 at all, thus it will fallback to the bdf version too.

@lordhoto
Copy link
Contributor Author

I cleaned up some code parts and rebased the code on the current master.

The most notable change is that we use filenames instead of basenames for font files in our themes again.

@lordhoto
Copy link
Contributor Author

Did another bunch of changes:

  • Made scummtheme.py include ttf files into the .zip files.
  • Replaced the Vera fonts with DejaVu LGC, which features all the glyphs we use as far as I can tell.

@lordhoto
Copy link
Contributor Author

Fixed a font redrawing issues in the anti-aliased font drawing, which caused some texts to get thicker when you hover over them a few times.

I also made a few more comparison screenshots:

Arial (proprietary and thus we cannot use it, just for reference since sev suggested it): http://lordhoto.users.sourceforge.net/scummvm-arial.png
Liberation Sans: http://lordhoto.users.sourceforge.net/scummvm-libsans.png
GNU FreeFont: http://lordhoto.users.sourceforge.net/scummvm-freefont.png
DejaVu LGC Sans: http://lordhoto.users.sourceforge.net/scummvm-dejavu-lgc-sans.png
DejaVu LGC Serif: http://lordhoto.users.sourceforge.net/scummvm-dejavu-lgc-serif.png

These three above are 12pt.

GNU FreeFont 10pt: http://lordhoto.users.sourceforge.net/scummvm-freefont-10.png
GNU FreeFont Bold 10pt: http://lordhoto.users.sourceforge.net/scummvm-freefont-bold-10.png

Personally I think FreeFont 12pt looks fine, everything below is just too small.

@clone2727
Copy link
Contributor

@lordhoto: Out of those, DejaVu LGC Serif and GNU FreeFont (12pt) look the best to me.

@sev-
Copy link
Member

sev- commented Jan 28, 2012

For comparison to be fair you should use bold fonts. So far GNU FreeFont 12pt is my favorite.

@lordhoto
Copy link
Contributor Author

Bold versions (all 12pt again):

Arial Bold: http://lordhoto.users.sourceforge.net/scummvm-arial-bold.png
Liberation Sans Bold: http://lordhoto.users.sourceforge.net/scummvm-libsans-bold.png
GNU FreeFont Bold: http://lordhoto.users.sourceforge.net/scummvm-freesans-bold.png
DejaVu LGC Sans Bold: http://lordhoto.users.sourceforge.net/scummvm-dejavu-lgc-sans-bold.png
DejaVu LGC Serif Bold: http://lordhoto.users.sourceforge.net/scummvm-dejavu-lgc-serif-bold.png

I checked our current fonts again and it seems the "big" GUI font is bold, while the normal one isn't. A quick check shows that we will probably need to reduce the point size to 10 for 320x200 otherwise the text won't fit.

@lordhoto
Copy link
Contributor Author

I recreated the bold versions, since I noticed some annoying oddity in the FreeSans bold version. It seems the default hinter in FreeType made the "t" look like it was cut off on the right side, since it used quite high alpha values, now I am using the light render mode, which uses the auto-hinter, which makes the fonts look a bit nicer imho.

Johannes Schickel added 6 commits January 28, 2012 21:47
This adapts the related graphics code, which is the generic Font API and the
TTF font implementation.

It furthermore adapts the GUI to properly take care of kerning in text input
widgets.
The charsets used by the translations now need to have a "$(name).cp" file,
which contains an charset index => unicode mapping. Otherwise
create_translations will fail.
Formerly the text background was not restored thus every time it got redrawn
the text got thicker.
@lordhoto
Copy link
Contributor Author

I added GNU FreeFont as default now. The big font is FreeSansBold.ttf 12pt now, the small font FreeSans.ttf 11pt.

Here are screenshots of the new looks:
http://lordhoto.users.sourceforge.net/scummvm-freefont-big.png
http://lordhoto.users.sourceforge.net/scummvm-freefont-small.png

Screenshots of our old GUI as comparison:
http://lordhoto.users.sourceforge.net/scummvm-current-big.png
http://lordhoto.users.sourceforge.net/scummvm-current-small.png

If nobody raises any complaints, I will merge this tomorrow afternoon/evening.

@sev-
Copy link
Member

sev- commented Jan 29, 2012

Wow, just wow! Please merge.

@lordhoto
Copy link
Contributor Author

Rebased it on master again and pushed it as 5407bb8..e4b1067.

Closing this pull request now.

@lordhoto lordhoto closed this Jan 29, 2012
@lordhoto
Copy link
Contributor Author

Since we had a force push to master inbetween the hashes changed: 843b9f9..00cc48f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants