From cb38118cd1a4db205198fd8cde395cc5c39e2ec7 Mon Sep 17 00:00:00 2001 From: MrTeferi Date: Thu, 16 Nov 2023 00:20:46 -0600 Subject: [PATCH] fix(TextItem.font): Change font to a read/write string property TextItem.font cannot be returned as a TextFont object (see Photoshop CC Javascript reference) Signed-off-by: MrTeferi --- photoshop/api/text_item.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/photoshop/api/text_item.py b/photoshop/api/text_item.py index 864524c3..c2e5b92c 100644 --- a/photoshop/api/text_item.py +++ b/photoshop/api/text_item.py @@ -209,26 +209,31 @@ def firstLineIndent(self, value): self.app.firstLineIndent = value @property - def font(self): - """.text_font.TextFont: Current font.""" - return TextFont(self.app.font) + def font(self) -> str: + """str: postScriptName of the TextItem's font.""" + return self.app.font @font.setter - def font(self, text_font): + def font(self, text_font: str): + """Set the font of this TextItem. + + Args: + text_font (str): Must provide the postScriptName of a valid font. + """ self.app.font = text_font @property - def hangingPunctuation(self): - """True to use Roman hanging punctuation.""" + def hangingPunctuation(self) -> bool: + """bool: Whether to use Roman hanging punctuation.""" return self.app.hangingPunctuation @hangingPunctuation.setter - def hangingPunctuation(self, value): + def hangingPunctuation(self, value: bool): self.app.hangingPunctuation = value @property def height(self): - """int:The height of the bounding box for paragraph text.""" + """int: The height of the bounding box for paragraph text.""" return self.app.height @height.setter @@ -236,16 +241,17 @@ def height(self, value): self.app.height = value @property - def horizontalScale(self): - """Character scaling (horizontal) in proportion to verticalScale - - (a percentage value). - - """ + def horizontalScale(self) -> int: + """Character scaling (horizontal) in proportion to verticalScale (a percentage value).""" return self.app.horizontalScale @horizontalScale.setter - def horizontalScale(self, value): + def horizontalScale(self, value: int): + """Set the horizontalScale of this TextItem. + + Args: + value: An integer between 0 and 1000. + """ self.app.horizontalScale = value @property