exporting all the glyphs in a font into a text file

Eben Sorkin
14.Mar.2008 7.26pm
Eben Sorkin's picture

I feel especially silly asking about this because about a month ago I figured out how to do this. It seems to me that either Fontlab or maybe Font Explorer had a feature that would export all glyphs in a font into a unicode text file. Maybe it’s yet a third app. In any event if you recall & can remind me I will be most grateful. Thanks!



Spire
14.Mar.2008 9.34pm
Spire's picture

TTX?


Eben Sorkin
15.Mar.2008 1.45am
Eben Sorkin's picture

Nice link by gum! But that does another different cool thing. I want a txt file with the whole:

“aæbcdeffffiflghiijjklmnoœøpqrsßtuvwxyzðþAÆBCD
EFGHIIJJKLMNOŒØPQRSTUVWXYZÐÞ1234567890ªº&*
$€£¢¤#%•«†»‹‡›@§ƒ¶()[]{}\|/~:;.!¡?¿’”‘“”’
-—_¦™^ÀÁÂÃÄÅÆǺǻÇÈÉÊËÌÍÎÏÑÐÒÓÔÕÖØÙÚÛÜÝàáâã
äåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČč
ĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĦħĥĨĩĪīĬĭĮįİıIJijĴĵĶ
ķĸĹ壳ĽľĿŀļĻŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞş
ŠšŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ√∂∫∞+–÷×=≠≈
±¼½¾°©®™µΩ∆∑∏” + plus the other glyphs.

As I say there really is a simple easy way to kick one out. And I will find the way again eventually but I hope somebody will be able to remind me instead!


Jos Buivenga
15.Mar.2008 3.23am
Jos Buivenga's picture

Eben, why not select all glyphs, open the preview window, switch to text mode, select and copy everything and paste it into a text doc?


Eben Sorkin
15.Mar.2008 10.54am
Eben Sorkin's picture

I will try that now. Thanks!


Eben Sorkin
15.Mar.2008 11.06am
Eben Sorkin's picture

I have them all in, but I can’t seem to find the way to “switch to text mode”. Maybe that is a FL5 Mac vs PC difference...


Jos Buivenga
15.Mar.2008 11.57am
Jos Buivenga's picture

On the mac it’s next to ’metrics mode’ and ’kerning mode’


Mark Simonson
15.Mar.2008 2.18pm
Mark Simonson's picture

Hey, that works. Pretty handy trick!


Jos Buivenga
15.Mar.2008 2.46pm
Jos Buivenga's picture

Thanks. I also use it the other way around. I first discovered this when I wanted to paste a Cyrillic text in FL.


John Hudson
15.Mar.2008 8.04pm
John Hudson's picture

Of course, you can only put encoded glyphs into a text file. I recently wanted to create an InDesign document that contained all the glyphs in a font, including the unencoded glyphs, and Eric Menninga at Adobe very kindly wrote me a script to do this. Eric says he plans to tidy the script up and post it to Typophile at some point.


Eben Sorkin
15.Mar.2008 10.10pm
Eben Sorkin's picture

That is really great! I am pretty sure this is a different method, but this seems like an far better one. Thanks Jos!


Jos Buivenga
15.Mar.2008 10.55pm
Jos Buivenga's picture

You’re welcome Eben.

That’s true John, but if you load the font first from which you’re pasting, it will work.

*edit* At least on a Mac. Can’t test it on Windows.


Eben Sorkin
15.Mar.2008 11.33pm
Eben Sorkin's picture

Eric says he plans to tidy the script up and post it to Typophile at some point.

That’s great news.


Sebastian Nagel
17.Mar.2008 2.07am
Sebastian Nagel's picture

I want this script! How can I make sure that I don’t miss it’s release? :)

This would save me so much time to keep my glyph lists in my Indesign test documents up to date (up to font). This is really a pain at the moment, it’s time consuming and full potential errors ...


Jens Kutilek
18.Mar.2008 6.45am
Jens Kutilek's picture

It’s not too hard to accomplish using InDesign Tagged Text.

You just have to know the number of glyphs in your font, and then write an InDesign Tagged Text header to a text file, followed by a tag for each glyph ID.

Somthing along these lines in python:

import sys
print 'your tagged text header goes here'
for gid in range(425):
  sys.stdout.write('<cSpecialGlyph:'+gid+'><0xFFFD><cSpecialGlyph:>')

Insert some unencoded glyphs in InD via the glyph palette, export to tagged text and look at it in a text editor to figure out how it’s done exactly.

Hm, come to think of it I should have made a program out of it and charged for it ;) Oh well, just send me your fonts that you proof with this script :)

Cheers,
Jens


jselig
18.Mar.2008 10.40am
jselig's picture

Of course, you can only put encoded glyphs into a text file. I recently wanted to create an InDesign document that contained all the glyphs in a font, including the unencoded glyphs, and Eric Menninga at Adobe very kindly wrote me a script to do this. Eric says he plans to tidy the script up and post it to Typophile at some point

Now that wold be handy.


paul d hunt
18.Mar.2008 11.12am
paul d hunt's picture

if you want encoded glyphs, in FLS5 you can do the “test font feature” and then there should be an option to show all glyphs in the font (with unicode values). Then from this dialogue box you can copy/paste the output.
i’d give more explicit instrux, but am away from my own laptop just now...


Sebastian Nagel
28.Mar.2008 1.04am
Sebastian Nagel's picture


app.findGlyphPreferences = NothingEnum.nothing;
app.changeGlyphPreferences = NothingEnum.nothing;
app.findGlyphPreferences.appliedFont = app.fonts.item("Garamond Premier Pro Italic");
app.changeGlyphPreferences.appliedFont = app.fonts.item("Garamond Premier Pro Italic");

var t = app.activeDocument.textFrames.add({geometricBounds:[0,0,210, 148] });
var glyphenzahl = 2555;
var s = t.parentStory;
var c = fillStory( s, glyphenzahl );
var startGlyphID = 1;
app.findGlyphPreferences.glyphID = startGlyphID;

for ( i = 1; i <= glyphenzahl; i++ )
{
app.changeGlyphPreferences.glyphID = i;
c[i].changeGlyph();
}

function fillStory( aStory, aCounter )
{
aStory.contents = '';
for ( i = 0; i < aCounter; i++ )
aStory.insertionPoints[-1].contents = ' ';
return aStory.characters;
}

So this is a “beta”-version of the script, created with the kind help of www.hilfdirselbst.ch (swiss user-to-user support site). It inserts all glyphs of a Font to a new text frame in Indesign CS3. The glyphs do not need to be encoded with a unicode point.

What the script does: create a text frame with as much ” ” inserted as the font has glyphs as “search dummies”. Start a search and replace script, searching for ” ” and replacing it with i+1 glyph number each time it finds one.
It is done per “search and replace” as it does not seem to be possible to directly access Glyphs per GID to insert them into a textframe, but it works per glyph search to replace them.

One have to adjust:
- 2 times Font-Family name und weight (separated per Tabulator: “Times New Roman[TAB]Regular”)
- choose the same font as default setting in your Indesign document to be sure it works. I think as it is not specified in the script, this is necessary.
- insert the glyph count of the font in the line “var glyphenzahl = 1234;”
- “var startGlyphID=1”: the GID of the “space” glyph of your font. Any other unicoded(!) glyph can be used as well, but be sure to read the next line if you do this!
- in the line “aStory.insertionPoints[-1].contents = ’ ’” the same glyph has to be inserted as specified in “startGlyphID” (i.E. if you have inserted the GID of the space character above, you have to enter a space here. These have to correspond, otherwise it won’t work.)

This can be optimised for sure, but it works quite well for Adobes Garamond Premier Pro and for some of my fonts I was building it for.

I hope this is useful to some of you. Don’t hesitate to improve it... I am a scripting noob, so there for sure is space for optimization.


Goran Soderstrom
28.Mar.2008 1.24am
Goran Soderstrom's picture

This also works fine:

Tools > Quick Test As
Then choose: All characters
:)


Sebastian Nagel
28.Mar.2008 3.03am
Sebastian Nagel's picture

> This also works fine:

for encoded characters...