Class NkUserFont

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class NkUserFont
    extends Struct
    implements NativeResource

    Member documentation

    • userdata – user provided font handle
    • height – max height of the font
    • width – font string width in pixel callback
    • query – font glyph callback to query drawing info
    • texture – texture handle to the used font atlas or texture

    Layout

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

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • USERDATA, HEIGHT, WIDTH, QUERY, TEXTURE

        The struct member offsets.
    • Constructor Detail

      • NkUserFont

        public NkUserFont​(java.nio.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 Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • userdata

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

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

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

        public NkUserFont userdata​(java.util.function.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.
      • texture

        public NkUserFont texture​(java.util.function.Consumer<NkHandle> consumer)
        Passes the texture field to the specified Consumer.
      • 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

        @Nullable
        public static 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​(long address,
                                               int capacity)
        Create a NkUserFont.Buffer instance at the specified memory.
        Parameters:
        address - the memory address
        capacity - the buffer capacity
      • createSafe

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

        public static NkUserFont mallocStack()
        Returns a new NkUserFont instance allocated on the thread-local MemoryStack.
      • callocStack

        public static NkUserFont callocStack()
        Returns a new NkUserFont instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

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

        public static NkUserFont callocStack​(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
      • callocStack

        public static NkUserFont.Buffer callocStack​(int capacity)
        Returns a new NkUserFont.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • callocStack

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

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

        public static float nheight​(long struct)
        Unsafe version of height().
      • 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.
      • ntexture

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