Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit fae200b

Browse files
committed
[[ Bug 20856 ]] Enable sub-pixel positioning in CoreText rendering
This patch ensures that the 'setSubpixelText' flag is set to true in the Skia paint used to render text on the CoreText implementation of libgraphics text operations. This change only effects the visual presentation of text - the metrics (as seen by anything higher up) is unchanged. Previously Skia would have been aligning the individual glyphs to device pixel boundaries resulting in a subtle misplacement, noticeable when comparing with the same text rendered in other CoreText using applications.
1 parent 245c85c commit fae200b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/notes/bugfix-20856.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Use sub-pixel positioning when rendering text on iOS/Mac.

libgraphics/src/coretext-skia.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ void MCGContextDrawPlatformText(MCGContextRef self, const unichar_t *p_text, uin
268268
// Ensure we use anti-aliasing
269269
t_paint.setAntiAlias(true);
270270

271+
// Ensure we use subpixel positioning
272+
t_paint.setSubpixelText(true);
273+
271274
// We are going to draw text by glyph ID rather than by codeunit
272275
t_paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
273276

0 commit comments

Comments
 (0)