Skip to content

Verify font can be rendered successfully at runtime#52133

Merged
kevingranade merged 2 commits intoCleverRaven:masterfrom
BrettDong:font
Oct 7, 2021
Merged

Verify font can be rendered successfully at runtime#52133
kevingranade merged 2 commits intoCleverRaven:masterfrom
BrettDong:font

Conversation

@BrettDong
Copy link
Member

Summary

Infrastructure "Verify font can be rendered successfully at runtime"

Purpose of change

Describe the solution

This is probably a more proper fix to tackle the font related "black screen" issue (#50149, #52046). Check whether the glyph can really be rendered successfully at runtime, and fallback to GNU Unifont if the glyph can not be rendered in the preferred font.

Describe alternatives you've considered

Hardcode a blacklist to not load Terminus.TTF

Testing

  1. Set font to Terminus.TTF and launch game:
{
  "typeface": [ "data/font/Terminus.ttf", "data/font/unifont.ttf" ],
  "map_typeface": [ "data/font/Terminus.ttf", "data/font/unifont.ttf" ],
  "overmap_typeface": [ "data/font/Terminus.ttf", "data/font/unifont.ttf" ]
}

Automatically falls back to GNU Unifont:

  1. Set font to VecTerminus.OTF and launch game:
{
  "typeface": [ "data/font/VecTerminus12Medium.otf", "data/font/unifont.ttf" ],
  "map_typeface": [ "data/font/VecTerminus12Medium.otf", "data/font/unifont.ttf" ],
  "overmap_typeface": [ "data/font/VecTerminus12Medium.otf", "data/font/unifont.ttf" ]
}

VecTerminus OTF font is used:

Additional context

@BrettDong BrettDong added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. SDL: Tiles / Sound Tiles visual interface and sounds. labels Oct 6, 2021
@BrettDong BrettDong requested a review from ZhilkinSerg October 6, 2021 04:21
@kevingranade kevingranade merged commit 90e904e into CleverRaven:master Oct 7, 2021
@BrettDong BrettDong deleted the font branch October 7, 2021 05:49
@ZhilkinSerg
Copy link
Contributor

There is an issue with rendering of bitmap fonts in Freetype 2.11.0 (see https://gitlab.freedesktop.org/freetype/freetype/-/issues/1076).

Freetype port in vcpkg repo (see https://github.com/microsoft/vcpkg/tree/master/ports/freetype) was recently updated to 2.11.0 (see microsoft/vcpkg#19284), so anyone using latest vcpkg revision must use git revert dd6fd59ff22c6d924b637b7352751b5c244228d6 unless port is upgraded to whatever is coming after Freetype 2.11.0.

Note that it is not affecting our CI as we are using specific vcpkg version (see

vcpkgGitCommitId: '49b67d9cb856424ff69f10e7721aec5299624268'
) which has Freetype 2.10.4.

@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/no-text-is-showing-on-menu-screen/27316/2

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

Labels

<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. SDL: Tiles / Sound Tiles visual interface and sounds.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recent update blacks out the UI and makes every single option impossible to read 0.F and HEAD fonts are invisible on MacOS

3 participants