Goal : to insert a character Glyph using script for Photoshop.
I have read and tried to de-construct:
but these are for framemaker/indesign
this one changes style, but I need to insert a glyph in a certain font - it happens to be number 55 in this font and is a different version of character "z" . the unicode character is not unique.
However, this part of the script that inserts the character shows as
desc2.putString(cTID('Txt '), "���or");
which does not work.
In the Adobe extendscript docs, I see things about glyph scaling only.
There must be some ancient actionscript kungfu that will work on this.
I don't need a full function - I can handle that, I just need the nugget of code that chooses the glyph.
Can you provide a screenshot of this glyph and what font you want to use? Is this the only one you want to use and the only font?
Yea scripts for ID and other programs are very different. I wrote a few for ID. It took a lot of research. Seems like if you get the basics of what the unicode and font are, it should hopefully work with how to apply text to a text layer, but I haven't attempted this.
Copy link to clipboard
Assuming you have the Adobe cloud font "Myriad Pro Regular", which has a PostScript font name of "MyriadPro-Regular" the following works for me, just escape the Unicode with \u before the number shown in the glyphs panel:
var LayerRef = activeDocument.artLayers.add(); LayerRef.kind = LayerKind.TEXT; var textRef = LayerRef.textItem; textRef.contents = "\u00A9"; // Unicode copyright symbol textRef.position = new Array(100, 100); app.preferences.rulerUnits = Units.POINTS; textRef.size = 100; // Font size textRef.font = 'MyriadPro-Regular'; // PostScript font name textRef.justification = Justification.LEFT; var textColor = new SolidColor; textColor.rgb.red = 0; textColor.rgb.green = 0; textColor.rgb.blue = 0; textRef.color = textColor; app.preferences.rulerUnits = Units.PIXELS;
Edit: ScriptingListener records rubbish:
var desc12505 = new ActionDescriptor(); var idtextKey = stringIDToTypeID( "textKey" ); desc12505.putString( idtextKey, """�""" );
But changing it to the following also works:
var desc12505 = new ActionDescriptor(); var idtextKey = stringIDToTypeID( "textKey" ); desc12505.putString( idtextKey, """\u00A9""" );
(snippet, not full code)
the font name is Felisha. the glyph I want does not have a unicode value, unlike the regular letter "z"
I tried using Fontforge to copy/pastee the characters to a spot in the table with a unicode value, then re-generate the font as a new file and install. That didn't work I don't see the characters I made in the Adobe glyph table, nor does the script Stephen posted (using new unicode) work. I know very little about font creation, likely did something wrong. I will try other font creators to see if I can force these characters to have a "proper" unicode reference.
my fontforge attempt:
felisha font as is
copy pasted into an empty spot
I only know how to do this with Unicode.
Looking at the following, it is possible to script in InDesign, however, I'm not sure if that could be rewritten for Photoshop or not (Photoshop's text scripting capabilities are not as strong).
I don't have access to that font, and not sure what font that I do have that would reproduce what you're getting. Odd that it doesn't have a unicode number.
I ended up editing the font, copying the glyphs to locations with unicode, and then referencing that unicode as pointed out by Stephen. thanks.