From f668735c3c05d477b312eb0975c63a16c19b1597 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..35f518f 100644 --- a/scripts/text_layers.jsx +++ b/scripts/text_layers.jsx @@ -312,12 +312,16 @@ var FormattedTextArea = Class({ var layer_bounds = compute_text_layer_bounds(this.layer); var layer_text_contents = this.layer.duplicate(); + layer_text_contents.textItem.contents = this.text_contents; + layer_text_contents.textItem.spaceBefore = new UnitValue(line_break_lead, "px"); app.activeDocument.activeLayer = layer_text_contents; - format_text(this.text_contents, italic_text, flavour_index, this.is_centred); + 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(); + layer_flavour_text.textItem.contents = this.flavour_text; + layer_flavour_text.textItem.spaceBefore = new UnitValue(line_break_lead, "px"); app.activeDocument.activeLayer = layer_flavour_text; format_text(this.flavour_text, italic_text, flavour_index, this.is_centred); layer_flavour_text.rasterize(RasterizeType.ENTIRELAYER);