summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2021-04-10 11:17:53 +0200
committerNiels Martin Hansen <nielsm@indvikleren.dk>2021-04-10 11:39:28 +0200
commitc800dcaff8b72a1e9997f39b2fd701fa6378799a (patch)
treeadd70358ca25d3f8e444c523385a9c9bbc8e5019
parent0cb99c55233e8e29ba33ae49002f9453d55d600c (diff)
downloadopenttd-c800dcaff8b72a1e9997f39b2fd701fa6378799a.tar.xz
Fix: [Win32] Font glyphs of certain widths broke
Font glyphs between 33 and 39 pixels wide, in the Win32 font system, used wrong alignment and caused glyphs to appear broken. When in the 33 to 39 pixel range, glyphs without AA were rounded down to 32 pixel pitch, instead of up to 64 pixel pitch.
-rw-r--r--src/os/windows/font_win32.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp
index 59d5e0ad8..55d4193e8 100644
--- a/src/os/windows/font_win32.cpp
+++ b/src/os/windows/font_win32.cpp
@@ -498,7 +498,7 @@ void Win32FontCache::ClearFontCache()
* For anti-aliased rendering, GDI uses the strange value range of 0 to 64,
* inclusively. To map this to 0 to 255, we shift left by two and then
* subtract one. */
- uint pitch = Align(aa ? gm.gmBlackBoxX : std::max(gm.gmBlackBoxX / 8u, 1u), 4);
+ uint pitch = Align(aa ? gm.gmBlackBoxX : std::max((gm.gmBlackBoxX + 7u) / 8u, 1u), 4);
/* Draw shadow for medium size. */
if (this->fs == FS_NORMAL && !aa) {