Class NkUserFont

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class NkUserFont extends Struct<NkUserFont> implements NativeResource

 struct nk_user_font {
     nk_handle userdata;
     float height;
     nk_text_width_f width;
     nk_query_font_glyph_f query;
     nk_handle texture;
 }
  • Field Details

    • SIZEOF

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

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

      public static final int USERDATA
      The struct member offsets.
    • HEIGHT

      public static final int HEIGHT
      The struct member offsets.
    • WIDTH

      public static final int WIDTH
      The struct member offsets.
    • QUERY

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

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

    • NkUserFont

      public NkUserFont(ByteBuffer container)
      Creates a NkUserFont 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<NkUserFont>
    • userdata

      public NkHandle userdata()
      Returns:
      a NkHandle view of the userdata field.
    • height

      public float height()
      Returns:
      the value of the height field.
    • width

      public @Nullable NkTextWidthCallback width()
      Returns:
      the value of the width field.
    • query

      public @Nullable NkQueryFontGlyphCallback query()
      Returns:
      the value of the query field.
    • texture

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

      public NkUserFont userdata(NkHandle value)
      Copies the specified NkHandle to the userdata field.
    • userdata

      public NkUserFont userdata(Consumer<NkHandle> consumer)
      Passes the userdata field to the specified Consumer.
    • height

      public NkUserFont height(float value)
      Sets the specified value to the height field.
    • width

      public NkUserFont width(@Nullable NkTextWidthCallbackI value)
      Sets the specified value to the width field.
    • query

      public NkUserFont query(@Nullable NkQueryFontGlyphCallbackI value)
      Sets the specified value to the query field.
    • texture

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

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

      public NkUserFont set(NkHandle userdata, float height, NkTextWidthCallbackI width, NkQueryFontGlyphCallbackI query, NkHandle texture)
      Initializes this struct with the specified values.
    • set

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static NkUserFont.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new NkUserFont.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
    • nuserdata

      public static NkHandle nuserdata(long struct)
      Unsafe version of userdata().
    • nheight

      public static float nheight(long struct)
      Unsafe version of height().
    • nwidth

      public static @Nullable NkTextWidthCallback nwidth(long struct)
      Unsafe version of width().
    • nquery

      public static @Nullable NkQueryFontGlyphCallback nquery(long struct)
      Unsafe version of query().
    • ntexture

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

      public static void nuserdata(long struct, NkHandle value)
      Unsafe version of userdata.
    • nheight

      public static void nheight(long struct, float value)
      Unsafe version of height.
    • nwidth

      public static void nwidth(long struct, @Nullable NkTextWidthCallbackI value)
      Unsafe version of width.
    • nquery

      public static void nquery(long struct, @Nullable NkQueryFontGlyphCallbackI value)
      Unsafe version of query.
    • ntexture

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