Making a text layer with specific size
I try to make a text layer with both a font and layer size.
I made this test script...
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var layers = app.activeDocument.artLayers;
var layer = layers.add();
layer.kind = LayerKind.TEXT;
var textItem = layer.textItem;
textItem.kind = TextType.PARAGRAPHTEXT;
textItem.size = new UnitValue(100, 'px');
textItem.position = [0, 0];
textItem.contents = "test";
textItem.width = new UnitValue(100, 'px');
textItem.height = new UnitValue(100, 'px');
app.preferences.rulerUnits=startRulerUnits;
But I noticed the sizes are not correct. It seems that even setting the unit to "px", the size is only correct on 72 dpi. When the document is set at 300 dpi, the layer size of 100 px becomes 416 px when running this script. I also tried setting the rulerUnits but that does not seem to solve the issue.
I also tried changing "px" to "pt" and that doesn't change anything, same result in size. Maybe this is a bug when PS always uses this unit as "pt", even when it's set to "px"?
