diff --git a/CHANGELOG.md b/CHANGELOG.md index aeafbb430e6..e9e4b2a7360 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - Add constants `MAX_TILE_ZOOM = 25` and `MIN_TILE_ZOOM = 0` as maximum and minimum world tile zoom (Z) values; replace hardcoded instances with those constants. - Add functions `isInBoundsForTileZoomXY` and `isInBoundsForZoomLngLat` to check whether a tile ZXY or a zoom+LngLat is in the world bounds; use `MAX_TILE_ZOOM` and `MIN_TILE_ZOOM` in those checks; replace existing hardcoded checks with those functions. -- Render uncommon Chinese, Japanese, Korean, and Vietnamese characters. ([#4550](https://github.com/maplibre/maplibre-gl-js/pull/4550)) +- Render uncommon Chinese, Japanese, Korean, and Vietnamese characters. Prefer local glyph rendering for all CJKV characters, not just those in the CJK Unified Ideographs, Hiragana, Katakana, and Hangul Syllables blocks. Request other characters beyond U+FFFF from the server instead of throwing an error. ([#4550](https://github.com/maplibre/maplibre-gl-js/pull/4550), [#4560](https://github.com/maplibre/maplibre-gl-js/pull/4560)) - _...Add new stuff here..._ ### 🐞 Bug fixes @@ -12,7 +12,6 @@ - Fix right-to-left layout of labels that contain characters in the Arabic Extended-B code block. ([#4536](https://github.com/maplibre/maplibre-gl-js/pull/4536)) - Fix 3D map freezing when camera is adjusted against map bounds. ([#4537](https://github.com/maplibre/maplibre-gl-js/issues/4537)) - Fix `getStyle()` to return a clone so the object cannot be internally changed ([#4488](https://github.com/maplibre/maplibre-gl-js/issues/4488)) -- Prefer local glyph rendering for all CJKV characters, not just those in the CJK Unified Ideographs, Hiragana, Katakana, and Hangul Syllables blocks. ([#4560](https://github.com/maplibre/maplibre-gl-js/pull/4560))) - - _...Add new stuff here..._ ## 4.5.2 diff --git a/src/render/glyph_manager.test.ts b/src/render/glyph_manager.test.ts index 56efe6f6064..186e7e8a9cb 100644 --- a/src/render/glyph_manager.test.ts +++ b/src/render/glyph_manager.test.ts @@ -66,6 +66,18 @@ describe('GlyphManager', () => { expect(returnedGlyphs['Arial Unicode MS'][0x5e73]).toBeNull(); // The fixture returns a PBF without the glyph we requested }); + test('GlyphManager requests remote non-BMP, non-CJK PBF', async () => { + jest.spyOn(GlyphManager, 'loadGlyphRange').mockImplementation((_stack, _range, _urlTemplate, _transform) => { + return Promise.resolve(GLYPHS); + }); + + const manager = createGlyphManager(); + + // Request Egyptian hieroglyph 𓃰 + const returnedGlyphs = await manager.getGlyphs({'Arial Unicode MS': [0x1e0f0]}); + expect(returnedGlyphs['Arial Unicode MS'][0x1e0f0]).toBeNull(); // The fixture returns a PBF without the glyph we requested + }); + test('GlyphManager does not cache CJK chars that should be rendered locally', async () => { jest.spyOn(GlyphManager, 'loadGlyphRange').mockImplementation((_stack, range, _urlTemplate, _transform) => { const overlappingGlyphs = {}; diff --git a/src/render/glyph_manager.ts b/src/render/glyph_manager.ts index 73ab81c5904..6093f870152 100644 --- a/src/render/glyph_manager.ts +++ b/src/render/glyph_manager.ts @@ -93,13 +93,9 @@ export class GlyphManager { const range = Math.floor(id / 256); const isInBMP = range * 256 <= 0xFFFF; - if (!isInBMP) { - if (this._doesCharSupportLocalGlyph(+id)) { - entry.ranges[range] = true; - return {stack, id, glyph: null}; - } else { - throw new Error('glyphs > 65535 not supported'); - } + if (!isInBMP && this._doesCharSupportLocalGlyph(+id)) { + entry.ranges[range] = true; + return {stack, id, glyph: null}; } if (entry.ranges[range]) {