ITADN

Sinhala Font rendering

#5215Openastridx 创建于 2026-04-19
texthelp wanted
A
astridxcommented
In the German style [openstreetmap-carto-de](https://github.com/giggls/openstreetmap-carto-de), which is based on openstreetmap-carto, there is an [issue](https://tile.openstreetmap.de/#map=7.00/80.75150/7.88263) with the rendering of the country name for Sri Lanka. The style uses among other `name:si `for Sinhala labels. The issue does [not occur on the OpenStreetMap](https://www.openstreetmap.org/search?query=sri+lanka&zoom=8&minlon=75.67382812500001&minlat=5.484768018141262&maxlon=85.83068847656251&maxlat=10.271681232946728#map=8/7.885/80.752 ) map, since the [`name`](https://www.openstreetmap.org/relation/536807) is in Latin script and `name:si `ist not used. But: When following the [guide](https://switch2osm.org/serving-tiles/manually-building-a-tile-server-debian-13/) for setting up a [minimal tile server](https://download.geofabrik.de/asia/sri-lanka.html), the issue becomes reproducible as well if copy `name:si` to `name`. ``` $ sudo -u postgres -i psql gis psql (17.9 (Debian 17.9-0+deb13u1)) Type "help" for help. gis=# update planet_osm_polygon set name = (select tags->'name:si' from planet_osm_polygon where osm_id=-536807) where osm_id=-536807; UPDATE 1 gis=# select name from planet_osm_polygon where osm_id=-536807; name ---------- ශ්‍රී ලංකාව (1 row) ``` _Noto Sans Sinhala UI Regular_ at the end of the font-list in openstreetmap-carto with `name:si` copied as `name`: <img width="715" height="502" alt="Image" src="https://github.com/user-attachments/assets/515cf652-1075-4a18-8057-417101496192" /> My experiments suggest that the issue may be related to behavior in Mapnik/HarfBuzz. Setting _Noto Sans Sinhala UI Regular_ as the first font in [@book-fonts](https://github.com/giggls/openstreetmap-carto-de/blob/master/style/fonts.mss) results in correct rendering. When placed later in the font stack, the first character appears partially broken or incorrectly shaped. I think that HarfBuzz may only correctly apply complex text shaping when the Sinhala font is the primary font used. _Noto Sans Sinhala UI Regular_ as the first font in openstreetmap-carto-de <img width="256" height="256" alt="Image" src="https://github.com/user-attachments/assets/5c720b20-55f9-4d62-a5c3-95fb64ea9c99" /> _Noto Sans Sinhala UI Regular_ as the second font in openstreetmap-carto-de <img width="256" height="256" alt="Image" src="https://github.com/user-attachments/assets/0cc52e3c-9652-4542-93cb-ad24d9ccbd31" /> This is how I arrived at [this solution](https://github.com/giggls/openstreetmap-carto-de/compare/master...astridx:openstreetmap-carto-de:sinhala?expand=1). I would appreciate it if someone could confirm whether my assumptions are correct and, if so, whether this would be welcome as a pull request here. Also, I am wondering what has changed, since it [apparently used to work before](https://github.com/openstreetmap-carto/openstreetmap-carto/issues/2337).
7 条评论