Start packing over current empty texture
| 4173 | |
| 4174 | // Start packing over current empty texture |
| 4175 | void ImFontAtlasBuildInit(ImFontAtlas* atlas) |
| 4176 | { |
| 4177 | // Select Backend |
| 4178 | // - Note that we do not reassign to atlas->FontLoader, since it is likely to point to static data which |
| 4179 | // may mess with some hot-reloading schemes. If you need to assign to this (for dynamic selection) AND are |
| 4180 | // using a hot-reloading scheme that messes up static data, store your own instance of FontLoader somewhere |
| 4181 | // and point to it instead of pointing directly to return value of the GetFontLoaderXXX functions. |
| 4182 | if (atlas->FontLoader == NULL) |
| 4183 | { |
| 4184 | #ifdef IMGUI_ENABLE_FREETYPE |
| 4185 | atlas->SetFontLoader(ImGuiFreeType::GetFontLoader()); |
| 4186 | #elif defined(IMGUI_ENABLE_STB_TRUETYPE) |
| 4187 | atlas->SetFontLoader(ImFontAtlasGetFontLoaderForStbTruetype()); |
| 4188 | #else |
| 4189 | IM_ASSERT(0); // Invalid Build function |
| 4190 | #endif |
| 4191 | } |
| 4192 | |
| 4193 | // Create initial texture size |
| 4194 | if (atlas->TexData == NULL || atlas->TexData->Pixels == NULL) |
| 4195 | ImFontAtlasTextureAdd(atlas, ImUpperPowerOfTwo(atlas->TexMinWidth), ImUpperPowerOfTwo(atlas->TexMinHeight)); |
| 4196 | |
| 4197 | atlas->Builder = IM_NEW(ImFontAtlasBuilder)(); |
| 4198 | if (atlas->FontLoader->LoaderInit) |
| 4199 | atlas->FontLoader->LoaderInit(atlas); |
| 4200 | |
| 4201 | ImFontAtlasBuildUpdateRendererHasTexturesFromContext(atlas); |
| 4202 | |
| 4203 | ImFontAtlasPackInit(atlas); |
| 4204 | |
| 4205 | // Add required texture data |
| 4206 | ImFontAtlasBuildUpdateLinesTexData(atlas); |
| 4207 | ImFontAtlasBuildUpdateBasicTexData(atlas); |
| 4208 | |
| 4209 | // Register fonts |
| 4210 | ImFontAtlasBuildUpdatePointers(atlas); |
| 4211 | |
| 4212 | // Update UV coordinates etc. stored in bound ImDrawListSharedData instance |
| 4213 | ImFontAtlasUpdateDrawListsSharedData(atlas); |
| 4214 | |
| 4215 | //atlas->TexIsBuilt = true; |
| 4216 | } |
| 4217 | |
| 4218 | // Destroy builder and all cached glyphs. Do not destroy actual fonts. |
| 4219 | void ImFontAtlasBuildDestroy(ImFontAtlas* atlas) |
no test coverage detected