Skip to content

Commit d9bd35c

Browse files
committed
face.glyph should be used as a pointer instead of a value
1 parent 7eca811 commit d9bd35c

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

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)