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

Find Glyph using Unicode

Contributor ,
Jul 18, 2017 Jul 18, 2017

Copy link to clipboard

Copied

Hi,

     I need to find and change the glyphs using unicode.  When i searching the forum i got the below code.

     Here what is glyphID?  I need to find the glyphs using unicode.  How can i say unicode in the below code?

Code:

app.findGlyphPreferences = null;

app.changeGlyphPreferences = null;

app.findGlyphPreferences.glyphID = 0;

app.findGlyphPreferences.appliedFont = "Font family Name"

app.findGlyphPreferences.fontStyle = "Font Style Name"

found = app.activeDocument.findGlyph();

if (found.length > 0)

{

}

- Sudha K

TOPICS
Scripting

Views

2.2K

Translate

Translate

Report

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
Engaged ,
Jul 18, 2017 Jul 18, 2017

Copy link to clipboard

Copied

Hi,

Try this,

var myDoc = app.activeDocument;

app.findGlyphPreferences = app.changeGlyphPreferences = null;

//This is example, so please change the fonts and glyphID

app.findGlyphPreferences.appliedFont = "Minion Pro"

app.findGlyphPreferences.fontStyle = "Regular"

//Provide the glyph ID, not the glyph Unicode value.

app.findGlyphPreferences.glyphID = 366;

app.changeGlyphPreferences.appliedFont = "Minion Pro"

app.changeGlyphPreferences.fontStyle = "Regular"

//Provide the glyph ID, not the glyph Unicode value.

app.changeGlyphPreferences.glyphID = 240;

myDoc.changeGlyph(false);

app.findGlyphPreferences = app.changeGlyphPreferences = null;

Thanks,

Prabu G

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.

Votes

Translate

Translate

Report

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 ,
Jul 19, 2017 Jul 19, 2017

Copy link to clipboard

Copied

That does not use the Unicode value, it's the glyph index: InDesign ExtendScript API (12.0) . That is not the same thing.

The option to look for or replace with a Unicode is missing from the scripting engine (since CS3, I might add¹). Report it to Adobe.

Before someone says: "well it's not a problem because you can always use the regular text find/change or the GREP find/change to search for Unicode characters, like this (piece of code)". Wrong. With these you cannot (1) search for any glyph and replace it with a certain Unicode character, and (2) the other way around, search for a Unicode character and replace it with any glyph. The Glyph Find/Change dialog allows both.

¹ Which, if I remember correctly, was the first version in which this dialog appeared. So it's safe to guess "it was never there, and it was never missed in the 7 major versions since then."

Votes

Translate

Translate

Report

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 ,
Jul 20, 2017 Jul 20, 2017

Copy link to clipboard

Copied

Hi,

     Thank you....

     I have used GID to find and replace glyphs.

- Sudha K

Votes

Translate

Translate

Report

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
New Here ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

LATEST

thanks bro

Votes

Translate

Translate

Report

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