mapbox / mapbox/mapbox-gl-js

Extend local ideographic font rendering to all East Asian wide characters

Open
#9,362 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

cross-platform :tv:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

GL JS currently uses a locally installed font to render a limited set of CJK Unicode blocks, with the expectation that these blocks are fixed-width and thus compatible with TinySDF:

https://github.com/mapbox/mapbox-gl-js/blob/3a293bdcbe3f70bc38e3fd225fed69dfe43ad49a/src/render/glyph_manager.js#L127-L130

(Same goes for gl-native.)

There are a number of other blocks that would be similarly compatible with TinySDF, such as CJK Symbols and Punctuation, CJK Compatibility Ideographs, and Enclosed CJK Letters and Months (including the current Japanese era name, ㋿).

Rather than curate our own list of compatible Unicode blocks, we should rely on Unicode Standard Annex #11, which defines an “East Asian Width” property for every Unicode codepoint. _doesCharSupportLocalGlyph() should return true for any character listed as East Asian Fullwidth (F) or East Asian Wide (W) in the latest Unicode release’s EastAsianWidth data file. As of Unicode 12.1, 34 ranges are fullwidth and 237 ranges are wide, but the addition of these ranges won’t bloat the codebase by much, because most of the ranges consist of individual, adjacent characters and can be combined into fewer, larger ranges.

As precedent, charHasUprightVerticalOrientation() is already derived from another Unicode data file.

/cc @mapbox/gl-js @mapbox/language @chloekraw

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/render/glyph_manager.js at _doesCharSupportLocalGlyph(), then compare its current block list with the Unicode Standard Annex #11 EastAsianWidth.txt data and the existing charHasUprightVerticalOrientation() precedent. Done means local glyph support returns true for every latest-release East Asian Fullwidth (F) or Wide (W) character without maintaining the limited curated list.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, internationalization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.