@ -1378,6 +1378,7 @@ static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_COUNT][3
ImFontAtlas : : ImFontAtlas ( )
{
Locked = false ;
Flags = 0x00 ;
TexID = NULL ;
TexDesiredWidth = 0 ;
@ -1394,11 +1395,13 @@ ImFontAtlas::ImFontAtlas()
ImFontAtlas : : ~ ImFontAtlas ( )
{
IM_ASSERT ( ! Locked & & " Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()! " ) ;
Clear ( ) ;
}
void ImFontAtlas : : ClearInputData ( )
{
IM_ASSERT ( ! Locked & & " Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()! " ) ;
for ( int i = 0 ; i < ConfigData . Size ; i + + )
if ( ConfigData [ i ] . FontData & & ConfigData [ i ] . FontDataOwnedByAtlas )
{
@ -1421,6 +1424,7 @@ void ImFontAtlas::ClearInputData()
void ImFontAtlas : : ClearTexData ( )
{
IM_ASSERT ( ! Locked & & " Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()! " ) ;
if ( TexPixelsAlpha8 )
ImGui : : MemFree ( TexPixelsAlpha8 ) ;
if ( TexPixelsRGBA32 )
@ -1431,6 +1435,7 @@ void ImFontAtlas::ClearTexData()
void ImFontAtlas : : ClearFonts ( )
{
IM_ASSERT ( ! Locked & & " Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()! " ) ;
for ( int i = 0 ; i < Fonts . Size ; i + + )
IM_DELETE ( Fonts [ i ] ) ;
Fonts . clear ( ) ;
@ -1485,6 +1490,7 @@ void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_wid
ImFont * ImFontAtlas : : AddFont ( const ImFontConfig * font_cfg )
{
IM_ASSERT ( ! Locked & & " Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()! " ) ;
IM_ASSERT ( font_cfg - > FontData ! = NULL & & font_cfg - > FontDataSize > 0 ) ;
IM_ASSERT ( font_cfg - > SizePixels > 0.0f ) ;
@ -1546,6 +1552,7 @@ ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
ImFont * ImFontAtlas : : AddFontFromFileTTF ( const char * filename , float size_pixels , const ImFontConfig * font_cfg_template , const ImWchar * glyph_ranges )
{
IM_ASSERT ( ! Locked & & " Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()! " ) ;
size_t data_size = 0 ;
void * data = ImFileLoadToMemory ( filename , " rb " , & data_size , 0 ) ;
if ( ! data )
@ -1567,6 +1574,7 @@ ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels,
// NB: Transfer ownership of 'ttf_data' to ImFontAtlas, unless font_cfg_template->FontDataOwnedByAtlas == false. Owned TTF buffer will be deleted after Build().
ImFont * ImFontAtlas : : AddFontFromMemoryTTF ( void * ttf_data , int ttf_size , float size_pixels , const ImFontConfig * font_cfg_template , const ImWchar * glyph_ranges )
{
IM_ASSERT ( ! Locked & & " Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()! " ) ;
ImFontConfig font_cfg = font_cfg_template ? * font_cfg_template : ImFontConfig ( ) ;
IM_ASSERT ( font_cfg . FontData = = NULL ) ;
font_cfg . FontData = ttf_data ;
@ -1660,6 +1668,7 @@ bool ImFontAtlas::GetMouseCursorTexData(ImGuiMouseCursor cursor_type, ImVec2* ou
bool ImFontAtlas : : Build ( )
{
IM_ASSERT ( ! Locked & & " Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()! " ) ;
return ImFontAtlasBuildWithStbTruetype ( this ) ;
}