photopea / Typr.js

Typr.js - process fonts in Javascript
MIT License
920 stars 73 forks source link

Rendering Arabic ligatures without processing #38

Open minzhang2 opened 3 years ago

minzhang2 commented 3 years ago

I needed to render Arabic and found that the ligatures were not processed, so I introduced HarfBuzz and used it according to the instructions, but it didn’t work. image I want this image

photopea commented 3 years ago

Hi, when you call shapeHB(), do you set the third parameter "ltr" to "false"?

minzhang2 commented 3 years ago

No, the default value is "undefined", i do not think need to set "false"

photopea commented 3 years ago

Can you send me your font, please?

minzhang2 commented 3 years ago

NotoSans-Bold.ttf font.zip

photopea commented 3 years ago

That is really strange. If you replace your font with DejaVu Sans (https://www.fontsquirrel.com/fonts/dejavu-sans) and keep your code without change, it is rendered correctly. I will have to look into it.

minzhang2 commented 3 years ago

I tried, and it was amazing

photopea commented 3 years ago

@minzhang2 turns out your font has some old shaping mechanism. Could you use the latest font instead? Officially, you are supposed to use this font: https://github.com/googlefonts/noto-fonts/blob/master/hinted/ttf/NotoSansArabic/NotoSansArabic-Bold.ttf

minzhang2 commented 3 years ago

I use fabricjs is ok,I don't understand why

photopea commented 3 years ago

In fabric JS, the text is rendered by a web browser (which supports old shaping mechanisms). Just replace your TTF file with the newer on.e

minzhang2 commented 3 years ago

ok, very thanks