Skip to content

Commit 923f1b4

Browse files
authored
Merge pull request #57 from JuliaGraphics/up-freetype
`face.glyph` should be used as a pointer instead of a value
2 parents 5bf8cfe + 4929688 commit 923f1b4

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "FreeTypeAbstraction"
22
uuid = "663a7486-cb36-511b-a19d-713bb74d65c9"
3-
version = "0.8.4"
3+
version = "0.9.0"
44

55
[deps]
66
ColorVectorSpace = "c3611d14-8923-5661-9e6a-0046d554d3a4"
@@ -12,7 +12,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1212
[compat]
1313
ColorVectorSpace = "0.8"
1414
Colors = "0.11, 0.12"
15-
FreeType = "3"
15+
FreeType = "4"
1616
GeometryBasics = "0.2, 0.3"
1717
StaticArrays = "0.12, 1.0"
1818
julia = "1"

src/rendering.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ end
77
function renderface(face::FTFont, c::Char, pixelsize::Integer)
88
set_pixelsize(face, pixelsize)
99
loadchar(face, c)
10-
glyph = face.glyph
10+
glyph = unsafe_load(face.glyph)
1111
@assert glyph.format == FreeType.FT_GLYPH_FORMAT_BITMAP
1212
return glyphbitmap(glyph.bitmap), FontExtent(glyph.metrics)
1313
end

src/types.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ function Base.getproperty(font::FTFont, fieldname::Symbol)
156156
if field isa Ptr{FT_String}
157157
field == C_NULL && return ""
158158
return unsafe_string(field)
159-
# Some fields segfault with unsafe_load...Lets find out which another day :D
160-
elseif field isa Ptr{FreeType.LibFreeType.FT_GlyphSlotRec}
161-
return unsafe_load(field)
162159
else
163160
return field
164161
end
@@ -208,7 +205,7 @@ function internal_get_extent(face::FTFont, char::Char)
208205
check_error(err, "Could not load char to get extent.")
209206
# This gives us the font metrics in normalized units (0, 1), with negative
210207
# numbers interpreted as an offset
211-
return FontExtent(face.glyph.metrics, Float32(face.units_per_EM))
208+
return FontExtent(unsafe_load(face.glyph).metrics, Float32(face.units_per_EM))
212209
end
213210

214211
descender(font) = font.descender / font.units_per_EM

0 commit comments

Comments
 (0)