Class MSDFGenExt

java.lang.Object
org.lwjgl.util.msdfgen.MSDFGenExt

public class MSDFGenExt extends Object
  • Field Details

    • MSDF_FONT_SCALING_NONE

      public static final int MSDF_FONT_SCALING_NONE
      Enum values:
      • FONT_SCALING_NONE - The coordinates are kept as the integer values native to the font file.
      • FONT_SCALING_EM_NORMALIZED - The coordinates will be normalized to the em size, i.e. 1 = 1 em.
      • FONT_SCALING_LEGACY - The incorrect legacy version that was in effect before version 1.12, coordinate values are divided by 64 - DO NOT USE - for backwards compatibility only.
      See Also:
    • MSDF_FONT_SCALING_EM_NORMALIZED

      public static final int MSDF_FONT_SCALING_EM_NORMALIZED
      Enum values:
      • FONT_SCALING_NONE - The coordinates are kept as the integer values native to the font file.
      • FONT_SCALING_EM_NORMALIZED - The coordinates will be normalized to the em size, i.e. 1 = 1 em.
      • FONT_SCALING_LEGACY - The incorrect legacy version that was in effect before version 1.12, coordinate values are divided by 64 - DO NOT USE - for backwards compatibility only.
      See Also:
    • MSDF_FONT_SCALING_LEGACY

      public static final int MSDF_FONT_SCALING_LEGACY
      Enum values:
      • FONT_SCALING_NONE - The coordinates are kept as the integer values native to the font file.
      • FONT_SCALING_EM_NORMALIZED - The coordinates will be normalized to the em size, i.e. 1 = 1 em.
      • FONT_SCALING_LEGACY - The incorrect legacy version that was in effect before version 1.12, coordinate values are divided by 64 - DO NOT USE - for backwards compatibility only.
      See Also:
  • Method Details

    • nmsdf_ft_set_load_callback

      public static int nmsdf_ft_set_load_callback(long callback)
      Unsafe version of: ft_set_load_callback
    • msdf_ft_set_load_callback

      public static int msdf_ft_set_load_callback(MSDFGenFTLoadCallbackI callback)
      Overrides the default load callback function used for resolving FreeType function at runtime.
      Parameters:
      callback - a pointer to the function to call for resolving FreeType functions at runtime
      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • nmsdf_ft_get_load_callback

      public static long nmsdf_ft_get_load_callback()
      Unsafe version of: ft_get_load_callback
    • msdf_ft_get_load_callback

      public static @Nullable MSDFGenFTLoadCallback msdf_ft_get_load_callback()
      Retrieves the current FreeType load callback.
      Returns:
      a pointer to the current FreeType load callback function
    • nmsdf_ft_init

      public static int nmsdf_ft_init(long handle)
      Unsafe version of: ft_init
    • msdf_ft_init

      public static int msdf_ft_init(org.lwjgl.PointerBuffer handle)
      Initializes a new FreeType instance to be used with msdfgen.
      Parameters:
      handle - a pointer to a handle to be populated with a new FreeType context
      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • nmsdf_ft_load_font

      public static int nmsdf_ft_load_font(long handle, long fileName, long font)
      Unsafe version of: ft_load_font
    • msdf_ft_load_font

      public static int msdf_ft_load_font(long handle, ByteBuffer fileName, org.lwjgl.PointerBuffer font)
      Loads a TrueType font from the given file(path) and populates the given font handle with the address of the newly loaded font.
      Parameters:
      handle - the handle to the FreeType context to use for loading the font
      fileName - the name or path of/to the font file to load
      font - a pointer to a font handle to be populated with the address of the newly loaded font
      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • msdf_ft_load_font

      public static int msdf_ft_load_font(long handle, CharSequence fileName, org.lwjgl.PointerBuffer font)
      Loads a TrueType font from the given file(path) and populates the given font handle with the address of the newly loaded font.
      Parameters:
      handle - the handle to the FreeType context to use for loading the font
      fileName - the name or path of/to the font file to load
      font - a pointer to a font handle to be populated with the address of the newly loaded font
      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • nmsdf_ft_adopt_font

      public static int nmsdf_ft_adopt_font(long face, long font)
      Unsafe version of: ft_adopt_font
    • msdf_ft_adopt_font

      public static int msdf_ft_adopt_font(long face, org.lwjgl.PointerBuffer font)
      Adopts the given FreeType FT_Face pointer as a font handle.
      Parameters:
      face - an opaque pointer to the FT_Face to adopt
      font - a pointer to an address to be populated with the newly allocated font handle
      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • nmsdf_ft_load_font_data

      public static int nmsdf_ft_load_font_data(long handle, long data, long size, long font)
      Unsafe version of: ft_load_font_data
      Parameters:
      size - the size of the data buffer in bytes
    • msdf_ft_load_font_data

      public static int msdf_ft_load_font_data(long handle, ByteBuffer data, org.lwjgl.PointerBuffer font)
      Loads a TrueType font from the given buffer and populates the given font handle with the address of the newly loaded font.
      Parameters:
      handle - the handle to the FreeType context to use for loading the font
      data - a pointer to the raw data of the TrueType font to load
      font - a pointer to a font handle to be populated with the address of the newly loaded font
      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • nmsdf_ft_font_load_glyph

      public static int nmsdf_ft_font_load_glyph(long font, int cp, int coordinateScaling, long shape)
      Unsafe version of: ft_font_load_glyph
    • msdf_ft_font_load_glyph

      public static int msdf_ft_font_load_glyph(long font, int cp, int coordinateScaling, org.lwjgl.PointerBuffer shape)
      Loads a single glyph from the given font and converts it into a vector shape for rendering glyph sprites.
      Parameters:
      font - a handle to the font to use for generating the glyph shape
      cp - the codepoint to generate a shape for
      coordinateScaling - the coordinate scaling to use. One of:
      FONT_SCALING_NONEFONT_SCALING_EM_NORMALIZEDFONT_SCALING_LEGACY
      shape - a pointer to a handle to be populated with the address of the newly created shape.

      This shape must later be freed using shape_free!

      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • nmsdf_ft_font_load_glyph_by_index

      public static int nmsdf_ft_font_load_glyph_by_index(long font, int index, int coordinateScaling, long shape)
      Unsafe version of: ft_font_load_glyph_by_index
    • msdf_ft_font_load_glyph_by_index

      public static int msdf_ft_font_load_glyph_by_index(long font, int index, int coordinateScaling, org.lwjgl.PointerBuffer shape)
      Loads a single glyph from the given font and converts it into a vector shape for rendering glyph sprites.
      Parameters:
      font - a handle to the font to use for generating the glyph shape
      index - the glyph index to generate a shape for
      coordinateScaling - the coordinate scaling to use. One of:
      FONT_SCALING_NONEFONT_SCALING_EM_NORMALIZEDFONT_SCALING_LEGACY
      shape - a pointer to a handle to be populated with the address of the newly created shape.

      This shape must later be freed using shape_free!

      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • nmsdf_ft_font_get_glyph_index

      public static int nmsdf_ft_font_get_glyph_index(long font, int cp, long index)
      Unsafe version of: ft_font_get_glyph_index
    • msdf_ft_font_get_glyph_index

      public static int msdf_ft_font_get_glyph_index(long font, int cp, IntBuffer index)
      Retrieves the glyph index of the given unicode codepoint.
      Parameters:
      font - a handle to the font to retrieve the glyph index from
      cp - the codepoint to retrieve the glyph index for
      index - a pointer to the glyph index to be retrieved
      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • nmsdf_ft_font_get_kerning

      public static int nmsdf_ft_font_get_kerning(long font, int cp1, int cp2, long kerning)
      Unsafe version of: ft_font_get_kerning
    • msdf_ft_font_get_kerning

      public static int msdf_ft_font_get_kerning(long font, int cp1, int cp2, DoubleBuffer kerning)
      Retrieves the kerning between the two given codepoints.
      Parameters:
      font - a handle to the font to retrieve the kerning from
      cp1 - the left codepoint
      cp2 - the right codepoint
      kerning - a pointer to the kerning value to be retrieved
      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • nmsdf_ft_font_get_kerning_by_index

      public static int nmsdf_ft_font_get_kerning_by_index(long font, int index1, int index2, long kerning)
      Unsafe version of: ft_font_get_kerning_by_index
    • msdf_ft_font_get_kerning_by_index

      public static int msdf_ft_font_get_kerning_by_index(long font, int index1, int index2, DoubleBuffer kerning)
      etrieves the kerning between the two given glyphs.
      Parameters:
      font - a handle to the font to retrieve the kerning from
      index1 - the glyph index of the left glyph
      index2 - the glyph index of the right glyph
      kerning - a pointer to the kerning value to be retrieved
      Returns:
      SUCCESS on success, otherwise one of the constants prefixed with MSDF_ERR_.
    • nmsdf_ft_font_destroy

      public static void nmsdf_ft_font_destroy(long font)
      Unsafe version of: ft_font_destroy
    • msdf_ft_font_destroy

      public static void msdf_ft_font_destroy(long font)
      Frees the underlying instance of the given FreeType font.
      Parameters:
      font - the handle to the font to free
    • nmsdf_ft_deinit

      public static void nmsdf_ft_deinit(long handle)
      Unsafe version of: ft_deinit
    • msdf_ft_deinit

      public static void msdf_ft_deinit(long handle)
      Frees the underlying FreeType instance of the given context.
      Parameters:
      handle - the handle to the FreeType context to free