Ruler and Type Units
Ruler and Type Units
I have set the ruler and type units in a script to pixels. However, when I create a new text layer and set the text item size to 16, the text height in the image ends up being 11 pixels instead of 16 pixels. Could someone explain me why?
Ruler and Type Units
What version of Photoshop are you using? In CS3 or older you need to set the text size in points. Those versions accept numbers as points for the textItem.size property.
With newer version the guide says they accept UnitValues. But it appears that is not correct or is buggy.
In CS4 size returns an unitValue object set to points no matter what the ruler unit. But is seems to ignore the unit part of the unitvalue and use the value part as points.
In CS5 size returns an unitvalue set to px no matter what the ruler unit. Setting the size seems to work correctly with any unit except pixels. When pixels is used as the unitValue unit Photoshop only sets the correct size if the doc is 72ppi.
With newer version the guide says they accept UnitValues. But it appears that is not correct or is buggy.
In CS4 size returns an unitValue object set to points no matter what the ruler unit. But is seems to ignore the unit part of the unitvalue and use the value part as points.
In CS5 size returns an unitvalue set to px no matter what the ruler unit. Setting the size seems to work correctly with any unit except pixels. When pixels is used as the unitValue unit Photoshop only sets the correct size if the doc is 72ppi.
Ruler and Type Units
I am using Photoshop CS5, and my current preferences are:
Code: Select allpreferences.pointSize = PointType.POSTSCRIPT
preferences.rulerUnits = Units.PIXELS
preferences.typeUnits = TypeUnits.PIXELS
I have used 16 and UnitValue(16, "px") for myLayer.textItem.size, and both resulted in a 11px text. Also, the document was created with resolution set to 72.
Code: Select allpreferences.pointSize = PointType.POSTSCRIPT
preferences.rulerUnits = Units.PIXELS
preferences.typeUnits = TypeUnits.PIXELS
I have used 16 and UnitValue(16, "px") for myLayer.textItem.size, and both resulted in a 11px text. Also, the document was created with resolution set to 72.
Ruler and Type Units
There is another strange behavior. When creating a new color definition and setting its rgb values, it seems that the values for red, green and blue for the resulting color are set to the specified values minus one.
Ruler and Type Units
When you say the text is 11px, how are you determining the size of the text?
I have never seen that solid color behavior. Colors for me are always the same as the values I used to define the color.
I have never seen that solid color behavior. Colors for me are always the same as the values I used to define the color.
Ruler and Type Units
I am counting the number of pixels of the height of the uppercase characters in the text. Is it correct?
Ruler and Type Units
No, Most fonts have Upper and lower case chars and some of the lower case have descenders like q,p, etc. Most fonts also have a little space above the Capitals and a little below the descenders. So few, if any, chars in a font will be the full height of the font.
If you want the chars to be a certain size in pixels you will need to set the font size to a value larger that the needed char size. How much larger depends on the font face, font style, and chars used.
If you want the chars to be a certain size in pixels you will need to set the font size to a value larger that the needed char size. How much larger depends on the font face, font style, and chars used.
Ruler and Type Units
So this is it. Thank you very much for the explanation. For reference, I am using Basic Commercial Bold from Linotype:
http://www.linotype.com/14056/basiccomm ... -font.html.
For the color behavior, to what RGB values Photoshop converts PANTONE 426 C for you?
http://www.linotype.com/14056/basiccomm ... -font.html.
For the color behavior, to what RGB values Photoshop converts PANTONE 426 C for you?
Ruler and Type Units
rcvalle wrote:For the color behavior, to what RGB values Photoshop converts PANTONE 426 C for you?
The SolidColor object does not support PANTONE. It only supports cmyk, gray, hsb, lab, and rgb. So you can not set a PANTONE color with a script. You can try to convert the PANTONE color to one the color modes scripting supports.
I seem to remember that Photoshop and Illustrator don't handle some PANTONE colors the same. That is to say if you set a PANTONE color in the Photoshop UI it will look different than the same color set up in the Illustrator UI. I think there is a workaround but don't remember it.
You may want to ask your question in the general Photoshop forum as it is not really a scripting issue.
The SolidColor object does not support PANTONE. It only supports cmyk, gray, hsb, lab, and rgb. So you can not set a PANTONE color with a script. You can try to convert the PANTONE color to one the color modes scripting supports.
I seem to remember that Photoshop and Illustrator don't handle some PANTONE colors the same. That is to say if you set a PANTONE color in the Photoshop UI it will look different than the same color set up in the Illustrator UI. I think there is a workaround but don't remember it.
You may want to ask your question in the general Photoshop forum as it is not really a scripting issue.
Ruler and Type Units
Actually what I did was pick up the corresponding RGB values to PANTONE 426 C in Photoshop and use them in the script. However, when I fill a selection, it fills with the RGB values minus one. I will ask in Photoshop forum. Thank you for all the help!