-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add freetype font rendering #2855
Conversation
When loading a translation a custom font can be provided. Also works for the web player.
As discussed in the Discord :
I haven't saw any other problem for now, everything seem to work nicely. Awesome feature. ^^ |
More discussion from discord: Some fonts are not optimized for EasyRPG proportion Settings:
To solve that, I'd like to suggest an optional settings layer, that could be something like: {
"fontConfig": {
"0": {
"source": "./MSGOTHIC.TTF",
"size": 12,
"spacing": "auto",
"etc": "etc"
},
"1": {
"source": "auto",
"size": "auto",
"spacing": "auto",
"etc": "etc"
}
}
} I would like to also suggest I Tried a font called Material Design Icons, that adds a lot of custom Glyphs: But the lack of Maybe, A character going back to the default font whenever it fails loading its glyph could help on this. Last feature I'd like to suggest is a changing font mid Text input. like in this mockup:
This PR is so amazing, I love it! |
All this font config stuff is a good idea but honestly I would prefer to have this as part of the database which means this is a job for the editor. Just want to avoid having lots of config files for stuff that should be in the database. But you are totally right that we need something like this. For now I will only add a fallback to our built-in fonts when a glyph is missing. |
This is fixed now. Also not crasing anymore when closing the player ;) |
Also do not parse non-po files when processing map translations
Remove Windows specific font support. Add more extensions (fnt and bdf) to the font list.
This is also consistent with ManiacPatch
Note to self: It was suggested to support color TTF fonts. Problem is that no font with such small image size exists. The ones from Google etc. don't work. How to get color out with FreeType:
I will add it when a proper font is provided :) |
This is now ready. There is one minor breaking change: ExFont was relocated to "Font/ExFont" for consistency. Emscripten will enforce this but local Player will check both locations. All changes outside of the FreeType code will return the same font metrics as before so no code behaviour should change when no FreeType Font is loaded. New features:
The renderer likely has bad performance because there is no glyph caching etc. involved. If this becomes an issue this can be improved later. Also I do not recommend using this on any low memory platforms because the entire font file is loaded into memory. So this wastes many megabyte. |
src/filefinder.cpp
Outdated
".opus", ".oga", ".ogg", ".wav", ".mid", ".midi", ".mp3", ".wma"); | ||
constexpr const auto SOUND_TYPES = Utils::MakeSvArray( | ||
".opus", ".oga", ".ogg", ".wav", ".mp3", ".wma"); | ||
constexpr const auto FONTS_TYPES = Utils::MakeSvArray(".ttf", ".ttc", ".otf", ".fon", ".fnt", ".bdf"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.woff and .woff2 OpenType formats are useful for significantly smaller emscripten asset downloads (may require extra freetype dependencies, e.g. brotli).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FileFinder code aborts early when the directory is missing so for most games adding more extensions won't hurt. I add a commit :)
Jenkins: Test this please |
This includes FPS, Message Overlay and Error reporting. Otherwise, this looks awful.
It looks awful for most graphics. With full RGB support you can paint your own shadow if needed.
Enable Monochrome Hinter Update docs
(This is now really, really finished. Backported all fixed for issues I found while working on Harfbuzz) |
This adds experimental freetype rendering support.
Still marked as draft as I must test some stuff. But the basic rendering works.
When fonts are provided as "Font/Font.ttf" (gothic) or "Font/Font2.ttf" (mincho) these fonts are used instead of the built-in. Should also work for the web player and translations can provide custom fonts.
Also supports complex stuff like Thai (not using Harfbuzz though as Freetype is good enough to render Thai properly).
TODO: Testing testing testing. Fallback logic?Fix #2857