Skia.Typeface (Skia v0.3.4)

Copy Markdown View Source

Typeface resource independent of font size.

{:ok, families} = Skia.Typeface.families()
{:ok, typeface} = Skia.Typeface.match_family("Inter", weight: 700)
font = Skia.Font.new(typeface, size: 18)

Summary

Types

t()

@type t() :: %Skia.Typeface{
  family: String.t() | nil,
  ref: reference(),
  slant: atom() | nil,
  weight: integer() | nil
}

Functions

families()

@spec families() :: {:ok, [String.t()]} | {:error, atom()}

info(typeface)

@spec info(t()) :: {:ok, map()} | {:error, atom()}

load(binary)

@spec load(binary()) :: {:ok, t()} | {:error, atom()}

load_path(path)

@spec load_path(Path.t()) :: {:ok, t()} | {:error, atom() | File.posix()}

match_character(character, opts \\ [])

@spec match_character(
  String.t() | non_neg_integer(),
  keyword()
) :: {:ok, t()} | {:error, atom()}

Matches an installed typeface capable of rendering one Unicode character.

The optional :family, :weight, :slant, and :languages values map directly to Skia's font-manager matching inputs. An empty family allows Skia to select any installed family.

match_family(family, opts \\ [])

@spec match_family(
  String.t(),
  keyword()
) :: {:ok, t()} | {:error, atom()}