You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For several years, I’ve been manually maintaining a relevant subset of the Unicode Character Database that GL JS uses to detect scripts for vertical layout, ideographic line breaking, complex text layout, and right-to-left layout. This solution works reasonably efficiently, but it’s difficult to keep it up-to-date as Unicode evolves, because relatively few contributors are familiar with these parts of the Unicode standard or the associated text layout conventions.
I think the custom script detection logic should be replaced by Unicode-aware regular expressions where possible. I’ve identified two such opportunities; there may be others.
It should be possible to replace the following function:
This will make the functions more future-proof, so that we don’t need to notice that a new CJK-related block has been added to Unicode etc. The downside is that this requires a relatively recent version of ECMAScript. This codebase has never used a Unicode regular expression so far, let alone a Unicode character escape. Does GL JS still maintain capability with Chrome 63, Firefox 77, or Safari 11.0 or earlier versions of these browsers?
Unfortunately, it isn’t currently possible to replace charHasUprightVerticalOrientation(), stringContainsRTLText(), or unicodeBlockLookup with something more robust, because the ECMAScript standard doesn’t yet allow a regular expression to match on the Vertical_Orientation, Bidi_Class, or Block property, respectively.
The text was updated successfully, but these errors were encountered:
There's no need to support old browsers. Newer version of maplibre will support new browsers while old versions can support old browsers (given that the old version does not have a "big" market share).
I think the suggestion above is a good simplification and moves the responsibility to regexp, which is better than hardcoding stuff like it is right now.
For several years, I’ve been manually maintaining a relevant subset of the Unicode Character Database that GL JS uses to detect scripts for vertical layout, ideographic line breaking, complex text layout, and right-to-left layout. This solution works reasonably efficiently, but it’s difficult to keep it up-to-date as Unicode evolves, because relatively few contributors are familiar with these parts of the Unicode standard or the associated text layout conventions.
I think the custom script detection logic should be replaced by Unicode-aware regular expressions where possible. I’ve identified two such opportunities; there may be others.
It should be possible to replace the following function:
maplibre-gl-js/src/util/script_detection.ts
Lines 268 to 275 in 007ad7b
with the following code:
and replace the following function:
maplibre-gl-js/src/util/script_detection.ts
Lines 37 to 63 in 007ad7b
with the following code:
This will make the functions more future-proof, so that we don’t need to notice that a new CJK-related block has been added to Unicode etc. The downside is that this requires a relatively recent version of ECMAScript. This codebase has never used a Unicode regular expression so far, let alone a Unicode character escape. Does GL JS still maintain capability with Chrome 63, Firefox 77, or Safari 11.0 or earlier versions of these browsers?
Unfortunately, it isn’t currently possible to replace
charHasUprightVerticalOrientation()
,stringContainsRTLText()
, orunicodeBlockLookup
with something more robust, because the ECMAScript standard doesn’t yet allow a regular expression to match on theVertical_Orientation
,Bidi_Class
, orBlock
property, respectively.The text was updated successfully, but these errors were encountered: