Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Fetching all available characters of a font

Contributor ,
Mar 20, 2008 Mar 20, 2008
I would like to build a genaral view of the available characters of a font.
Does anybody have an idea how to fetch them?

How can I iterate though unicode values?

And how can I check, whether a character with a specific unicode value is presentable with the applied font?

Thanks in advance
Martin Fischer
TOPICS
Scripting
830
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 20, 2008 Mar 20, 2008
I think it's impossible to check if there is "real" character under specified unicode ... but maybe I'm wrong ;)

but ... maybe if you will create outline of each char and check if is empty (error when creating outline) or it is crossed or not rectangle ...

robin

--
www.adobescripts.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 20, 2008 Mar 20, 2008
Hi Robin,

> maybe if you will create outline of each char and check if is empty

Ah, good idea.

Thank you
Martin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2008 Mar 20, 2008
Martin,

my first thought was the InDiCode Script:

http://www.adobeforums.com/webx/.3bc441ad

Maybe this will help

Stefan
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 20, 2008 Mar 20, 2008
Stefan,

what a wonderful stuff!

Thank you for pointing me to this link.
I should have remembered it.

Martin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 20, 2008 Mar 20, 2008
Martin,

You can cycle through Unicode ranges using their hexadecimal numbers:

for (i = 0x0100; i < 0x017F; i++)
$.writeln (String.fromCharCode(i));

writes the characters in Latin Extended A to ESTK's console.

Peter
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 20, 2008 Mar 20, 2008
Peter,

good to know this.
(I didn't yet).

Thank you
Martin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 27, 2008 Mar 27, 2008
LATEST
Maybe somebody is interested in another approach catching all available glyphs of a font.

We had a discussion in http://www.hilfdirselbst.ch/gforum/gforum.cgi?post=343195#343195
Bastian has told that not every glyph has a unicode value. So you have to choose another way to get every glyph of a font.

Only findGlyphPreference and changeGlyphPreference do have a property glyphID. So we have been looking for a way to get the glyphs over this preferences.

Here is a workaround to catch the glyphs:


var t = app.activeDocument.pages[0].textFrames.add({geometricBounds:[0,0,210,148] });
var myFont = 'Garamond Premier Pro\tItalic'; // 'Times New Roman\tRegular'; 'Minion Pro\tRegular'
var glyphCounter = 2555;
var s = t.parentStory;
var c = fillStory( s, glyphCounter );
app.findGlyphPreferences = app.changeGlyphPreferences = NothingEnum.nothing;
app.findGlyphPreferences.glyphID = 1; // glyphID of space
app.findGlyphPreferences.appliedFont = app.changeGlyphPreferences.appliedFont = myFont;

for ( i = 1; i < c.length; i++ )
{
app.changeGlyphPreferences.glyphID = i ;
try { c.changeGlyph(); }
catch(e) { errorExit( 'Stopped with glyph no. ' + i )}
}

function errorExit( aMessage )
{
alert( aMessage );
exit();
}

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


We have used the space as placeholder.
In some fonts the glyphID of the space is 1 in some other the glyphID is 2 and e.g. in Times New Roman the glyphID is 3.
Until now I did't find a way how to read out the glyphID of the space of one font. So you should adjust 'app.findGlyphPreferences.glyphID = 1;' in the script above.

I also could't find out how to get the length of glyphs of a font.
So you should adjust 'var glyphCounter' in the script above, too.

In UI one can insert a glyphID in the search-field with its unicode-value or with its GID/CID. You can switch the units.
I couldn't find out how to insert the value als unicode-value.
I would like to set the value for the search-glyphID for space in font-independent unicode-format '\u0020'.

Thanks
Martin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines