Using Robofab to set a glyph's unicode value

blank's picture

I am trying to write a script that adds nbspace to a font and sets the proper width. I can do that, but autoUnicodes cannot find a value for nbspace. How do I assign a specific unicode value to nbspace after I have created it.

FYI, the code I am using is:

#FLM: Add NBSP and set width

from robofab.world import CurrentFont, CurrentGlyph
from robofab.interface.all.dialogs import SelectGlyph

font = CurrentFont()
font.newGlyph("nbspace")
glyph = font["nbspace"]
glyph.autoUnicodes()

Mark Simonson's picture

Are you putting glyph.update() at the end? You could try naming it uni00A0.

blank's picture

I figured it out. I needed to assign glyph.unicode (not glyph.unicodes) to the decimal value of 00A0.

Thanks, Mark.

Syndicate content Syndicate content