openstreetmap / iD

🆔 The easy-to-use OpenStreetMap editor in JavaScript.
https://www.openstreetmap.org/edit?editor=id
ISC License
3.37k stars 1.21k forks source link

Tamil characters are broken #5342

Open ammahir opened 6 years ago

ammahir commented 6 years ago

Hi

I found an issue with road-ways which is not displaying tamil text correctly. https://www.openstreetmap.org/edit?editor=id#map=21/13.07963/80.28161

Road should display:முத்துசுவாமி சாலை

but it is splitted and showing like below.

ம+ு+த்த+ு+ச+ு+வ+ா+மி ச+ா+ல+ை

Please refer the unicode characters for tamil here. http://www.fileformat.info/info/unicode/block/tamil/list.htm

in chrome console, i see error as below:

//Refused to load the font 'https://cdn.joinhoney.com/fonts/icons/honey-icons.woff?vbeftd' because it violates the following Content Security Policy directive: "font-src 'none'".//

Thanks Mahir

mmd-osm commented 6 years ago

Follow up for: https://github.com/openstreetmap/openstreetmap-website/issues/2004

You didn’t mention the error message last time, so maybe this is really a csp issue.

bhousel commented 6 years ago

My guess is that the CSP issue is unrelated - that's a browser extension trying to load some other icons.

I just tried it out on my machine (Chrome 68.0.3440.106 on macOS 10.13.6) and it does indeed look wrong.

screenshot 2018-09-29 11 04 45

The issue seems to be only with characters drawn along the textpaths, because the road name looks correct in the sidebar:

screenshot 2018-09-29 11 04 58

cc @mapmeld who knows much more about this than I do..

mapmeld commented 6 years ago

I just checked and Hindi has the same issue, only in roads, and I don't see it in Firefox (so, it's a Chrome/Webkit SVG textPath issue). Arabic is also doing something new with word order. I don't get the font-loading error - only thing which fails to download is piwik js.

screen shot 2018-09-29 at 8 41 00 am

My guess is that Chrome recently changed textPath in an unexpected and uncool way.

One idea which I saw just now, and hadn't considered before, is using \<foreignObject> to embed a horizontal HTML span into the SVG on Chome. This wouldn't follow the road, but it would be legible. I think it's worth considering.

ammahir commented 6 years ago

any fix for chrome? Firefox have no issue

bhousel commented 6 years ago

any fix for chrome? Firefox have no issue

AFAIK nobody is working on this issue currently. From @mapmeld's comment it sounds like a font shaping bug in Chrome's SVG text renderer, not something that iD is doing wrong.

TAQ2 commented 5 years ago

Hi, I would like to explore this issue

I just checked and Hindi has the same issue

Please could you let me know what you did exactly, did you set your language in open street map or in chrome etc?

mapmeld commented 5 years ago

@TAQ2 It's a problem in Chrome (and related browsers, like Brave). It's not based on setting your language... it's more like if a road or other line label has complex text. A "grapheme cluster" like हि will be split up ("ह ि") in the label

TAQ2 commented 5 years ago

Ok then I don't understand how to recreate the error. When I click the OP's link and then click the road, all the writing is in English for me. Hence I thought the language should be changed

image

Please could you explain step by step how to recreate the scenario. Thanks :)

bhousel commented 5 years ago

Thanks @TAQ2 for looking into this.. You can reproduce the error by using Chrome and creating a road and pasting the Tamil characters into the name of that road.

In this screenshot, I copied them from the nearby road "முத்துசுவாமி சாலை" which has both English and Tamil names. (It's ok to draw a road like this for testing, but please don't save the map this way!).

Screenshot 2019-10-26 11 44 33
TAQ2 commented 5 years ago

Ok after many tests there seems to be no hack that will fix this. My simplified example of the error here for reference https://jsfiddle.net/xt1o6kg9/

There are a few related tickets on the chromium bug tracker that I have subscribed to for updates, namely: https://bugs.chromium.org/p/chromium/issues/detail?id=927214 https://bugs.chromium.org/p/chromium/issues/detail?id=593570 https://bugs.chromium.org/p/chromium/issues/detail?id=374526

My recommendation for this ticket would be to add the label waitingfor and remove the help wanted label as there is nothing that can be done at this time

bhousel commented 5 years ago

My recommendation for this ticket would be to add the label waitingfor and remove the help wanted label as there is nothing that can be done at this time

Sounds good - thanks for digging into the issue!

mapmeld commented 3 years ago

I have some good news - after a long long wait, the SVG textPath bug is fixed and it's in early release Chrome Canary / Chromium 96.0. This ends the need for OSM / iD to find another render option.

I'll make a PR soon to turn off our RTL patches on Chromium >= 96.0

mapmeld commented 2 years ago

This bug was fixed in today's stable version of Chrome / Chromium browser, and should be closed.