Export .enc files as .txt?
Max Phillips
Posts: 474
Is it possible to export the encoding file of a particular vfb as a separate text file, and not as part of a generated font? (I did try to RTFM, by the way, but couldn't find what I needed.) Can you do this in FL, or does it require some other utility? I'd like to capture the glyph complement of a family I'm working on and edit the encoding to put the glyphs in a more sensible order.
0
Comments
-
Select all the glyphs and hit copy. Then paste into a text editor, which will dump all the names with slashes in front of them. Then find/replace all of the slashes with line breaks in Indesign, Textwrangler, etc. After that add a header and you’re done.0
-
Dude! Now that's what I call cutting the Gordian Knot. Thanks, James.
The glyphs won't be numbered, of course. Is it necessary to add a glyph number after each glyph name, as I've seen done? It does make it cumbersome to change the order of the glyphs, since you've then got to redo the numbering as well.0 -
This Robofab script will save an encoding file to the Mac desktop in with the glyphname and index on each line. Robofab doesn't deal with encodings directly so you have to access the FL encoding object directly, which is called font.naked().encoding. The encoding object is an iterable list of records that have fields called name and unicode.
import os, robofab.world font = robofab.world.CurrentFont() encoding_out = [] for index, encodingRecord in enumerate(font.naked().encoding): encoding_out.append("%s %s" % (encodingRecord.name, index)) encoding_out = "\n".join(encoding_out) path = os.path.join(os.path.expanduser("~"), "Desktop", "encoding_out.enc") file_object = open(path, 'w') file_object.write(encoding_out) file_object.close()
0 -
You can also press the little button in FontLab called "Save Encoding".0
-
The user and all related content has been deleted.0
-
Thanks, Matthew!0
-
The user and all related content has been deleted.0
-
BTW you can import an encoding like this, where path is the path to the encoding on disk.
font = robofab.world.CurrentFont() font.naked().encoding.Load(path) font.update()
Yes, a script is overkill for one font. But I find that Fontlab has a habit of "forgetting" the encoding at inopportune times. So I build this into other scripts that do things that rely on the encoding (e.g., generate a font).0 -
@ James M: How do you rearrange glyphs in Index mode? I've never been able to manage it. And where is Save the Encoding File? Or, as Göran calls it, the little button?
0 -
In Index mode, you can drag the glyphs around and rearrange them. Once you have an ordering you like, choose Glyph > Glyph Names > Save Encoding. (This is only available in Index mode.)0
-
By the way, if you want to start with a particular existing encoding before you start rearranging glyphs, switch to Names mode, select the encoding, then choose Glyph > Sort Glyphs > By Encoding. When you go to Index mode, the glyphs will be arranged in this order.0
-
The user and all related content has been deleted.0
-
The "little button" is here:
After that you can open up the encoding end edit it, rename to something you like.0 -
OK, I was grabbing the glyphs wrong, clicking the on cell instead of the cell header. That's why they didn't move. Now everything's lovely.
Thanks, Göran, Mark, and James.0 -
Oh, that button. I was wondering what you meant. I normally have my font windows with the tool bar at the bottom, which provides a slightly wider range of functions and takes up less space. The "save encoding" button is absent with that option.0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 799 Font Technology
- 1K Technique and Theory
- 617 Type Business
- 444 Type Design Critiques
- 541 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 483 Typography
- 301 History of Typography
- 114 Education
- 68 Resources
- 498 Announcements
- 79 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 269 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports