Skip to content

Commit dc81be5

Browse files
committed
Added support for underline and strikeout to freetype wrapper
1 parent 8e247a8 commit dc81be5

File tree

4 files changed

+213
-110
lines changed

4 files changed

+213
-110
lines changed

modules/ILL/ILL.moon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module_version = "1.4.9"
1+
module_version = "1.5.0"
22

33
haveDepCtrl, DependencyControl = pcall require, "l0.DependencyControl"
44

modules/ILL/ILL/Ass/Line.moon

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ class Line
7676
if value = .reset.data[name]
7777
.data[name] = value
7878

79+
font = Font .data
80+
7981
-- if it's a shape, this information are irrelevant
8082
unless .isShape
8183
-- gets the value of the width of a space
82-
.space_width = aegisub.text_extents .data, " "
84+
.space_width = font\getTextExtents(" ").width
8385
.space_width *= video_x_correct_factor
8486

8587
-- spaces that are on the left and right of the text
@@ -93,8 +95,6 @@ class Line
9395
.shape = .text_stripped
9496
.text_stripped = ""
9597

96-
font = Font .data
97-
9898
-- gets the metric values of the text
9999
if textIsBlank
100100
textExtents = font\getTextExtents " "
@@ -111,8 +111,6 @@ class Line
111111
.internal_leading = textMetrics.internal_leading
112112
.external_leading = textMetrics.external_leading
113113

114-
font\free! if IS_UNIX
115-
116114
-- text alignment
117115
{:an} = .data
118116

@@ -486,7 +484,6 @@ class Line
486484
lineBlock.data.scale_y = 100
487485
font = Font lineBlock.data
488486
textExtents = font\getTextExtents lineBlock.text_stripped
489-
font\free! if IS_UNIX
490487
lineBlock.width = textExtents.width
491488
lineBlock.height = textExtents.height
492489
-- converts the text to shape and then converts the shape to Path
@@ -718,11 +715,7 @@ class Line
718715
return x * w, y * w
719716

720717
-- 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
726719

727720
-- converts the text to Path
728721
toPath: (l) -> Path Line.toShape l

0 commit comments

Comments
 (0)