Permalink
Browse files

When drawing text using our truetype backends, round coordinates to p…

…ixels. Fixes #10180
  • Loading branch information...
hrydgard committed Nov 23, 2017
1 parent 2b7ae78 commit c04ead1023590ee97c47bd89c81a1bf6e8933b95
Showing with 4 additions and 1 deletion.
  1. +4 −1 ext/native/ui/ui_context.cpp
@@ -172,7 +172,10 @@ void UIContext::DrawTextRect(const char *str, const Bounds &bounds, uint32_t col
Draw()->DrawTextRect(fontStyle_->atlasFont, str, bounds.x, bounds.y, bounds.w, bounds.h, color, align);
} else {
textDrawer_->SetFontScale(fontScaleX_, fontScaleY_);
textDrawer_->DrawStringRect(*Draw(), str, bounds, color, align);
Bounds rounded = bounds;
rounded.x = floorf(rounded.x);
rounded.y = floorf(rounded.y);
textDrawer_->DrawStringRect(*Draw(), str, rounded, color, align);
RebindTexture();
}
}

0 comments on commit c04ead1

Please sign in to comment.