GithubHelp home page GithubHelp logo

Font fallback mechanism about player HOT 8 CLOSED

easyrpg avatar easyrpg commented on May 19, 2024
Font fallback mechanism

from player.

Comments (8)

fdelapena avatar fdelapena commented on May 19, 2024

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.

from player.

fdelapena avatar fdelapena commented on May 19, 2024

WinAPI information:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd374109%28v=vs.85%29.aspx

Fontconfig information:
http://www.freedesktop.org/software/fontconfig/fontconfig-devel/
Fontconfig example from MAME SDL to get a font for SDL_ttf:
http://mamedev.org/source/src/osd/sdl/sdlmain.c

from player.

fdelapena avatar fdelapena commented on May 19, 2024

I'll try with the FontConfig part

from player.

Ghabry avatar Ghabry commented on May 19, 2024

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

from player.

fdelapena avatar fdelapena commented on May 19, 2024

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.

from player.

Ghabry avatar Ghabry commented on May 19, 2024

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?

from player.

fdelapena avatar fdelapena commented on May 19, 2024

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

from player.

fdelapena avatar fdelapena commented on May 19, 2024

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

from player.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.