Bonjour à tous,
J'ai un script qui ouvre une boite de dialogue pour que je puiise entrer le texte que je souhaite afficher à un endroit spécifique de mon plan de travail. Tout fonctionne sauf que je n'arive pas à changer le style de police de mon texte.. J'aimerais que le texte soit en police "Myriad pro" et en style de police "Bold" et que la taille de la police soit de 14 pt.
Voici le script que j'utilise
var text = prompt("Entrez le texte à écrire:", "");
if (text) {
var doc = app.activeDocument;
var layer = doc.layers.getByName("FOND DE PLAN");
layer.locked = false;
var textFrame = layer.textFrames.add();
textFrame.contents = text;
textFrame.textRange.characterAttributes.font = "Myriad Pro Bold";
textFrame.textRange.characterAttributes.fontWeight = "Bold";
var nonPrintableLayer = doc.layers.getByName("NON IMPRIMABLE");
var pointOfGathering = nonPrintableLayer.pathItems.getByName("POINT DE RASSEMBLEMENT");
var textBounds = textFrame.geometricBounds;
var pointBounds = pointOfGathering.geometricBounds;
var x = pointBounds[0] + (pointBounds[2] - pointBounds[0] - textBounds[2] + textBounds[0]) / 2;
var y = pointBounds[1] + (pointBounds[3] - pointBounds[1] - textBounds[3] + textBounds[1]) / 2;
textFrame.left = x;
textFrame.top = y;
layer.locked = true;
}