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

How-To Display Proper Unicode text via ExtendScript

Community Beginner ,
Oct 20, 2024 Oct 20, 2024

Copy link to clipboard

Copied

Is there a way to properly display UNICODE text when adding it via script. I was able to get Illustrator to display UNICODE by enabling "Show Indic Options" under Type Preferences but it still fails via script.

 

Text Settings.pngUnicode Problem.png

TOPICS
Scripting

Views

304

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

correct answers 1 Correct answer

Engaged , Oct 21, 2024 Oct 21, 2024

That’s a font issue, not a Unicode issue. The empty box symbol means the current font doesn’t contain the required glyph.

 

Set the text in a font that contains the “⅛” glyph (e.g. try Arial) and it appears correctly.

Votes

Translate

Translate
Adobe
Enthusiast ,
Oct 20, 2024 Oct 20, 2024

Copy link to clipboard

Copied

Would it help to use the Unicode character for insertion?

var tf = app.activeDocument.textFrames.add();
tf.contents = '\u215B" Diameter';

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
Engaged ,
Oct 21, 2024 Oct 21, 2024

Copy link to clipboard

Copied

That’s a font issue, not a Unicode issue. The empty box symbol means the current font doesn’t contain the required glyph.

 

Set the text in a font that contains the “⅛” glyph (e.g. try Arial) and it appears correctly.

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 Beginner ,
Oct 21, 2024 Oct 21, 2024

Copy link to clipboard

Copied

I used this script to cycle thru my fonts and obtain proper names for scripting and as you said Arial is one the fonts that contain all necessary glyphs to display the Unicode fractions. Thanks for the help.

Screenshot 2024-10-21 at 9.32.38 AM.png

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 ,
Nov 20, 2024 Nov 20, 2024

Copy link to clipboard

Copied

LATEST

Great script! For advanced text manipulation or working with hidden text, you can also explore Text Invisible—a handy tool for such tasks. Let me know if you'd like details!

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
Advocate ,
Oct 21, 2024 Oct 21, 2024

Copy link to clipboard

Copied

Salut!

Petit script en réponse...

// JavaScript Document
// diametre.js
var police1 = "SymbolMT";

var doc = activeDocument;

 var Phi = String.fromCharCode(8709); // Phi = "\u2205";

      alert(Phi+" 1254");

      police1 = getFont(police1);
      var pointText = doc.textFrames.pointText([20,-20]);
          pointText.contents = Phi+" 1254";
          if (police1 != undefined) pointText.textRanges[0].textFont = police1;
// -------
function getFont(nomPolice) {
     try {
       var police = textFonts.getByName(nomPolice);
     }   catch (e) {
        alert( "The specified font doesn’t exist" );
        return undefined;
        }
     return police;
}
// -------

si ensuite vous modifez la police, dans de nombreux cas le symbole ∅ subsiste.

René

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