FormatParser.Font (format_parser v2.6.0)

A Font struct and functions.

The Font struct contains the fields format and nature.

Summary

Functions

Parses a font file or result.

Types

t()

@type t() :: %FormatParser.Font{format: atom() | nil, nature: :font}

Functions

parse(file)

@spec parse({:error, binary()} | binary() | any()) :: any()

Parses a font file or result.

  • If given a tuple {:error, file} where file is a binary, attempts to parse the font from the file.
  • If given a binary file, attempts to parse the font from the file.
  • For any other input, returns the input as-is.

Examples

iex> parse({:error, "font.ttf"}) # Parses the font from "font.ttf"

iex> parse("font.ttf") # Parses the font from "font.ttf"

iex> parse(:ok) :ok