fabrizioschiavi / pragmatapro

PragmataPro font is designed to help pros to work better
https://www.fsd.it/shop/fonts/pragmatapro/
1.45k stars 39 forks source link

Ligatures in regex #290

Open cskujbus opened 8 months ago

cskujbus commented 8 months ago

Regular expressions look a bit awkward with ligatures. Somehow the Iosevka font handles them correctly like on the picture (left: PP8.30, right: Iosevka29.04). Is it possible to do something in case of regular expressions?

Screenshot_20240330_093703

fabrizioschiavi commented 8 months ago

Probably you need to use the PragmataPro versions without Liga to fix this. Please let me know if your request is more complex.

svipas commented 5 months ago

@fabrizioschiavi I checked other fonts like Iosevka and they detect and disable ligatures in certain patterns. I believe they do that for cases like this so you could read regex properly. Current workaround would be to disable ligatures if you need to read regex which contains ligatures, but I would love to see something like with Iosevka, Fira Code, etc. in the future.

You can install these fonts and try yourself you will see what they do, also, they are open source maybe you can take parts they are using to disable ligatures in such scenarios.

Also, depends on how complex is this to achieve, maybe it isn't worth it from your side.

fabrizioschiavi commented 5 months ago

@svipas thanks for this precious suggestion! Could you or someone else let me know a list of regex patterns to disable, please? Are you sure Iosevka and Fira Code included all this patterns?

svipas commented 5 months ago

I found out commit in Iosevka: https://github.com/be5invis/Iosevka/commit/a52d8e7ca5cd4ac4f4ffe35128428263f3afae79

If you go into otl/gsub-ligation.ptl you will see Disable regular expression lookaheads


In Fira Code I also found:

  • Disabled ligatures after regexp lookahead/lookbehinds (?<=< (?<=> (?<==> (?<=| (?<== (?=:= (?=!= (?== (?=== (?==> (?=> (?=>> (?=<< (?=/= (?!! (?!!. (?!= (?!== (?<!! (?<!!. (?<!= (?<!== (?<!--

This commit: https://github.com/tonsky/FiraCode/commit/2ca064ae04d955378ab2001a640bf12259b3467c

fabrizioschiavi commented 5 months ago

@svipas you are always a great supporter of this project! Thank you for your help!