Skip to content

Commit 892f6d6

Browse files
committed
Replace pangocairo with freetype
1 parent d4a8f0b commit 892f6d6

File tree

5 files changed

+700
-242
lines changed

5 files changed

+700
-242
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.6"
1+
module_version = "1.4.7"
22

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

modules/ILL/ILL/Ass/Line.moon

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ class Line
115115
.internal_leading = textMetrics.internal_leading
116116
.external_leading = textMetrics.external_leading
117117

118+
font\free! if IS_UNIX
119+
118120
-- text alignment
119121
{:an} = .data
120122

@@ -486,7 +488,9 @@ class Line
486488
-- sets new values
487489
lineBlock.data.scale_x = 100
488490
lineBlock.data.scale_y = 100
489-
textExtents = Font(lineBlock.data)\getTextExtents lineBlock.text_stripped
491+
font = Font lineBlock.data
492+
textExtents = font\getTextExtents lineBlock.text_stripped
493+
font\free! if IS_UNIX
490494
lineBlock.width = textExtents.width
491495
lineBlock.height = textExtents.height
492496
-- converts the text to shape and then converts the shape to Path
@@ -718,7 +722,11 @@ class Line
718722
return x * w, y * w
719723

720724
-- converts the text to shape
721-
toShape: (l) -> Font(l.data)\getTextToShape l.text_stripped
725+
toShape: (l) ->
726+
font = Font l.data
727+
shape = font\getTextToShape l.text_stripped
728+
font\free! if IS_UNIX
729+
return shape
722730

723731
-- converts the text to Path
724732
toPath: (l) -> Path Line.toShape l

modules/ILL/ILL/Font/Font.moon

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
-- Font scale values for increased size & later downscaling to produce floating point coordinates
2222
export FONT_UPSCALE = 64
2323
export FONT_DOWNSCALE = 1 / FONT_UPSCALE
24+
export IS_UNIX = jit.os != "Windows"
2425

25-
if jit.os == "Windows"
26+
unless IS_UNIX
2627
-- if the operating system is windows
2728
import WindowsGDI from require "ILL.ILL.Font.Win"
2829
return {Font: WindowsGDI}
2930

3031
-- if the operating system is unix
31-
import PangoCairo from require "ILL.ILL.Font.Unx"
32-
return {Font: PangoCairo}
32+
import FreeType from require "ILL.ILL.Font.Unx"
33+
return {Font: FreeType}

0 commit comments

Comments
 (0)