Skip to content

Commit

Permalink
Added support for underline and strikeout to freetype wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
klsruan committed Sep 27, 2024
1 parent 8e247a8 commit dc81be5
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 110 deletions.
2 changes: 1 addition & 1 deletion modules/ILL/ILL.moon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module_version = "1.4.9"
module_version = "1.5.0"

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

Expand Down
15 changes: 4 additions & 11 deletions modules/ILL/ILL/Ass/Line.moon
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ class Line
if value = .reset.data[name]
.data[name] = value

font = Font .data

-- if it's a shape, this information are irrelevant
unless .isShape
-- gets the value of the width of a space
.space_width = aegisub.text_extents .data, " "
.space_width = font\getTextExtents(" ").width
.space_width *= video_x_correct_factor

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

font = Font .data

-- gets the metric values of the text
if textIsBlank
textExtents = font\getTextExtents " "
Expand All @@ -111,8 +111,6 @@ class Line
.internal_leading = textMetrics.internal_leading
.external_leading = textMetrics.external_leading

font\free! if IS_UNIX

-- text alignment
{:an} = .data

Expand Down Expand Up @@ -486,7 +484,6 @@ class Line
lineBlock.data.scale_y = 100
font = Font lineBlock.data
textExtents = font\getTextExtents lineBlock.text_stripped
font\free! if IS_UNIX
lineBlock.width = textExtents.width
lineBlock.height = textExtents.height
-- converts the text to shape and then converts the shape to Path
Expand Down Expand Up @@ -718,11 +715,7 @@ class Line
return x * w, y * w

-- converts the text to shape
toShape: (l) ->
font = Font l.data
shape = font\getTextToShape l.text_stripped
font\free! if IS_UNIX
return shape
toShape: (l) -> Font(l.data)\getTextToShape l.text_stripped

-- converts the text to Path
toPath: (l) -> Path Line.toShape l
Expand Down
Loading

0 comments on commit dc81be5

Please sign in to comment.