From 968709735d898e05e289b1ad1655a2de25f2a869 Mon Sep 17 00:00:00 2001 From: PeterN Date: Sat, 18 Feb 2023 10:50:20 +0000 Subject: [PATCH] Fix #10477: Not enough space for text due to rounding down (OSX) (#10489) (cherry picked from commit 2376112c77f737727ba1a7e2791cb424f2136175) --- src/os/macosx/string_osx.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/os/macosx/string_osx.cpp b/src/os/macosx/string_osx.cpp index 1cebbe3e16..a66ca545e5 100644 --- a/src/os/macosx/string_osx.cpp +++ b/src/os/macosx/string_osx.cpp @@ -16,6 +16,7 @@ #include "../../zoom_func.h" #include "../../scope.h" #include "macos.h" +#include #include @@ -254,7 +255,7 @@ CoreTextParagraphLayout::CoreTextVisualRun::CoreTextVisualRun(CTRunRef run, Font this->positions[i * 2 + 1] = pts[i].y; } } - this->total_advance = (int)CTRunGetTypographicBounds(run, CFRangeMake(0, 0), nullptr, nullptr, nullptr); + this->total_advance = (int)std::ceil(CTRunGetTypographicBounds(run, CFRangeMake(0, 0), nullptr, nullptr, nullptr)); this->positions[this->glyphs.size() * 2] = this->positions[0] + this->total_advance; }