From 82ff5dc7333dea946faf0eac9b4b39b0a620dc2d Mon Sep 17 00:00:00 2001 From: Nicholas de Paola <3079166+ndepaola@users.noreply.github.com> Date: Sat, 28 May 2022 10:20:39 +1000 Subject: [PATCH] fix for "space before" being incorrect when rules text is multi-line --- scripts/text_layers.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/text_layers.jsx b/scripts/text_layers.jsx index b3609fe..745c8c6 100644 --- a/scripts/text_layers.jsx +++ b/scripts/text_layers.jsx @@ -313,12 +313,16 @@ var FormattedTextArea = Class({ var layer_text_contents = this.layer.duplicate(); app.activeDocument.activeLayer = layer_text_contents; - format_text(this.text_contents, italic_text, flavour_index, this.is_centred); + layer_text_contents.textItem.contents = this.text_contents; + layer_text_contents.textItem.spaceBefore = new UnitValue(2.4, "px"); + format_text(this.text_contents, italic_text, -1, this.is_centred); layer_text_contents.rasterize(RasterizeType.ENTIRELAYER); text_contents_bottom = layer_text_contents.bounds[3].as("px"); var layer_flavour_text = this.layer.duplicate(); app.activeDocument.activeLayer = layer_flavour_text; + layer_flavour_text.textItem.contents = this.flavour_text; + layer_flavour_text.textItem.spaceBefore = new UnitValue(2.4, "px"); format_text(this.flavour_text, italic_text, flavour_index, this.is_centred); layer_flavour_text.rasterize(RasterizeType.ENTIRELAYER); layer_flavour_text.translate(0, layer_bounds[3].as("px") - layer_flavour_text.bounds[3].as("px"));