diff --git a/README.md b/README.md index 9aee1fd..f367cc7 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ Parameters: - `font_size_mode`: `fixed` uses the exact font size, `fit` scales text to the canvas - `font_size`: base font size or max fitting size - `char_spacing`: character spacing in pixels - - `line_spacing`: line spacing in pixels; `0` keeps the automatic spacing rule + - `line_spacing`: line spacing in pixels; `0` keeps the automatic spacing rule, positive values increase spacing, negative values pull lines closer together - `bold`: prefer bold font variants, otherwise use a fallback bold draw mode - `italic`: prefer italic font variants, otherwise use a fallback italic transform - `background_color`: preview background color @@ -400,7 +400,7 @@ Baidu Meux ComfyTools 是一组用于 ComfyUI 的自定义节点,服务于百 - `font_size_mode`:`fixed` 使用固定字号,`fit` 自动适配画布 - `font_size`:基础字号,或自动适配时的最大字号 - `char_spacing`:字符间距,单位为像素 - - `line_spacing`:行间距,单位为像素;`0` 表示继续使用自动行间距规则 + - `line_spacing`:行间距,单位为像素;`0` 表示继续使用自动行间距规则,正数拉开行距,负数压缩行距 - `bold`:优先匹配粗体字体,没有时走伪粗体回退 - `italic`:优先匹配斜体字体,没有时走伪斜体回退 - `background_color`:预览背景颜色 diff --git a/nodes/artistic_text_preview.py b/nodes/artistic_text_preview.py index e082e17..0f14588 100644 --- a/nodes/artistic_text_preview.py +++ b/nodes/artistic_text_preview.py @@ -40,7 +40,7 @@ class MeuxArtisticTextPreview: "font_size_mode": (["fixed", "fit"], {"default": "fixed"}), "font_size": ("INT", {"default": 128, "min": 8, "max": 1024, "step": 1}), "char_spacing": ("INT", {"default": 0, "min": -20, "max": 200, "step": 1}), - "line_spacing": ("INT", {"default": 0, "min": 0, "max": 512, "step": 1}), + "line_spacing": ("INT", {"default": 0, "min": -512, "max": 512, "step": 1}), "bold": ("BOOLEAN", {"default": False}), "italic": ("BOOLEAN", {"default": False}), "background_color": ("STRING", {"default": "#000000"}), @@ -295,7 +295,7 @@ class MeuxArtisticTextPreview: return width, height def _resolve_line_spacing(self, font, line_spacing): - if int(line_spacing) > 0: + if int(line_spacing) != 0: return int(line_spacing) return max(6, font.size // 5 if hasattr(font, "size") else 6)