Skip to content

Commit ab35f9e

Browse files
committed
adhere to COLUMNS=80
1 parent 76c72d1 commit ab35f9e

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

src/findfonts.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ else
2727
end
2828
function _font_paths()
2929
result = String[]
30-
for p in ("/usr/share/fonts", joinpath(homedir(), ".fonts"), joinpath(homedir(), ".local/share/fonts"), "/usr/local/share/fonts",)
30+
for p in (
31+
"/usr/share/fonts",
32+
joinpath(homedir(), ".fonts"),
33+
joinpath(homedir(), ".local/share/fonts"),
34+
"/usr/local/share/fonts"
35+
)
3136
if isdir(p)
3237
push!(result, p)
3338
add_recursive(result, p)

src/rendering.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ function glyphbitmap(bitmap::FreeType.FT_Bitmap)
3636
return bmp
3737
end
3838

39-
one_or_typemax(::Type{T}) where {T<:Union{Real,Colorant}} = T<:Integer ? typemax(T) : oneunit(T)
39+
function one_or_typemax(::Type{T}) where {T<:Union{Real,Colorant}}
40+
return T<:Integer ? typemax(T) : oneunit(T)
41+
end
4042

4143
"""
4244
renderstring!(img::AbstractMatrix, str::String, face, pixelsize, y0, x0;

src/types.jl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
check_error(err, error_msg) = err == 0 || error(error_msg * " with error: $(err)")
1+
check_error(err, error_msg) = err == 0 || error("$error_msg with error: $err")
22

33
const FREE_FONT_LIBRARY = FT_Library[C_NULL]
44

55
function ft_init()
6-
FREE_FONT_LIBRARY[1] != C_NULL && error("Freetype already initalized. init() called two times?")
7-
err = FT_Init_FreeType(FREE_FONT_LIBRARY)
8-
return err == 0
6+
if FREE_FONT_LIBRARY[1] != C_NULL
7+
error("Freetype already initalized. init() called two times?")
8+
end
9+
return FT_Init_FreeType(FREE_FONT_LIBRARY) == 0
910
end
1011

1112
function ft_done()
12-
FREE_FONT_LIBRARY[1] == C_NULL && error("Library == CNULL. FreeTypeAbstraction.done() called before init(), or done called two times?")
13+
if FREE_FONT_LIBRARY[1] == C_NULL
14+
error("Library == CNULL. FreeTypeAbstraction.done() called before init(), or done called two times?")
15+
end
1316
err = FT_Done_FreeType(FREE_FONT_LIBRARY[1])
1417
FREE_FONT_LIBRARY[1] = C_NULL
1518
return err == 0
@@ -114,7 +117,9 @@ function safe_free(face)
114117
end
115118
end
116119

117-
boundingbox(extent::FontExtent{T}) where T = Rect2(bearing(extent), Vec2{T}(extent.scale))
120+
function boundingbox(extent::FontExtent{T}) where T
121+
return Rect2(bearing(extent), Vec2{T}(extent.scale))
122+
end
118123

119124
mutable struct FTFont
120125
ft_ptr::FreeType.FT_Face
@@ -136,7 +141,9 @@ FTFont(path::String) = FTFont(newface(path))
136141
# C interop
137142
Base.cconvert(::Type{FreeType.FT_Face}, font::FTFont) = font
138143

139-
Base.unsafe_convert(::Type{FreeType.FT_Face}, font::FTFont) = getfield(font, :ft_ptr)
144+
function Base.unsafe_convert(::Type{FreeType.FT_Face}, font::FTFont)
145+
return getfield(font, :ft_ptr)
146+
end
140147

141148
Base.propertynames(font::FTFont) = fieldnames(FreeType.FT_FaceRec)
142149

0 commit comments

Comments
 (0)