From 6af94c24b4f3fd1c46690261553354d665cac31c Mon Sep 17 00:00:00 2001 From: AskaEth Date: Thu, 27 Aug 2026 16:36:55 +0800 Subject: [PATCH] Revert empty TypeLayer channels (corrupt layers); center paragraph justify Empty channels made PS report corrupted layers. Restore raster channels (keeps layers valid). Template paragraph is justify (spreads short text across the box, causing huge letter spacing after conversion) - set Justification to center. --- ppl2psd.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ppl2psd.py b/ppl2psd.py index 3b5a58a..e1a14cb 100644 --- a/ppl2psd.py +++ b/ppl2psd.py @@ -525,6 +525,13 @@ def build_type_layer_tysh(ly: dict, font_ps: str) -> bytes: text_len = len(text) eng["StyleRun"]["RunLengthArray"] = List([Integer(text_len)]) eng["ParagraphRun"]["RunLengthArray"] = List([Integer(text_len)]) + # Template paragraph is justify (Justification=5), which spreads short + # text across the whole box. The ppl text is centered -> center align. + try: + props = eng["ParagraphRun"]["RunArray"][0]["ParagraphSheet"]["Properties"] + props["Justification"] = Integer(1) # center + except Exception: + pass prof = font_profile(_font_path_for(ly)) size_px = float(ly.get("textSize", "12") or 12) * prof["k"]