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:
Taku Fukada
2026-07-01 20:52:01 +09:00
committed by GitHub
parent 60f15190c3
commit 887e6021e6
22 changed files with 357 additions and 84 deletions

View File

@@ -60,14 +60,17 @@ GlyphRange getGlyphRange(GlyphID glyph);
struct GlyphMetrics {
uint32_t width = 0;
uint32_t height = 0;
int32_t left = 0;
int32_t top = 0;
float left = 0;
float top = 0;
uint32_t advance = 0;
// True when the glyph bitmap is rendered at 2x texture resolution
// (e.g. local CJK glyphs).
bool isDoubleResolution = false;
};
inline bool operator==(const GlyphMetrics &lhs, const GlyphMetrics &rhs) {
return lhs.width == rhs.width && lhs.height == rhs.height && lhs.left == rhs.left && lhs.top == rhs.top &&
lhs.advance == rhs.advance;
lhs.advance == rhs.advance && lhs.isDoubleResolution == rhs.isDoubleResolution;
}
class Glyph {

View File

@@ -31,8 +31,9 @@ public:
constexpr uint32_t GLYPHS_PER_GLYPH_RANGE = 256;
constexpr uint32_t GLYPH_RANGES_PER_FONT_STACK = 256;
// 256 - 126 ranges skipped w/ i18n::allowsFixedWidthGlyphGeneration
constexpr uint32_t NON_IDEOGRAPH_GLYPH_RANGES_PER_FONT_STACK = 130;
// Verified against i18n::glyphRangeIsEntirelyLocallyGenerated by
// i18n.GlyphRangeLocalGenerationCountMatchesConstant.
constexpr uint32_t NON_IDEOGRAPH_GLYPH_RANGES_PER_FONT_STACK = 97;
} // end namespace mbgl