glyphr-studio / Glyphr-Studio-1

A free, web-based font editor, focusing on font design hobbyists.
glyphrstudio.com
1.07k stars 93 forks source link

Do not allow special characters in metadata #273

Closed mattlag closed 5 years ago

mattlag commented 6 years ago

It breaks SVG, specifically & but probably others

jackhumbert commented 5 years ago

Would this affect ligatures not working after converting an SVG font to OFT? I've been unable to get . or ' to work, but alphas have no issue. Both still show up in the liga look-up table.

mattlag commented 5 years ago

I think this is a separate issue - since SVG is an XML language, if you try to use certain characters in strings (like &) the XML document fails validation:

image

Converting ligature information from SVG to OTF... if some regular characters are converted but ligatures are not, it doesn't seem like metadata would be causing that.

(in a totally side note, Glyphr Studio will soon support direct export for Ligatures to OTF, without going through SVG first, it's what i'm working on now 😃 )

jackhumbert commented 5 years ago

Ah, gotcha! Thanks :) That's Glypher-Studio-2, right?

mattlag commented 5 years ago

Hey @jackhumbert i've been thinking about your comment... I haven't specifically tested XML special characters as Ligatures... but it should "just work" because ligatures are specified in SVG using code points, not text:

image

When you say they show up in the liga lookup table, are you using something to open up the resulting OTF file (like TTX)? Maybe there is something odd with the OTF spec that doesn't allow some characters to be parts of Ligatures? Another possible issue with SVG to OTF conversion is that it's a process outside of Glyphr Studio, so I can't control it - there may be some bug in whatever code is doing the conversion.

mattlag commented 5 years ago

Ligatures were recently added to OpenType.js, so I may just throw it into Glyphr-Studio-1 😃 A lot of the infrastructure is already in place.

Glyphr-Studio-2 is still very rough and probably a long way off from being in Beta.

jackhumbert commented 5 years ago

This is the font I've been messing with - the ligatures that don't work in OTF are .ia and .i'. My process right now is to export via SVG, then convert to OTF via something like this - I'm unsure of the quality of the conversion, or if there's a better, more complete way.

I'm using Font Forge to inspect the GSUB lookups in the resulting OTF font. I could see something being weird with the spec, but the TTF files seem to have the same issue, and I've checked out the Kira font's lookups, which declare all sorts of tables, with various symbols. I'm not sure if certain tables are needed for certain replacements like that.

Ligature exports with OTF in GS1 would be awesome! I had the pull request that added them to opentypejs marked, but saw that you had already upgraded to the latest version of it in GS2 :)