1919from src .utils .adobe import LayerObjectTypes , ReferenceLayer
2020
2121from .helpers import LAYER_NAMES , get_numeric_setting
22+ from .utils .layer_fx import get_stroke_details
23+ from .utils .mask import create_mask_from
2224from .utils .path import create_shape_layer , get_shape_dimensions
2325from .uxp .shape import ShapeOperation , merge_shapes
2426from .uxp .text import create_text_layer_with_path
@@ -112,16 +114,33 @@ def load_expansion_symbol(self) -> None:
112114
113115 def create_shapes_for_vertical_creature (self ) -> None :
114116 if ref_textbox := getLayer (LAYERS .TALL , (self .textbox_group , LAYERS .SHAPE )):
117+ pinlines_stroke = (
118+ get_stroke_details (self .pinlines_group ) if self .pinlines_group else None
119+ )
120+ pinlines_stroke_size = pinlines_stroke ["size" ] if pinlines_stroke else 0
115121 ref_textbox_dims = get_shape_dimensions (ref_textbox )
116- textbox_top = ref_textbox_dims ["bottom" ] - self .textbox_height
122+ textbox_bottom = ref_textbox_dims ["bottom" ] - pinlines_stroke_size
123+ textbox_top = textbox_bottom - self .textbox_height
117124
118125 # Build bottom textbox
119126 self .bottom_textbox_shape = create_shape_layer (
120127 (
121- {"x" : ref_textbox_dims ["left" ], "y" : textbox_top },
122- {"x" : ref_textbox_dims ["right" ], "y" : textbox_top },
123- {"x" : ref_textbox_dims ["right" ], "y" : ref_textbox_dims ["bottom" ]},
124- {"x" : ref_textbox_dims ["left" ], "y" : ref_textbox_dims ["bottom" ]},
128+ {
129+ "x" : ref_textbox_dims ["left" ] + pinlines_stroke_size ,
130+ "y" : textbox_top ,
131+ },
132+ {
133+ "x" : ref_textbox_dims ["right" ] - pinlines_stroke_size ,
134+ "y" : textbox_top ,
135+ },
136+ {
137+ "x" : ref_textbox_dims ["right" ] - pinlines_stroke_size ,
138+ "y" : textbox_bottom ,
139+ },
140+ {
141+ "x" : ref_textbox_dims ["left" ] + pinlines_stroke_size ,
142+ "y" : textbox_bottom ,
143+ },
125144 ),
126145 relative_layer = ref_textbox ,
127146 placement = ElementPlacement .PlaceAfter ,
@@ -153,6 +172,7 @@ def create_shapes_for_vertical_creature(self) -> None:
153172 pinlines_top = (
154173 ref_textbox_pinlines_dims ["bottom" ]
155174 - self .textbox_height
175+ - 2 * pinlines_stroke_size
156176 - (ref_textbox_pinlines_dims ["height" ] - ref_textbox_dims ["height" ])
157177 )
158178
@@ -559,13 +579,15 @@ def textbox_positioning(self) -> None:
559579 if (
560580 self .has_extra_textbox
561581 and (
562- ref_textbox_tall := getLayer (LAYERS .TALL , self .textbox_reference_group )
582+ ref_textbox_pinlines := getLayer (
583+ LAYERS .TALL , (self .pinlines_group , LAYERS .SHAPE , LAYERS .TEXTBOX )
584+ )
563585 )
564- and self .textbox_bottom_reference
586+ and self .bottom_textbox_pinlines_shape
565587 ):
566588 delta = (
567- get_shape_dimensions (self .textbox_bottom_reference )["top" ]
568- - get_shape_dimensions (ref_textbox_tall )["top" ]
589+ get_shape_dimensions (self .bottom_textbox_pinlines_shape )["top" ]
590+ - get_shape_dimensions (ref_textbox_pinlines )["top" ]
569591 )
570592
571593 # Shift typeline text
@@ -577,8 +599,20 @@ def textbox_positioning(self) -> None:
577599 self .typeline_pinline_shape .translate (0 , delta )
578600
579601 # Shift typeline box
580- if isinstance (self .twins_shape , list ):
581- self .twins_shape [1 ].translate (0 , delta )
602+ if isinstance (self .twins_shape , list ) and isinstance (
603+ (typeline_box := self .twins_shape [1 ]), ArtLayer
604+ ):
605+ typeline_box .translate (0 , delta )
606+
607+ # Create mask for pinlines
608+ if (
609+ isinstance ((name_box := self .twins_shape [0 ]), ArtLayer )
610+ and self .bottom_textbox_shape
611+ ):
612+ create_mask_from (
613+ self .pinlines_group ,
614+ (name_box , typeline_box , self .bottom_textbox_shape ),
615+ )
582616
583617 # Shift expansion symbol
584618 if CFG .symbol_enabled and self .expansion_symbol_layer :
0 commit comments