@@ -76,10 +76,12 @@ class Line
76
76
if value = . reset. data[ name]
77
77
. data[ name] = value
78
78
79
+ font = Font . data
80
+
79
81
-- if it's a shape, this information are irrelevant
80
82
unless . isShape
81
83
-- gets the value of the width of a space
82
- . space_width = aegisub . text_extents . data , " "
84
+ . space_width = font \ getTextExtents ( " " ) . width
83
85
. space_width *= video_x_correct_factor
84
86
85
87
-- spaces that are on the left and right of the text
@@ -93,8 +95,6 @@ class Line
93
95
. shape = . text_stripped
94
96
. text_stripped = " "
95
97
96
- font = Font . data
97
-
98
98
-- gets the metric values of the text
99
99
if textIsBlank
100
100
textExtents = font\ getTextExtents " "
@@ -111,8 +111,6 @@ class Line
111
111
. internal_leading = textMetrics. internal_leading
112
112
. external_leading = textMetrics. external_leading
113
113
114
- font\ free! if IS_UNIX
115
-
116
114
-- text alignment
117
115
{ : an} = . data
118
116
@@ -486,7 +484,6 @@ class Line
486
484
lineBlock. data. scale_y = 100
487
485
font = Font lineBlock. data
488
486
textExtents = font\ getTextExtents lineBlock. text_stripped
489
- font\ free! if IS_UNIX
490
487
lineBlock. width = textExtents. width
491
488
lineBlock. height = textExtents. height
492
489
-- converts the text to shape and then converts the shape to Path
@@ -718,11 +715,7 @@ class Line
718
715
return x * w, y * w
719
716
720
717
-- converts the text to shape
721
- toShape : ( l) ->
722
- font = Font l. data
723
- shape = font\ getTextToShape l. text_stripped
724
- font\ free! if IS_UNIX
725
- return shape
718
+ toShape : ( l) -> Font ( l. data) \ getTextToShape l. text_stripped
726
719
727
720
-- converts the text to Path
728
721
toPath : ( l) -> Path Line . toShape l
0 commit comments