Overview
#include <imgui.h>
struct ImFontAtlas
{
// fields
ImFontAtlasFlags Flags;
ImTextureFormat TexDesiredFormat;
int TexGlyphPadding;
int TexMinWidth;
int TexMinHeight;
int TexMaxWidth;
int TexMaxHeight;
void* UserData;
ImTextureRef TexRef;
ImTextureRef TexID;
ImTextureData* TexData;
ImVector<ImTextureData*> TexList;
bool Locked;
bool RendererHasTextures;
bool TexIsBuilt;
bool TexPixelsUseColors;
ImVec2 TexUvScale;
ImVec2 TexUvWhitePixel;
ImVector<ImFont*> Fonts;
ImVector<ImFontConfig> Sources;
ImVec4 TexUvLines[IM_DRAWLIST_TEX_LINES_WIDTH_MAX+1];
int TexNextUniqueID;
int FontNextUniqueID;
ImVector<ImDrawListSharedData*> DrawListSharedDatas;
ImFontAtlasBuilder* Builder;
const ImFontLoader* FontLoader;
const char* FontLoaderName;
void* FontLoaderData;
unsigned int FontLoaderFlags;
int RefCount;
ImGuiContext* OwnerContext;
ImFontAtlasRect TempRect;
// methods
IMGUI_API ImFont* AddFont(const ImFontConfig* font_cfg);
IMGUI_API ImFont* AddFontDefault(const ImFontConfig* font_cfg = NULL);
IMGUI_API ImFont* AddFontDefaultVector(const ImFontConfig* font_cfg = NULL);
IMGUI_API ImFont* AddFontDefaultBitmap(const ImFontConfig* font_cfg = NULL);
IMGUI_API ImFont* AddFontFromFileTTF(
const char* filename,
float size_pixels = 0.0f,
const ImFontConfig* font_cfg = NULL,
const ImWchar* glyph_ranges = NULL
);
IMGUI_API ImFont* AddFontFromMemoryTTF(
void* font_data,
int font_data_size,
float size_pixels = 0.0f,
const ImFontConfig* font_cfg = NULL,
const ImWchar* glyph_ranges = NULL
);
IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(
const void* compressed_font_data,
int compressed_font_data_size,
float size_pixels = 0.0f,
const ImFontConfig* font_cfg = NULL,
const ImWchar* glyph_ranges = NULL
);
IMGUI_API ImFont* AddFontFromMemoryCompressedBase85TTF(
const char* compressed_font_data_base85,
float size_pixels = 0.0f,
const ImFontConfig* font_cfg = NULL,
const ImWchar* glyph_ranges = NULL
);
IMGUI_API void RemoveFont(ImFont* font);
IMGUI_API void Clear();
IMGUI_API void CompactCache();
IMGUI_API void SetFontLoader(const ImFontLoader* font_loader);
IMGUI_API void ClearInputData();
IMGUI_API void ClearFonts();
IMGUI_API void ClearTexData();
IMGUI_API bool Build();
IMGUI_API void GetTexDataAsAlpha8(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL
);
IMGUI_API void GetTexDataAsRGBA32(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL
);
void SetTexID(ImTextureID id);
void SetTexID(ImTextureRef id);
bool IsBuilt() const;
IMGUI_API const ImWchar* GetGlyphRangesDefault();
IMGUI_API const ImWchar* GetGlyphRangesGreek();
IMGUI_API const ImWchar* GetGlyphRangesKorean();
IMGUI_API const ImWchar* GetGlyphRangesJapanese();
IMGUI_API const ImWchar* GetGlyphRangesChineseFull();
IMGUI_API const ImWchar* GetGlyphRangesChineseSimplifiedCommon();
IMGUI_API const ImWchar* GetGlyphRangesCyrillic();
IMGUI_API const ImWchar* GetGlyphRangesThai();
IMGUI_API const ImWchar* GetGlyphRangesVietnamese();
IMGUI_API ImFontAtlasRectId AddCustomRect(
int width,
int height,
ImFontAtlasRect* out_r = NULL
);
IMGUI_API void RemoveCustomRect(ImFontAtlasRectId id);
IMGUI_API bool GetCustomRect(
ImFontAtlasRectId id,
ImFontAtlasRect* out_r
) const;
ImFontAtlasRectId AddCustomRectRegular(
int w,
int h
);
const ImFontAtlasRect* GetCustomRectByIndex(ImFontAtlasRectId id);
void CalcCustomRectUV(
const ImFontAtlasRect* r,
ImVec2* out_uv_min,
ImVec2* out_uv_max
) const;
IMGUI_API ImFontAtlasRectId AddCustomRectFontGlyph(
ImFont* font,
ImWchar codepoint,
int w,
int h,
float advance_x,
const ImVec2& offset = ImVec2(0, 0)
);
IMGUI_API ImFontAtlasRectId AddCustomRectFontGlyphForSize(
ImFont* font,
float font_size,
ImWchar codepoint,
int w,
int h,
float advance_x,
const ImVec2& offset = ImVec2(0, 0)
);
};