feat(core): render local CJK glyphs at 2x texture resolution (#4304)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bart Louwers <bart@emeel.net>
This commit is contained in:
@@ -267,11 +267,15 @@ SymbolQuads getGlyphQuads(const Shaping& shapedText,
|
||||
builtInOffset = {0.0f, 0.0f};
|
||||
}
|
||||
|
||||
// rectBuffer is in 1x logical units; only rect.w/h carry the texture
|
||||
// scale. GL JS keeps 2x glyphs centered by storing fractional
|
||||
// left/top metrics, so native local glyphs do the same.
|
||||
const float textureScale = positionedGlyph.metrics.isDoubleResolution ? 2.0f : 1.0f;
|
||||
const float x1 = (positionedGlyph.metrics.left - rectBuffer) * positionedGlyph.scale - halfAdvance +
|
||||
builtInOffset.x;
|
||||
const float y1 = (-positionedGlyph.metrics.top - rectBuffer) * positionedGlyph.scale + builtInOffset.y;
|
||||
const float x2 = x1 + rect.w * positionedGlyph.scale / pixelRatio;
|
||||
const float y2 = y1 + rect.h * positionedGlyph.scale / pixelRatio;
|
||||
const float x2 = x1 + rect.w / textureScale * positionedGlyph.scale / pixelRatio;
|
||||
const float y2 = y1 + rect.h / textureScale * positionedGlyph.scale / pixelRatio;
|
||||
|
||||
Point<float> tl{x1, y1};
|
||||
Point<float> tr{x2, y1};
|
||||
|
||||
Reference in New Issue
Block a user