FreeTypeAbstraction.match_fontMethod

Match a font using the user-specified search string. Each part of the search string is searched in the family name first which has to match once to include the font in the candidate list. For fonts with a family match the style name is matched next. For fonts with the same family and style name scores, regular fonts are preferred (any font that is "regular", "normal", "medium", "standard" or "roman") and as a last tie-breaker, shorter overall font names are preferred.

Example:

If we had only four fonts:

  • Helvetica Italic
  • Helvetica Regular
  • Helvetica Neue Regular
  • Helvetica Neue Light

Then this is how this function would match different search strings:

  • "helvetica" => Helvetica Regular
  • "helv" => Helvetica Regular
  • "HeLvEtIcA" => Helvetica Regular
  • "helvetica italic" => Helvetica Italic
  • "helve ita" => Helvetica Italic
  • "helvetica neue" => Helvetica Neue Regular
  • "tica eue" => Helvetica Neue Regular
  • "helvetica light" => Helvetica Neue Light
  • "light" => Helvetica Neue Light
  • "helvetica bold" => Helvetica Regular
  • "helvetica neue bold" => Helvetica Neue Regular
  • "times" => no match
  • "arial" => no match
FreeTypeAbstraction.renderstring!Method
renderstring!(img::AbstractMatrix, str::String, face, pixelsize, y0, x0;
fcolor=one_or_typemax(T), bcolor=zero(T), halign=:hleft, valign=:vbaseline) -> Matrix

Render str into img using the font face of size pixelsize at coordinates y0,x0. Uses the conventions of freetype.org/freetype2/docs/glyphs/glyphs-3.html

Arguments

  • y0,x0: origin is in upper left with positive y going down
  • fcolor: foreground color; AbstractVector{T}, typemax(T) for T<:Integer, otherwise one(T)
  • gcolor: background color; AbstractVector{T}, typemax(T) for T<:Integer, otherwise one(T)
  • bcolor: canvas background color; set to nothing for transparent
  • halign: :hleft, :hcenter, or :hright
  • valign: :vtop, :vcenter, :vbaseline, or :vbttom
  • bbox_glyph: glyph bounding box color (debugging)
  • bbox: bounding box color (debugging)
  • gstr: background string or array of chars (for background sizing)
  • incx: extra x spacing