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

Font fallback mechanism #24

Closed
Ghabry opened this issue Jul 2, 2012 · 8 comments
Closed

Font fallback mechanism #24

Ghabry opened this issue Jul 2, 2012 · 8 comments

Comments

@Ghabry
Copy link
Member

Ghabry commented Jul 2, 2012

The player only loads the first font it finds via the file finder.
Maybe it would be useful to load the other fonts too so you can get proper japanese rendering when the first loaded font does not contain any japanese glyphs. ;)

Not sure if Freetype has a fallback already implemented but its likely that it has one...

@fdelapena
Copy link
Contributor

We could use fontconfig font stack for UNIX systems (OSX included I believe). I don't know about Win32 fallback mechanism. Fixed fonts should be preferable. No needed for other platforms without font stock available.

@fdelapena
Copy link
Contributor

@fdelapena
Copy link
Contributor

I'll try with the FontConfig part

@ghost ghost assigned fdelapena Oct 15, 2012
@Ghabry
Copy link
Member Author

Ghabry commented Feb 3, 2013

Is there a standard way under Linux to access the font folder?
Because under Windows we just test through a hardcoded font list and fetch the path from the registry until one font is available.
This would be a simple fix for Linux.

Maybe add some extra logic too:
e.g. if (latin1) rm2000, DejaVuSansMono, Lucida Console
elif (shift-jis) msmincho, msgothic, ipa

@fdelapena
Copy link
Contributor

Yes, but fonts are in subfolders and FileFinder need more deeper scanning because paths are diferent on every distro.

There are two approaches, the ugly (plain FileFinder) and the good (FontConfig):

The ugly: Using de facto paths for most distros with FileFinder. Path stack example:

  • Main folder path: /usr/local/share/fonts
  • Other folders with fonts (make install): /usr/local/share/fonts
  • Other folders with fonts (local): ~/.fonts

However, there are issues with subfolders there, i.e.:

  • Debian dejavu folder: /usr/share/fonts//truetype/ttf-dejavu/DejaVuSansMono.ttf
  • Fedora dejavu folder: /usr/share/fonts/dejavu/DejaVuSansMono.ttf

I don't know if current POSIX FileFinder supports subfolder scanning but this could be slow with lots of font families installed. Or make it even uglier using popular dejavu paths for popular distros.

The good: use FcFontList from Fontconfig:
http://stackoverflow.com/questions/10542832/how-to-use-fontconfig-to-get-font-list-c-c
This adds new library dependency on most POSIX desktop systems (even OSX) but it's worth it because this library is installed by default in most of them.

FontConfig was designed as a solution for this path mess. It's just a XML file with font path definitions and a C API to manage them. Also features family and type selection even for language support, which it is good for us.

@Ghabry
Copy link
Member Author

Ghabry commented Feb 5, 2013

shared_ptr branch by take_cheeze contains a ready to use bitmap font (shinanome if I wrote this correctly).
This would fix this issue indirectly. So wontfix?

@fdelapena
Copy link
Contributor

Ok, but he considered some RGSS font feature for later, so this can be removed from 0.1 milestone.

@fdelapena
Copy link
Contributor

RGSS font can use ./Font instead. Wontfix since shinonome works fine for general use.

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

No branches or pull requests

2 participants