summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2019-05-08 21:27:24 +0200
committerOwen Rudge <owen@owenrudge.net>2019-05-14 11:21:36 +0100
commitde73c8f91c56d9bd0e2c4bfb9791995450932e49 (patch)
treea2109c6bc182454991f6ade2c1dfca3f8b2093db /src
parenteeccfa2570a8571d5fd9d4525d6e9b1cbdf8110a (diff)
downloadopenttd-de73c8f91c56d9bd0e2c4bfb9791995450932e49.tar.xz
Codechange: [Win32] Remove a FreeType work-around from Uniscribe if not using FreeType.
Diffstat (limited to 'src')
-rw-r--r--src/os/windows/string_uniscribe.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/os/windows/string_uniscribe.cpp b/src/os/windows/string_uniscribe.cpp
index 01f0e5e3b..c91803089 100644
--- a/src/os/windows/string_uniscribe.cpp
+++ b/src/os/windows/string_uniscribe.cpp
@@ -197,15 +197,19 @@ static bool UniscribeShapeRun(const UniscribeParagraphLayoutFactory::CharType *b
}
for (int i = 0; i < range.len; i++) {
if (buff[range.pos + i] >= SCC_SPRITE_START && buff[range.pos + i] <= SCC_SPRITE_END) {
- range.ft_glyphs[range.char_to_glyph[i]] = range.font->fc->MapCharToGlyph(buff[range.pos + i]);
- range.offsets[range.char_to_glyph[i]].dv = range.font->fc->GetAscender() - range.font->fc->GetGlyph(range.ft_glyphs[range.char_to_glyph[i]])->height - 1; // Align sprite glyphs to font baseline.
+ auto pos = range.char_to_glyph[i];
+ range.ft_glyphs[pos] = range.font->fc->MapCharToGlyph(buff[range.pos + i]);
+ range.offsets[pos].dv = range.font->fc->GetAscender() - range.font->fc->GetGlyph(range.ft_glyphs[pos])->height - 1; // Align sprite glyphs to font baseline.
+ range.advances[pos] = range.font->fc->GetGlyphWidth(range.ft_glyphs[pos]);
}
}
- /* FreeType and GDI/Uniscribe seems to occasionally disagree over the width of a glyph. */
range.total_advance = 0;
for (size_t i = 0; i < range.advances.size(); i++) {
+#ifdef WITH_FREETYPE
+ /* FreeType and GDI/Uniscribe seems to occasionally disagree over the width of a glyph. */
if (range.advances[i] > 0 && range.ft_glyphs[i] != 0xFFFF) range.advances[i] = range.font->fc->GetGlyphWidth(range.ft_glyphs[i]);
+#endif
range.total_advance += range.advances[i];
}
break;