Class NkFont

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class NkFont extends Struct<NkFont> implements NativeResource

 struct nk_font {
     {@link NkFont struct nk_font} * next;
     {@link NkUserFont struct nk_user_font} handle;
     {@link NkBakedFont struct nk_baked_font} info;
     float scale;
     {@link NkFontGlyph struct nk_font_glyph} * glyphs;
     {@link NkFontGlyph struct nk_font_glyph} const * fallback;
     nk_rune fallback_codepoint;
     {@link NkHandle nk_handle} texture;
     {@link NkFontConfig struct nk_font_config} * config;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • NEXT

      public static final int NEXT
      The struct member offsets.
    • HANDLE

      public static final int HANDLE
      The struct member offsets.
    • INFO

      public static final int INFO
      The struct member offsets.
    • SCALE

      public static final int SCALE
      The struct member offsets.
    • GLYPHS

      public static final int GLYPHS
      The struct member offsets.
    • FALLBACK

      public static final int FALLBACK
      The struct member offsets.
    • FALLBACK_CODEPOINT

      public static final int FALLBACK_CODEPOINT
      The struct member offsets.
    • TEXTURE

      public static final int TEXTURE
      The struct member offsets.
    • CONFIG

      public static final int CONFIG
      The struct member offsets.
  • Constructor Details

    • NkFont

      public NkFont(ByteBuffer container)
      Creates a NkFont instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<NkFont>
    • next

      public @Nullable NkFont next()
      Returns:
      a NkFont view of the struct pointed to by the next field.
    • handle

      public NkUserFont handle()
      Returns:
      a NkUserFont view of the handle field.
    • info

      public NkBakedFont info()
      Returns:
      a NkBakedFont view of the info field.
    • scale

      public float scale()
      Returns:
      the value of the scale field.
    • glyphs

      public @Nullable NkFontGlyph glyphs()
      Returns:
      a NkFontGlyph view of the struct pointed to by the glyphs field.
    • fallback

      public @Nullable NkFontGlyph fallback()
      Returns:
      a NkFontGlyph view of the struct pointed to by the fallback field.
    • fallback_codepoint

      public int fallback_codepoint()
      Returns:
      the value of the fallback_codepoint field.
    • texture

      public NkHandle texture()
      Returns:
      a NkHandle view of the texture field.
    • config

      public @Nullable NkFontConfig config()
      Returns:
      a NkFontConfig view of the struct pointed to by the config field.
    • next

      public NkFont next(@Nullable NkFont value)
      Sets the address of the specified NkFont to the next field.
    • handle

      public NkFont handle(NkUserFont value)
      Copies the specified NkUserFont to the handle field.
    • handle

      public NkFont handle(Consumer<NkUserFont> consumer)
      Passes the handle field to the specified Consumer.
    • info

      public NkFont info(NkBakedFont value)
      Copies the specified NkBakedFont to the info field.
    • info

      public NkFont info(Consumer<NkBakedFont> consumer)
      Passes the info field to the specified Consumer.
    • scale

      public NkFont scale(float value)
      Sets the specified value to the scale field.
    • glyphs

      public NkFont glyphs(@Nullable NkFontGlyph value)
      Sets the address of the specified NkFontGlyph to the glyphs field.
    • fallback

      public NkFont fallback(@Nullable NkFontGlyph value)
      Sets the address of the specified NkFontGlyph to the fallback field.
    • fallback_codepoint

      public NkFont fallback_codepoint(int value)
      Sets the specified value to the fallback_codepoint field.
    • texture

      public NkFont texture(NkHandle value)
      Copies the specified NkHandle to the texture field.
    • texture

      public NkFont texture(Consumer<NkHandle> consumer)
      Passes the texture field to the specified Consumer.
    • config

      public NkFont config(@Nullable NkFontConfig value)
      Sets the address of the specified NkFontConfig to the config field.
    • set

      public NkFont set(@Nullable NkFont next, NkUserFont handle, NkBakedFont info, float scale, @Nullable NkFontGlyph glyphs, @Nullable NkFontGlyph fallback, int fallback_codepoint, NkHandle texture, @Nullable NkFontConfig config)
      Initializes this struct with the specified values.
    • set

      public NkFont set(NkFont src)
      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static NkFont malloc()
      Returns a new NkFont instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static NkFont calloc()
      Returns a new NkFont instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static NkFont create()
      Returns a new NkFont instance allocated with BufferUtils.
    • create

      public static NkFont create(long address)
      Returns a new NkFont instance for the specified memory address.
    • createSafe

      public static @Nullable NkFont createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static NkFont.Buffer malloc(int capacity)
      Returns a new NkFont.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static NkFont.Buffer calloc(int capacity)
      Returns a new NkFont.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static NkFont.Buffer create(int capacity)
      Returns a new NkFont.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static NkFont.Buffer create(long address, int capacity)
      Create a NkFont.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable NkFont.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • malloc

      public static NkFont malloc(MemoryStack stack)
      Returns a new NkFont instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static NkFont calloc(MemoryStack stack)
      Returns a new NkFont instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static NkFont.Buffer malloc(int capacity, MemoryStack stack)
      Returns a new NkFont.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static NkFont.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new NkFont.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nnext

      public static @Nullable NkFont nnext(long struct)
      Unsafe version of next().
    • nhandle

      public static NkUserFont nhandle(long struct)
      Unsafe version of handle().
    • ninfo

      public static NkBakedFont ninfo(long struct)
      Unsafe version of info().
    • nscale

      public static float nscale(long struct)
      Unsafe version of scale().
    • nglyphs

      public static @Nullable NkFontGlyph nglyphs(long struct)
      Unsafe version of glyphs().
    • nfallback

      public static @Nullable NkFontGlyph nfallback(long struct)
      Unsafe version of fallback().
    • nfallback_codepoint

      public static int nfallback_codepoint(long struct)
      Unsafe version of fallback_codepoint().
    • ntexture

      public static NkHandle ntexture(long struct)
      Unsafe version of texture().
    • nconfig

      public static @Nullable NkFontConfig nconfig(long struct)
      Unsafe version of config().
    • nnext

      public static void nnext(long struct, @Nullable NkFont value)
      Unsafe version of next.
    • nhandle

      public static void nhandle(long struct, NkUserFont value)
      Unsafe version of handle.
    • ninfo

      public static void ninfo(long struct, NkBakedFont value)
      Unsafe version of info.
    • nscale

      public static void nscale(long struct, float value)
      Unsafe version of scale.
    • nglyphs

      public static void nglyphs(long struct, @Nullable NkFontGlyph value)
      Unsafe version of glyphs.
    • nfallback

      public static void nfallback(long struct, @Nullable NkFontGlyph value)
      Unsafe version of fallback.
    • nfallback_codepoint

      public static void nfallback_codepoint(long struct, int value)
      Unsafe version of fallback_codepoint.
    • ntexture

      public static void ntexture(long struct, NkHandle value)
      Unsafe version of texture.
    • nconfig

      public static void nconfig(long struct, @Nullable NkFontConfig value)
      Unsafe version of config.