struct ImGui::ImFontAtlas

Overview

struct ImFontAtlas

Included Modules

Defined in:

obj.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new : ImFontAtlas #

[View source]

Instance Method Detail

def add_custom_rect_font_glyph(font : ImFont, id : ImWchar, width : Int32, height : Int32, advance_x : Float32, offset : ImVec2 = ImVec2.new(0, 0)) : Int32 #

[View source]
def add_custom_rect_regular(width : Int32, height : Int32) : Int32 #

[View source]
def add_font(font_cfg : ImFontConfig) : ImFont #

[View source]
def add_font_default(font_cfg : ImFontConfig | Nil = nil) : ImFont #

[View source]
def add_font_from_file_ttf(filename : String, size_pixels : Float32, font_cfg : ImFontConfig | Nil = nil, glyph_ranges : Pointer(ImWchar) = Pointer(ImWchar).null) : ImFont #

[View source]
def add_font_from_memory_compressed_base85_ttf(compressed_font_data_base85 : String, size_pixels : Float32, font_cfg : ImFontConfig | Nil = nil, glyph_ranges : Pointer(ImWchar) = Pointer(ImWchar).null) : ImFont #

'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.

ImFontAtlas::AddFontFromMemoryCompressedBase85TTF()


[View source]
def add_font_from_memory_compressed_ttf(compressed_font_data : Pointer(Void), compressed_font_size : Int32, size_pixels : Float32, font_cfg : ImFontConfig | Nil = nil, glyph_ranges : Pointer(ImWchar) = Pointer(ImWchar).null) : ImFont #

'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.

ImFontAtlas::AddFontFromMemoryCompressedTTF()


[View source]
def add_font_from_memory_ttf(font_data : Pointer(Void), font_size : Int32, size_pixels : Float32, font_cfg : ImFontConfig | Nil = nil, glyph_ranges : Pointer(ImWchar) = Pointer(ImWchar).null) : ImFont #

Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after destruction of the atlas. Set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed.

ImFontAtlas::AddFontFromMemoryTTF()


[View source]
def build : Bool #

Build pixels data. This is called automatically for you by the GetTexData*** functions.

ImFontAtlas::Build()


[View source]
def calc_custom_rect_uv(rect : ImFontAtlasCustomRect) : Tuple(ImGui::ImVec2, ImGui::ImVec2) #

[View source]
def clear : Void #

Clear all input and output.

ImFontAtlas::Clear()


[View source]
def clear_fonts : Void #

Clear output font data (glyphs storage, UV coordinates).

ImFontAtlas::ClearFonts()


[View source]
def clear_input_data : Void #

Clear input data (all ImFontConfig structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts.

ImFontAtlas::ClearInputData()


[View source]
def clear_tex_data : Void #

Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory.

ImFontAtlas::ClearTexData()


[View source]
def config_data : ImVector(LibImGui::ImFontConfig) #

Configuration data


[View source]
def config_data=(config_data : ImVector(LibImGui::ImFontConfig)) #

[View source]
def custom_rects : ImVector(LibImGui::ImFontAtlasCustomRect) #

Rectangles for packing custom texture data into the atlas.


[View source]
def custom_rects=(custom_rects : ImVector(LibImGui::ImFontAtlasCustomRect)) #

[View source]
def flags : ImFontAtlasFlags #

Build flags (see ImFontAtlasFlags_)


[View source]
def flags=(flags : ImFontAtlasFlags) #

[View source]
def font_builder_flags : UInt32 #

Shared flags (for all fonts) for custom font builder. THIS IS BUILD IMPLEMENTATION DEPENDENT. Per-font override is also available in ImFontConfig.


[View source]
def font_builder_flags=(font_builder_flags : UInt32) #

[View source]
def font_builder_io : ImFontBuilderIO | Nil #

Opaque interface to a font builder (default to stb_truetype, can be changed to use FreeType by defining IMGUI_ENABLE_FREETYPE).


[View source]
def font_builder_io=(font_builder_io : ImFontBuilderIO | Nil) #

[View source]
def fonts : ImVector(ImFont) #

Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling ImGui::NewFrame(), use ImGui::PushFont()/PopFont() to change the current font.


[View source]
def fonts=(fonts : ImVector(ImFont)) #

[View source]
def get_custom_rect_by_index(index : Int32) : ImFontAtlasCustomRect #

[View source]
def get_glyph_ranges_chinese_full : Pointer(ImWchar) #

Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs

ImFontAtlas::GetGlyphRangesChineseFull()


[View source]
def get_glyph_ranges_chinese_simplified_common : Pointer(ImWchar) #

Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese

ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon()


[View source]
def get_glyph_ranges_cyrillic : Pointer(ImWchar) #

Default + about 400 Cyrillic characters

ImFontAtlas::GetGlyphRangesCyrillic()


[View source]
def get_glyph_ranges_default : Pointer(ImWchar) #

Basic Latin, Extended Latin

ImFontAtlas::GetGlyphRangesDefault()


[View source]
def get_glyph_ranges_greek : Pointer(ImWchar) #

Default + Greek and Coptic

ImFontAtlas::GetGlyphRangesGreek()


[View source]
def get_glyph_ranges_japanese : Pointer(ImWchar) #

Default + Hiragana, Katakana, Half-Width, Selection of 2999 Ideographs

ImFontAtlas::GetGlyphRangesJapanese()


[View source]
def get_glyph_ranges_korean : Pointer(ImWchar) #

Default + Korean characters

ImFontAtlas::GetGlyphRangesKorean()


[View source]
def get_glyph_ranges_thai : Pointer(ImWchar) #

Default + Thai characters

ImFontAtlas::GetGlyphRangesThai()


[View source]
def get_glyph_ranges_vietnamese : Pointer(ImWchar) #

Default + Vietnamese characters

ImFontAtlas::GetGlyphRangesVietnamese()


[View source]
def get_mouse_cursor_tex_data(cursor : ImGuiMouseCursor) : Tuple(Bool, ImGui::ImVec2, ImGui::ImVec2, Slice(ImGui::ImVec2), Slice(ImGui::ImVec2)) #

[View source]
def get_tex_data_as_alpha8 : Tuple(Pointer(LibC::UChar), LibC::Int, LibC::Int, LibC::Int) #

[View source]
def get_tex_data_as_rgba32 : Tuple(Pointer(LibC::UChar), LibC::Int, LibC::Int, LibC::Int) #

[View source]
def is_built : Bool #

Bit ambiguous: used to detect when user didn't build texture but effectively we should check TexID != 0 except that would be backend dependent...

ImFontAtlas::IsBuilt()


[View source]
def locked : Bool #

Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert.


[View source]
def locked=(locked : Bool) #

[View source]
def pack_id_lines : Int32 #

Custom texture rectangle ID for baked anti-aliased lines


[View source]
def pack_id_lines=(pack_id_lines : Int32) #

[View source]
def pack_id_mouse_cursors : Int32 #

Custom texture rectangle ID for white pixel and mouse cursors


[View source]
def pack_id_mouse_cursors=(pack_id_mouse_cursors : Int32) #

[View source]
def set_tex_id(id : ImTextureID) : Void #

[View source]
def tex_desired_width : Int32 #

Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.


[View source]
def tex_desired_width=(tex_desired_width : Int32) #

[View source]
def tex_glyph_padding : Int32 #

Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0 (will also need to set AntiAliasedLinesUseTex = false).


[View source]
def tex_glyph_padding=(tex_glyph_padding : Int32) #

[View source]
def tex_height : Int32 #

Texture height calculated during Build().


[View source]
def tex_height=(tex_height : Int32) #

[View source]
def tex_id : ImTextureID #

User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure.


[View source]
def tex_id=(tex_id : ImTextureID) #

[View source]
def tex_pixels_alpha8 : Pointer(LibC::UChar) #

1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight


[View source]
def tex_pixels_alpha8=(tex_pixels_alpha8 : Pointer(LibC::UChar)) #

[View source]
def tex_pixels_rgba32 : Pointer(UInt32) #

4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4


[View source]
def tex_pixels_rgba32=(tex_pixels_rgba32 : Pointer(UInt32)) #

[View source]
def tex_pixels_use_colors : Bool #

Tell whether our texture data is known to use colors (rather than just alpha channel), in order to help backend select a format.


[View source]
def tex_pixels_use_colors=(tex_pixels_use_colors : Bool) #

[View source]
def tex_ready : Bool #

Set when texture was built matching current font input


[View source]
def tex_ready=(tex_ready : Bool) #

[View source]
def tex_uv_lines : Slice(ImVec4) #

UVs for baked anti-aliased lines


[View source]
def tex_uv_lines=(tex_uv_lines : Slice(ImVec4)) #

[View source]
def tex_uv_scale : ImVec2 #

= (1.0f/TexWidth, 1.0f/TexHeight)


[View source]
def tex_uv_scale=(tex_uv_scale : ImVec2) #

[View source]
def tex_uv_white_pixel : ImVec2 #

Texture coordinates to a white pixel


[View source]
def tex_uv_white_pixel=(tex_uv_white_pixel : ImVec2) #

[View source]
def tex_width : Int32 #

Texture width calculated during Build().


[View source]
def tex_width=(tex_width : Int32) #

[View source]
def to_unsafe : Pointer(T) #

[View source]
def user_data : Pointer(Void) #

Store your own atlas related user-data (if e.g. you have multiple font atlas).


[View source]
def user_data=(user_data : Pointer(Void)) #

[View source]