osm-americana / openstreetmap-americana

A quintessentially American map style
https://americanamap.org
Creative Commons Zero v1.0 Universal
185 stars 61 forks source link

Preview of MapLibre text rendering overhaul #1149

Open 1ec5 opened 3 months ago

1ec5 commented 3 months ago

In 1ec5/maplibre-gl-js#1, I’ve been prototyping an overhaul of text rendering in MapLibre GL JS to support the rest of the Unicode character repertoire including rarer CJKV characters, correctly shape Indic and other complex text, respect variant selectors, place combining diacritics over base characters, improve bidirectional text support, render (silhouettes of) emoji, wrap lines by word in Thai and Khmer, and more.

This branch replaces the MapLibre GL JS dependency with that branch so that interested members of the public can conveniently test-drive the improved text rendering and layout functionality in the context of OSM Americana. There are some caveats to be aware of:

Please leave any feedback about the improved text processing in 1ec5/maplibre-gl-js#1. Thanks!

Before After
那市镇 (Na Hang)
那🌫️市镇
那𧯄市镇 (Na Hang)
那𧯄市镇
Naypyitaw Naypyitaw
आउटर सर्किल आउटर सर्किल
ශ්රී ලංකාව
ශ්රී ලංකාව
ශ්‍රී ලංකාව
ශ්‍රී ලංකාව
ކޮންގޯ (ދިމިޤްރާޠީ ޖުމްހޫރިއްޔާ), ހިންދު ކަނޑު ކޮންގޯ (ދިމިޤްރާޠީ ޖުމްހޫރިއްޔާ), ހިންދު ކަނޑު
มหาสมุทรอ  ินเด ีย
มหาสมุทรอ ินเด ีย
มหาสมุทรอินเดีย
มหาสมุทรอินเดีย
ภาคตะนาวศรี
ภาคตะนาวศรี

ภาค/ตะนาว/ศรี
ภาค
ตะนาว
ศรี
sməqʷəʔelə həw̓aləm̓ew̓txʷ
sməqʷəʔelə həw’aləm’ew’txʷ
sməqʷəʔelə həw̓aləm̓ew̓txʷ
sməqʷəʔelə həw̓aləm̓ew̓txʷ
We Puro
We 🌫️ Puro
We ❤️ Puro
We ❤️ Puro
hotel 79
hotel 79 🌫️
hotel 79 👍🏿
hotel 79 👍🏿
Garten von Czernowitz / Чернівці
Garten von Czernowitz / Чернівці 🌫️
Garten von Czernowitz / Чернівці 🇺🇦
Garten von Czernowitz / Чернівці 🇺🇦
One Foot Island
One Foot Island 🌫️🌫️🌫️
One Foot Island ⭐️⭐️⭐️
One Foot Island ⭐️⭐️⭐️

This is an improvement over the status quo for Mapnik-based renderers as well. Many computers come with fallback fonts with larger repertoires than what these renderers specify, and browsers use dictionaries to break lines more intelligently in languages that don’t use spaces.

OSM Carto Americana before and after
臺北市/立聯合/醫院和/平婦幼/院區婦/幼院址
臺北市
立聯合
醫院和
平婦幼
院區婦
幼院址
臺北市立聯/合醫院和平/婦幼院區/婦幼院址
臺北市立聯
合醫院和平
婦幼院區
婦幼院址


臺北市立/聯合醫院/和平婦幼院/區婦幼院址
臺北市立
聯合醫院
和平婦幼院
區婦幼院址
�������� ����
�������� ����
🌫️🌫️🌫️🌫️ 🌫️🌫️🌫️🌫️🌫️🌫️🌫️🌫️
🌫️🌫️🌫️🌫️ 🌫️🌫️🌫️🌫️🌫️🌫️🌫️🌫️

𐴀𐴝𐴐𐴞𐴥𐴑𐴧𐴝 𐴉𐴝𐴌𐴝
𐴀𐴝𐴐𐴞𐴥𐴑𐴧𐴝 𐴉𐴝𐴌𐴝
������������������� �������� «�𝐵�-�𝐸𝑅𝑀»
������������������� �������� «�𝐵�-�𝐸𝑅𝑀»
«-»
«-»

𝘋𝘌𝘙𝘔𝘈𝘛𝘖𝘒𝘖𝘚𝘔𝘌𝘛𝘖𝘓𝘖𝘎𝘠𝘈 𝘖𝘙𝘛𝘈𝘓𝘠𝘎𝘠 «𝒪𝐵𝒰-𝒟𝐸𝑅𝑀»
𝘋𝘌𝘙𝘔𝘈𝘛𝘖𝘒𝘖𝘚𝘔𝘌𝘛𝘖𝘓𝘖𝘎𝘠𝘈 𝘖𝘙𝘛𝘈𝘓𝘠𝘎𝘠 «𝒪𝐵𝒰-𝒟𝐸𝑅𝑀»
(������������)
(������������)
( )
( )

(𝘎𝘳𝘶𝘣𝘦𝘯𝘸𝘦𝘪𝘩𝘦𝘳)
(𝘎𝘳𝘶𝘣𝘦𝘯𝘸𝘦𝘪𝘩𝘦𝘳)

If you see misshapen Burmese text, it may be due to an encoding issue in OSM data rather than a text rendering glitch on the client side. For example, this swimming pool shows up as “​ေရပန္​းဥယ်ဥ္” because the name in OSM is Zawgyi-encoded. Transforming it to the Unicode equivalent, “ရေပန်းဥယျဉ်”, would cause it to render just fine.

Zawgyi Unicode
​ေရပန္​းဥယ်ဥ္
​ေရပန္​းဥယ်ဥ္
ရေပန်းဥယျဉ်
ရေပန်းဥယျဉ်

Fixes #827.