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.
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.
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';
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.
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.
Copy link to clipboard
Copied
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!
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é