MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / ImFontAtlasBuildFinish

Function ImFontAtlasBuildFinish

KBotExt/imgui/imgui_draw.cpp:2832–2859  ·  view source on GitHub ↗

This is called/shared by both the stb_truetype and the FreeType builder.

Source from the content-addressed store, hash-verified

2830
2831// This is called/shared by both the stb_truetype and the FreeType builder.
2832void ImFontAtlasBuildFinish(ImFontAtlas* atlas)
2833{
2834 // Render into our custom data blocks
2835 IM_ASSERT(atlas->TexPixelsAlpha8 != NULL || atlas->TexPixelsRGBA32 != NULL);
2836 ImFontAtlasBuildRenderDefaultTexData(atlas);
2837 ImFontAtlasBuildRenderLinesTexData(atlas);
2838
2839 // Register custom rectangle glyphs
2840 for (int i = 0; i < atlas->CustomRects.Size; i++)
2841 {
2842 const ImFontAtlasCustomRect* r = &atlas->CustomRects[i];
2843 if (r->Font == NULL || r->GlyphID == 0)
2844 continue;
2845
2846 // Will ignore ImFontConfig settings: GlyphMinAdvanceX, GlyphMinAdvanceY, GlyphExtraSpacing, PixelSnapH
2847 IM_ASSERT(r->Font->ContainerAtlas == atlas);
2848 ImVec2 uv0, uv1;
2849 atlas->CalcCustomRectUV(r, &uv0, &uv1);
2850 r->Font->AddGlyph(NULL, (ImWchar)r->GlyphID, r->GlyphOffset.x, r->GlyphOffset.y, r->GlyphOffset.x + r->Width, r->GlyphOffset.y + r->Height, uv0.x, uv0.y, uv1.x, uv1.y, r->GlyphAdvanceX);
2851 }
2852
2853 // Build all fonts lookup tables
2854 for (ImFont* font : atlas->Fonts)
2855 if (font->DirtyLookupTables)
2856 font->BuildLookupTable();
2857
2858 atlas->TexReady = true;
2859}
2860
2861// Retrieve list of range (2 int per range, values are inclusive)
2862const ImWchar* ImFontAtlas::GetGlyphRangesDefault()

Callers 2

Calls 5

CalcCustomRectUVMethod · 0.80
AddGlyphMethod · 0.80
BuildLookupTableMethod · 0.80

Tested by

no test coverage detected