Typophile

Getting a string of all defined characters?

mummla

Hi all,

I’ve been looking for an easy, fast, automatic way to get all defined characters of a font, preferably just as a unicode string. Does anyone here know a trick?

Cheers,

Nick

I’m not sure if this is what you’re asking, but in illustrator and indesign, you just have to open the glyphs pallette by going to TYPE>GLYPHS.

You can click each one to get it’s unicode, or double-click it to put it into a selected text field.

Also, Apple’s TextEdit has a similar window EDIT>SPECIAL CHARACTERS (cmnd+opt+t). This will actually give you a lot more information than illustrator or indesign do.

I’m sure there’s a way to do it in word, but I never use it.

Hi,

Thanks for your answer but it was not really what I was looking for - to clarify I need a string of all characters that are defined in a particular font. For example:

!”#$%&’()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_‘abcdefghijklmnopqrstuvwxyz
{|}~¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõ
ö÷øùúûüýþÿĆćČčđĞğİıŁłŒœŞşŠšŸŽžƒˆ˜–—‘’‚“”„†‡•…‰‹›€™

Maintype for example gives me a good visual overview of all the characters but I have yet to find a way to automatically create a string like the above...

I don’t think it will be easy to do this without some programming, or a repetitive motion injury-inducing amount of mouse clicking.

You basically need to loop through the entries in the cmap and produce a string corresponding to each character code, appending to an output string. It seems like it should be possible to do something like this in FontLab using Python. As I am fairly non-Pythonic I cannot offer any specific advice (I achieve the same thing using tools written in another programming language instead), but I can suggest this non-language-specific pseudo-code:

     for each characterCode in fontUnicodeArray:
          set myString to myString + unichr(characterCode)
     next

     print myString

“unichr” is a function that converts a number (i.e. character code value) into a Unicode string. I believe Python has a something like that ;-) Maybe you or someone else can fill in the other bits in proper Python (and FontLab) form and get what you’re after...

Captured from web.archive.org on 6 Jul 2008. view this capture