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

Change: Support side-by-side fallback FontCaches instead of hierarchi… #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

PeterN
Copy link
Owner

@PeterN PeterN commented Jul 2, 2024

…cal.

The text layouter system can now support using different fonts for different glyphs, including mixing scalable and sprite glyphs.

Motivation / Problem

Description

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

Comment on lines +404 to +405
// for (auto const &pair : font_mapping) {
// if (pair.second->fc == nullptr || pair.second->fc->IsBuiltInFont()) return nullptr;
// }

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
src/gfx_layout_icu.cpp Fixed Show fixed Hide fixed
@@ -767,7 +767,7 @@
this->SetWidgetDisabledState(WID_GO_GUI_FONT_AA, _fcsettings.prefer_sprite);
this->SetDirty();

InitFontCache(false);
// InitFontCache(false);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
src/gfx_layout_icu.cpp Fixed Show fixed Hide fixed

bool missing = callback->FindMissingGlyphs();
Debug(fontcache, 1, "Font \"{}\" misses{} glyphs", (char *)file, missing ? "" : " no");
for (FontSize fs = FS_BEGIN; fs != FS_END; fs++) {

Check notice

Code scanning / CodeQL

Declaration hides variable Note

Variable fs hides another variable of the same name (on
line 128
).
@PeterN PeterN force-pushed the side-by-side-font-cache branch from df143b1 to 676cfa9 Compare July 2, 2024 07:58
if (this->level & 1) c = SwapRtlPairedCharacters(c);
this->glyphs.emplace_back(this->font->fc->MapCharToGlyph(c));
this->glyph_to_char.push_back(i);
if (Utf16IsLeadSurrogate(*(buff + i))) ++i;

Check notice

Code scanning / CodeQL

For loop variable changed in body Note

Loop counters should not be modified in the body of the
loop
.
…cal.

The text layouter system can now support using different fonts for different glyphs, including mixing scalable and sprite glyphs.
@PeterN PeterN force-pushed the side-by-side-font-cache branch from 676cfa9 to 536734e Compare November 12, 2024 18:55
This detaches sprite font glyph mappings from sprite fonts.
@PeterN PeterN force-pushed the side-by-side-font-cache branch from 536734e to 5c1f9ee Compare November 12, 2024 19:00
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.

1 participant