MCPcopy Create free account
hub / github.com/RenderKit/embree / ImFontAtlasBuildFinish

Function ImFontAtlasBuildFinish

tutorials/common/imgui/imgui_draw.cpp:2772–2799  ·  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

2770
2771// This is called/shared by both the stb_truetype and the FreeType builder.
2772void ImFontAtlasBuildFinish(ImFontAtlas* atlas)
2773{
2774 // Render into our custom data blocks
2775 IM_ASSERT(atlas->TexPixelsAlpha8 != NULL || atlas->TexPixelsRGBA32 != NULL);
2776 ImFontAtlasBuildRenderDefaultTexData(atlas);
2777 ImFontAtlasBuildRenderLinesTexData(atlas);
2778
2779 // Register custom rectangle glyphs
2780 for (int i = 0; i < atlas->CustomRects.Size; i++)
2781 {
2782 const ImFontAtlasCustomRect* r = &atlas->CustomRects[i];
2783 if (r->Font == NULL || r->GlyphID == 0)
2784 continue;
2785
2786 // Will ignore ImFontConfig settings: GlyphMinAdvanceX, GlyphMinAdvanceY, GlyphExtraSpacing, PixelSnapH
2787 IM_ASSERT(r->Font->ContainerAtlas == atlas);
2788 ImVec2 uv0, uv1;
2789 atlas->CalcCustomRectUV(r, &uv0, &uv1);
2790 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);
2791 }
2792
2793 // Build all fonts lookup tables
2794 for (int i = 0; i < atlas->Fonts.Size; i++)
2795 if (atlas->Fonts[i]->DirtyLookupTables)
2796 atlas->Fonts[i]->BuildLookupTable();
2797
2798 atlas->TexReady = true;
2799}
2800
2801// Retrieve list of range (2 int per range, values are inclusive)
2802const ImWchar* ImFontAtlas::GetGlyphRangesDefault()

Callers 1

Calls 5

CalcCustomRectUVMethod · 0.80
AddGlyphMethod · 0.80
BuildLookupTableMethod · 0.80

Tested by

no test coverage detected