What might be the fastest and most accurate way to add a set of required glyphs to a UFO?



  • I have a font with a good number of glyphs, but I need to make it meet a required glyph set which lists glyphs in the following format:

    0x1EAE Ắ LATIN CAPITAL LETTER A WITH BREVE AND ACUTE
    0x1EAF ắ LATIN SMALL LETTER A WITH BREVE AND ACUTE
    0x1EB0 Ằ LATIN CAPITAL LETTER A WITH BREVE AND GRAVE
    0x1EB1 ằ LATIN SMALL LETTER A WITH BREVE AND GRAVE
    # etc
    

    I’ve done this kind of work a number of times, but I always worry that I might be missing something, and it often takes a few rounds to get things right.

    Ideally, I could also use an open-source font to put in placeholder glyphs (rather than, say, just rectangles), so it would be easy to know what glyphs are what (especially where they may not have an easily recognizable name).

    One thing I’ve tried is copying all the unicodes from the glyphset list, then pasting these into the GlyphBrowser extension. This is almost perfect – it adds AGLFN-compatible names plus proper Unicodes, which is awesome. But, it seems to be missing a few glyphs: it shows 206 when I expect 216, and it’s not clear which ones are being skipped.

    933b735b-dcc1-415f-b122-f6b5c9217899-image.png

    I guess probably my next step is to write a Python script: copy all of the required Unicodes in, plus all the names of glyphs that don’t have Unicodes, then run an AGL script like this one to set readable names where possible. And, I guess, this could also copy and scale contours from an open-source example font...

    Or, perhaps I should use a combination of GlyphBrowser plus a Python script, and that would likely be faster overall.

    Either way, that will obviously take a bit of time to complete. Is there anything already made that might make this process faster?

    Thanks!



  • @ArrowType Why not define a character set in the Font Overview preferences, and then apply it via the Sort option? You need to convert the unicode values to glyph names first but then you can apply that character set to every font that you like.


  • admin

    The GlyphBrowser extension uses GNFUL to rounding glyphName to unicodes and back. This is embedded into RoboFont and can be used!

    from glyphNameFormatter.reader import uni2name
    
    print(uni2name.get(0x1EB0))
    

    in case you have setup RoboFont with your own GNFUL, AGL list you can use the internals to get the glyphName for a unicode value:

    from mojo.tools import UV2GN
    
    print(UV2GN.get(0x1EB0))
    


  • Thanks so much for the responses, @paulvanderlaan and @frederik!

    Why not define a character set in the Font Overview preferences, and then apply it via the Sort option?

    This would probably be a decent way to do it, but I specifically want to assign mark colors to the glyphs to differentiate Latin vs Cyrillic glyphs. I might be wrong, but in a quick test, I can’t seem to assign marks to the placeholder glyphs that are added by applying a character set to a font.

    from glyphNameFormatter.reader import uni2name

    This proved to be super helpful to grab the names I needed! Thanks so much for this snippet.



  • @ArrowType said in What might be the fastest and most accurate way to add a set of required glyphs to a UFO?:

    Why not define a character set in the Font Overview preferences, and then apply it via the Sort option?

    This would probably be a decent way to do it, but I specifically want to assign mark colors to the glyphs to differentiate Latin vs Cyrillic glyphs. I might be wrong, but in a quick test, I can’t seem to assign marks to the placeholder glyphs that are added by applying a character set to a font.

    Alternatively you can define a character set as a Set in the left sidebar. That way you can always isolate those glyphs from the rest to mark them, and when you control-click on such a Set you add any glyphs that are missing.

    a88d7fc1-63f7-4eb9-b7aa-83054b75fd74-image.png



  • you can define a character set as a Set in the left sidebar

    Wow, I genuinely never knew this feature existed. I think that will be super useful! Thanks so much for pointing it out to me.


Log in to reply