View Source Exray.Text.Loading (Exray v0.6.0)

Handles the loading and unloading of fonts and glyphs. !! Load fonts AFTER Exray.Core.Window.init_window/3

Summary

Functions

Export font as code file, returns true on success

Check if a font is ready

Get the default Font

Load font from file into GPU memory (VRAM)

Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set

Load font from Image (XNA style)

Load font from memory buffer, fileType refers to extension: i.e. '.ttf'

Unload font from GPU memory (VRAM)

Unload font chars info data (RAM)

Functions

Link to this function

export_font_as_code(font, file_name)

View Source
@spec export_font_as_code(font :: Exray.Structs.Font.t(), file_name :: binary()) ::
  success :: boolean()

Export font as code file, returns true on success

@spec font_is_ready?(font :: Exray.Structs.Font.t()) :: font_is_ready :: boolean()

Check if a font is ready

Link to this function

gen_image_font_atlas(glyphs, glyph_recs, font_size, padding, pack_method)

View Source
@spec gen_image_font_atlas(
  glyphs :: [Exray.Structs.GlyphInfo.t()],
  glyph_recs :: [Exray.Structs.Rectangle.t()],
  font_size :: integer(),
  padding :: integer(),
  pack_method :: integer()
) :: image_font_atlas :: Exray.Structs.Image.t()

Generate image font atlas using chars info

@spec get_font_default() :: font :: Exray.Structs.Font.t()

Get the default Font

@spec load_font(file_name :: binary()) :: font :: Exray.Structs.Font.t()

Load font from file into GPU memory (VRAM)

Link to this function

load_font_data(file_data, data_size, font_size, codepoints, type)

View Source
@spec load_font_data(
  file_data :: binary(),
  data_size :: integer(),
  font_size :: integer(),
  codepoints :: [integer()],
  type :: integer()
) :: font_data :: [Exray.Structs.GlyphInfo.t()]

Load font data for further use

Link to this function

load_font_ex(file_name, font_size, codepoints)

View Source
@spec load_font_ex(
  file_name :: binary(),
  font_size :: integer(),
  codepoints :: [integer()]
) ::
  font :: Exray.Structs.Font.t()

Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set

Link to this function

load_font_from_image(image, color_key, first_char)

View Source
@spec load_font_from_image(
  image :: Exray.Structs.Image.t(),
  color_key :: Exray.Structs.Color.t(),
  first_char :: integer()
) :: font :: Exray.Structs.Font.t()

Load font from Image (XNA style)

Link to this function

load_font_from_memory(file_type, file_Data, data_size, font_size, codepoints)

View Source
@spec load_font_from_memory(
  file_type :: binary(),
  file_data :: binary(),
  data_size :: integer(),
  font_size :: integer(),
  codepoints :: [integer()]
) :: font :: Exray.Structs.Font.t()

Load font from memory buffer, fileType refers to extension: i.e. '.ttf'

@spec unload_font(font :: Exray.Structs.Font.t()) :: :ok

Unload font from GPU memory (VRAM)

Link to this function

unload_font_data(glyphs)

View Source
@spec unload_font_data(glyphs :: [Exray.Structs.GlyphInfo.t()]) :: :ok

Unload font chars info data (RAM)