11# adapted from github.com/JuliaGraphics/FreeTypeAbstraction.jl/blob/master/src/rendering.jl
2- # credits to the `FreeTypeAbstraction` authors
2+ # credits to the `FreeTypeAbstraction` authors (@SimonDanisch, @jkrumbiegel).
33
44module FreeTypeExt
55
2424
2525mutable struct FTFont
2626 ft_ptr:: FT_Face
27- lock:: ReentrantLock # lock this for the duration of any FT operation on ft_ptr
27+ lock:: ReentrantLock # lock this for the duration of any FT operation on ft_ptr
2828 function FTFont (ft_ptr:: FT_Face )
2929 face = new (ft_ptr, ReentrantLock ())
3030 finalizer (safe_free, face)
@@ -45,7 +45,7 @@ family_name(font::FTFont) = lowercase(ft_property(font, :family_name))
4545style_name (font:: FTFont ) = lowercase (ft_property (font, :style_name ))
4646Base. propertynames (font:: FTFont ) = fieldnames (FT_FaceRec)
4747
48- # C interop
48+ # c interoperability
4949Base. cconvert (:: Type{FT_Face} , font:: FTFont ) = font
5050Base. unsafe_convert (:: Type{FT_Face} , font:: FTFont ) = font. ft_ptr
5151
@@ -79,7 +79,7 @@ add_mono(fts...) = tuple(map(x -> x * "Mono", fts)..., fts...)
7979fallback_fonts () =
8080# those fallback fonts are likely to fail braille characters
8181 if Sys. islinux ()
82- add_mono (" DejaVu Sans " , " Ubuntu " , " Noto " , " Free" , " Liberation " )
82+ add_mono (" DejaVu Sans " , " Ubuntu " , " Noto " , " Free" , " Liberation " ) # NOTE: trailing space intended
8383 elseif Sys. isbsd ()
8484 (" Courier New" , " Helvetica" )
8585 elseif Sys. iswindows ()
@@ -274,16 +274,16 @@ one_or_typemax(::Type{T}) where {T<:Union{Real,Colorant}} =
274274Render `str` into `img` using the font `face` of size `pixelsize` at coordinates `y0,x0`.
275275Uses the conventions of freetype.org/freetype2/docs/glyphs/glyphs-3.html
276276# Arguments
277- * `y0,x0`: origin is in upper left with positive `y` going down
278- * `fcolor`: foreground color; AbstractVector{T}, typemax(T) for T<:Integer, otherwise one(T)
279- * `gcolor`: background color; AbstractVector{T}, typemax(T) for T<:Integer, otherwise one(T)
280- * `bcolor`: canvas background color; set to `nothing` for transparent
281- * `halign`: :hleft, :hcenter, or :hright
282- * `valign`: :vtop, :vcenter, :vbaseline, or :vbttom
283- * `bbox_glyph`: glyph bounding box color (debugging)
284- * `bbox`: bounding box color (debugging)
285- * `gstr`: background string or array of chars (for background sizing)
286- * `incx`: extra x spacing
277+ - `y0,x0`: origin is in upper left with positive `y` going down.
278+ - `fcolor`: foreground color; AbstractVector{T}, typemax(T) for T<:Integer, otherwise one(T).
279+ - `gcolor`: background color; AbstractVector{T}, typemax(T) for T<:Integer, otherwise one(T).
280+ - `bcolor`: canvas background color; set to `nothing` for transparent.
281+ - `halign`: :hleft, :hcenter, or :hright.
282+ - `valign`: :vtop, :vcenter, :vbaseline, or :vbttom.
283+ - `bbox_glyph`: glyph bounding box color (debugging).
284+ - `bbox`: bounding box color (debugging).
285+ - `gstr`: background string or array of chars (for background sizing).
286+ - `incx`: extra x spacing.
287287"""
288288function UnicodePlots. render_string! (
289289 img:: AbstractMatrix{T} ,
@@ -455,7 +455,7 @@ add_recursive(result, path) =
455455function __init__ ()
456456 ft_init ()
457457 atexit (ft_done)
458- # This method of finding fonts might not work for exotic platforms,
458+ # this method of finding fonts might not work for exotic platforms,
459459 # so we supply a way to help it with an environment variable.
460460 font_paths = if Sys. isapple () # COV_EXCL_LINE
461461 [
0 commit comments