Skip to content

Commit

Permalink
Ceil the float spacing to avoid early cut-off of some glyphs
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaiser authored and dacap committed Aug 26, 2024
1 parent a63e1fb commit 0067919
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions text/skia_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ int SkiaFont::height() const

int SkiaFont::textLength(const std::string& str) const
{
return m_skFont.measureText(
str.c_str(),
str.size(),
SkTextEncoding::kUTF8,
nullptr);
return std::ceil(
m_skFont.measureText(
str.c_str(),
str.size(),
SkTextEncoding::kUTF8,
nullptr)
);
}

float SkiaFont::measureText(const std::string& str,
Expand Down

0 comments on commit 0067919

Please sign in to comment.