I have created a script for photoshop that is designed to change the font family to a different type. However, I am experiencing some inconsistencies in its performance.
Here is the section of the script responsible for altering the font family:
var origDoc = activeDocument;
var fullName = origDoc.name;
var myLayerRef = origDoc.artLayers.add();
myLayerRef.kind = LayerKind.TEXT;
myLayerRef.name = fullName ;
var myTextRef = myLayerRef.textItem;
myTextRef.position = new Array( 100, 100);
myTextRef.size = 35;
myTextRef.font = 'Calibri'; //Font family name
myTextRef.contents = myLayerRef.name;
While the script successfully changes fonts to Calibri and Verdana, it fails to do so for 'Arial' and 'Comic Sans MS', reverting back to the default font family which is Myriad pro.
Interestingly, setting the font family to 'Arial-BoldMT' works without any issues.
My objective is to make the script work with a barcode-like font, but even though the font is installed on my system, specifying its family name doesn't produce the desired result.
I am curious about the criteria based on which the script recognizes or fails to recognize certain fonts.