mirror of
https://github.com/sbrow/ps.git
synced 2025-12-29 18:47:38 -05:00
Layers can now convert text from pixels to points
This commit is contained in:
@@ -110,7 +110,11 @@ function layers(lyrs) {
|
|||||||
lyr.bounds[3] + ']], "Visible": ' + lyr.visible+', "TextItem": ').replace(/ px/g, "");
|
lyr.bounds[3] + ']], "Visible": ' + lyr.visible+', "TextItem": ').replace(/ px/g, "");
|
||||||
if (lyr.kind == LayerKind.TEXT) {
|
if (lyr.kind == LayerKind.TEXT) {
|
||||||
str += ('{"Contents": "'+lyr.textItem.contents+'",').replace(/\r/g, '\\r');
|
str += ('{"Contents": "'+lyr.textItem.contents+'",').replace(/\r/g, '\\r');
|
||||||
str += (' "Size": '+lyr.textItem.size+',').replace(/ pt/g, '');
|
var size = Number(lyr.textItem.size.replace(/ p[tx]/g, ''));
|
||||||
|
if (lyr.textItem.size.includes("px")) {
|
||||||
|
size = (size / app.activeDocument.resolution) * 72;
|
||||||
|
}
|
||||||
|
str += ' "Size": '+size+',';
|
||||||
str += ' "Font": "'+lyr.textItem.font+'"}\n'
|
str += ' "Font": "'+lyr.textItem.font+'"}\n'
|
||||||
} else
|
} else
|
||||||
str += "null";
|
str += "null";
|
||||||
|
|||||||
Reference in New Issue
Block a user