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:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user