New Text Layers Causing Errors: Requires 'Myriad Pro'???

Discussion of actual or possible Photoshop Scripting Bugs, Anomalies and Documentation Errors

Moderators: Tom, Kukurykus

bjorke

New Text Layers Causing Errors: Requires 'Myriad Pro'???

Post by bjorke »

I have been distributing a script for digital-negative calibration:

http://www.botzilla.com/blog/archives/000544.html

and a number of users have complained that it keeps requiring the font 'Myriad Pro' -- which they don't have, and which my script never requests.

I've been investigating and sure enough, PS-CS2+ keeps automagically switching the font to Myriad as a default -- never a problem if you already have Myriad on your system, but otherwise you will get an error dialog on EVERY text-layer creation event. Bizarre and horrible....

The only solution so far seems to be requiring the purchase of 'Myriad Pro'
xbytor

New Text Layers Causing Errors: Requires 'Myriad Pro'???

Post by xbytor »

Does manually specify the font when you create the text layer get around the problem? I do have Myriad, but I've never noticed CS2 defaulting to it. But then again, I am usually also specifying the font which is why I asked.

-X
bjorke

New Text Layers Causing Errors: Requires 'Myriad Pro'???

Post by bjorke »

Here's the function:


function writeText(x,y,userString,val,just)
{
var c = new SolidColor();
c.rgb.red = val;
c.rgb.green = val;
c.rgb.blue = val;
var newTextLayer = activeDocument.artLayers.add();
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.font = "Arial";
newTextLayer.textItem.size = 20; // points, not pixels
newTextLayer.textItem.contents = userString;
newTextLayer.textItem.color = c;
newTextLayer.textItem.position = Array(x, y);
newTextLayer.textItem.justification = just;
return newTextLayer;
}
bjorke

New Text Layers Causing Errors: Requires 'Myriad Pro'???

Post by bjorke »

..also, I usually keep my character window open most of the time, and I do see it regularly switch to Myriad Pro all by itself, even though I may have set a different default font at some point

("Set" meaning: clicked a different font in the character window, or clicked the text tool and changed the font to some non-Myriad font before typing anything)
xbytor

New Text Layers Causing Errors: Requires 'Myriad Pro'???

Post by xbytor »

bjorke wrote: newTextLayer.textItem.font = "Arial";
}

That's your problem. Try
Code: Select all    newTextLayer.textItem.font = "ArialMT";

It needs a postscript fontname. If you don't give it one, CS2 doesn't know what you want so it happily falls back to a substitute font.

-X
bjorke

New Text Layers Causing Errors: Requires 'Myriad Pro'???

Post by bjorke »

Hoorah!
Thx man
v.bampton

New Text Layers Causing Errors: Requires 'Myriad Pro'???

Post by v.bampton »

Ok, slight variation on this same problem:

I have a dropdownlist which gives me a list of all the fonts, from which I select one. That font is then supposed to be used in the function later similar to Bjorke's one. But it keeps defaulting to Myriad Pro.

Here's the dropdownlist:

Code: Select alldlg.imgPnl.cpyPnl.cpyOptionPnl.typeSt = dlg.imgPnl.cpyPnl.cpyOptionPnl.add('statictext', [20, 130, 80, 150], 'Font:');
            dlg.imgPnl.cpyPnl.cpyOptionPnl.typeDd = dlg.imgPnl.cpyPnl.cpyOptionPnl.add('dropdownlist', [90, 130, 270, 150], '');
               var item
               for (var i=0; i<app.fonts.length; i++) {
                     item = dlg.imgPnl.cpyPnl.cpyOptionPnl.typeDd.add ('item', "" + app.fonts.name);     
                  }
               //dlg.imgPnl.cpyPnl.cpyOptionPnl.typeDd.onChange = function() {      
                     //varCpyFontDlg = app.fonts[parseInt(dlg.imgPnl.cpyPnl.cpyOptionPnl.typeDd.selection)].name;
                     //}

How do I get it to give the postscript fontname you mentioned X?
Mike Hale

New Text Layers Causing Errors: Requires 'Myriad Pro'???

Post by Mike Hale »

app.fonts.postScriptName

Mike
v.bampton

New Text Layers Causing Errors: Requires 'Myriad Pro'???

Post by v.bampton »

Doh! So easy! Thanks Mike!