1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-22 03:42:41 +01:00

Revert: "Change: Support side-by-side fallback FontCaches instead of hierarchical. (#13303)"

This reverts commit 1829f7926d.
This commit is contained in:
Peter Nelson
2025-12-13 00:29:06 +00:00
committed by Peter Nelson
parent 973514adc3
commit b03347f00c
32 changed files with 480 additions and 783 deletions

View File

@@ -536,7 +536,7 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
* another size would be chosen it won't have truncated too little for
* the truncation dots.
*/
truncation_layout.emplace(GetEllipsis(), INT32_MAX, line.GetVisualRun(0).GetFont().GetFontCache().GetSize());
truncation_layout.emplace(GetEllipsis(), INT32_MAX, line.GetVisualRun(0).GetFont()->fc->GetSize());
truncation_width = truncation_layout->GetBounds().width;
/* Is there enough space even for an ellipsis? */
@@ -592,15 +592,15 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
const ParagraphLayouter::VisualRun &run = line.GetVisualRun(run_index);
const auto &glyphs = run.GetGlyphs();
const auto &positions = run.GetPositions();
const Font &f = run.GetFont();
const Font *f = run.GetFont();
FontCache &fc = f.GetFontCache();
TextColour colour = f.colour;
FontCache *fc = f->fc;
TextColour colour = f->colour;
if (colour == TC_INVALID || HasFlag(initial_colour, TC_FORCED)) colour = initial_colour;
bool colour_has_shadow = (colour & TC_NO_SHADE) == 0 && colour != TC_BLACK;
/* Update the last colour for the truncation ellipsis. */
last_colour = colour;
if (do_shadow && (!fc.GetDrawGlyphShadow() || !colour_has_shadow)) continue;
if (do_shadow && (!fc->GetDrawGlyphShadow() || !colour_has_shadow)) continue;
SetColourRemap(do_shadow ? TC_BLACK : colour);
for (int i = 0; i < run.GetGlyphCount(); i++) {
@@ -615,10 +615,13 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left,
/* Truncated away. */
if (truncation && (begin_x < min_x || end_x > max_x)) continue;
/* Outside the clipping area. */
if (begin_x > dpi_right || end_x < dpi_left) continue;
const Sprite *sprite = fc.GetGlyph(glyph);
const Sprite *sprite = fc->GetGlyph(glyph);
/* Check clipping (the "+ 1" is for the shadow). */
if (begin_x + sprite->x_offs > dpi_right || begin_x + sprite->x_offs + sprite->width /* - 1 + 1 */ < dpi_left) continue;
if (do_shadow && (glyph & SPRITE_GLYPH) != 0) continue;
GfxMainBlitter(sprite, begin_x + (do_shadow ? shadow_offset : 0), top + (do_shadow ? shadow_offset : 0), BlitterMode::ColourRemap);
}
}