if (app.selection.length > 0 && app.selection[0].hasOwnProperty('characters')) { var glyph_id = get_glyphID(app.selection[0].characters.item(0)); alert('Ermittelte GlyphID: ' + glyph_id); } function get_glyphID(chr) { var i = 0, r = 0, cnt = chr.contents, fnt = null, max = 10000; fnt = chr.appliedFont.fontFamily + '\t' + chr.appliedFont.fontStyleName; // Ermittlung Schrift als String app.findGlyphPreferences = app.changeGlyphPreferences = NothingEnum.NOTHING; app.findGlyphPreferences.appliedFont = fnt; app.changeGlyphPreferences.glyphID = 1; for (i = 1; i < max; i++) { app.findGlyphPreferences.glyphID = i; r = chr.changeGlyph(); if (r.length > 0) // Erfolg der Ersetzung { chr.contents = cnt; // unglücklicher Ersatz für app.undo() app.findGlyphPreferences = app.changeGlyphPreferences = NothingEnum.NOTHING; return i; } } return null // Mißerfolg }
| 29.11.2023