mirror of
https://github.com/ocornut/imgui.git
synced 2025-09-07 11:58:22 +00:00
Fonts: removed LockSingleSrcConfigIdx which isn't needed anymore since we don't load glyphs in ImFontAtlasBuildAddFont().
This commit is contained in:
1
imgui.h
1
imgui.h
@@ -3699,7 +3699,6 @@ struct ImFont
|
|||||||
float Scale; // 4 // in // Base font scale (~1.0f), multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
float Scale; // 4 // in // Base font scale (~1.0f), multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
||||||
ImU8 Used8kPagesMap[(IM_UNICODE_CODEPOINT_MAX+1)/8192/8]; // 1 bytes if ImWchar=ImWchar16, 16 bytes if ImWchar==ImWchar32. Store 1-bit for each block of 4K codepoints that has one active glyph. This is mainly used to facilitate iterations across all used codepoints.
|
ImU8 Used8kPagesMap[(IM_UNICODE_CODEPOINT_MAX+1)/8192/8]; // 1 bytes if ImWchar=ImWchar16, 16 bytes if ImWchar==ImWchar32. Store 1-bit for each block of 4K codepoints that has one active glyph. This is mainly used to facilitate iterations across all used codepoints.
|
||||||
bool EllipsisAutoBake; // 1 // // Mark when the "..." glyph needs to be generated.
|
bool EllipsisAutoBake; // 1 // // Mark when the "..." glyph needs to be generated.
|
||||||
short LockSingleSrcConfigIdx;
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
IMGUI_API ImFont();
|
IMGUI_API ImFont();
|
||||||
|
@@ -3637,14 +3637,11 @@ void ImFontAtlasBuildSetupFontSpecialGlyphs(ImFontAtlas* atlas, ImFont* font, Im
|
|||||||
IM_ASSERT(src_idx_in_font >= 0 && src_idx_in_font < font->SourcesCount);
|
IM_ASSERT(src_idx_in_font >= 0 && src_idx_in_font < font->SourcesCount);
|
||||||
IM_UNUSED(atlas);
|
IM_UNUSED(atlas);
|
||||||
|
|
||||||
// While manipulating glyphs during init we want to restrict all searches for one source font.
|
|
||||||
font->LockSingleSrcConfigIdx = (short)src_idx_in_font;
|
|
||||||
|
|
||||||
// Find Fallback character. Actual glyph loaded in GetFontBaked().
|
// Find Fallback character. Actual glyph loaded in GetFontBaked().
|
||||||
const ImWchar fallback_chars[] = { font->FallbackChar, (ImWchar)IM_UNICODE_CODEPOINT_INVALID, (ImWchar)'?', (ImWchar)' ' };
|
const ImWchar fallback_chars[] = { font->FallbackChar, (ImWchar)IM_UNICODE_CODEPOINT_INVALID, (ImWchar)'?', (ImWchar)' ' };
|
||||||
if (font->FallbackChar == 0)
|
if (font->FallbackChar == 0)
|
||||||
for (ImWchar candidate_char : fallback_chars)
|
for (ImWchar candidate_char : fallback_chars)
|
||||||
if (candidate_char != 0 && font->IsGlyphInFont(candidate_char)) // FIXME: does not respect LockSingleSrcConfigIdx()
|
if (candidate_char != 0 && font->IsGlyphInFont(candidate_char))
|
||||||
{
|
{
|
||||||
font->FallbackChar = (ImWchar)candidate_char;
|
font->FallbackChar = (ImWchar)candidate_char;
|
||||||
break;
|
break;
|
||||||
@@ -3666,7 +3663,6 @@ void ImFontAtlasBuildSetupFontSpecialGlyphs(ImFontAtlas* atlas, ImFont* font, Im
|
|||||||
font->EllipsisChar = 0x0085;
|
font->EllipsisChar = 0x0085;
|
||||||
font->EllipsisAutoBake = true;
|
font->EllipsisAutoBake = true;
|
||||||
}
|
}
|
||||||
font->LockSingleSrcConfigIdx = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFontAtlasBuildDiscardFontBakedGlyph(ImFontAtlas* atlas, ImFont* font, ImFontBaked* baked, ImFontGlyph* glyph)
|
void ImFontAtlasBuildDiscardFontBakedGlyph(ImFontAtlas* atlas, ImFont* font, ImFontBaked* baked, ImFontGlyph* glyph)
|
||||||
@@ -4290,15 +4286,11 @@ static ImFontGlyph* ImFontBaked_BuildLoadGlyph(ImFontBaked* baked, ImWchar codep
|
|||||||
if (ImFontGlyph* glyph = ImFontAtlasBuildSetupFontBakedEllipsis(atlas, baked))
|
if (ImFontGlyph* glyph = ImFontAtlasBuildSetupFontBakedEllipsis(atlas, baked))
|
||||||
return glyph;
|
return glyph;
|
||||||
|
|
||||||
// Load from single source or all sources?
|
|
||||||
int srcs_count = (font->LockSingleSrcConfigIdx != -1) ? 1 : font->SourcesCount;
|
|
||||||
ImFontConfig* srcs = (font->LockSingleSrcConfigIdx != -1) ? &font->Sources[font->LockSingleSrcConfigIdx] : font->Sources;
|
|
||||||
|
|
||||||
// Call backend
|
// Call backend
|
||||||
char* loader_user_data_p = (char*)baked->FontLoaderDatas;
|
char* loader_user_data_p = (char*)baked->FontLoaderDatas;
|
||||||
for (int src_n = 0; src_n < srcs_count; src_n++)
|
for (int src_n = 0; src_n < font->SourcesCount; src_n++)
|
||||||
{
|
{
|
||||||
ImFontConfig* src = &srcs[src_n];
|
ImFontConfig* src = &font->Sources[src_n];
|
||||||
const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader;
|
const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader;
|
||||||
if (!src->GlyphExcludeRanges || ImFontAtlasBuildAcceptCodepointForSource(src, codepoint))
|
if (!src->GlyphExcludeRanges || ImFontAtlasBuildAcceptCodepointForSource(src, codepoint))
|
||||||
if (ImFontGlyph* glyph = loader->FontBakedLoadGlyph(atlas, src, baked, loader_user_data_p, codepoint))
|
if (ImFontGlyph* glyph = loader->FontBakedLoadGlyph(atlas, src, baked, loader_user_data_p, codepoint))
|
||||||
@@ -4884,7 +4876,6 @@ ImFont::ImFont()
|
|||||||
{
|
{
|
||||||
memset(this, 0, sizeof(*this));
|
memset(this, 0, sizeof(*this));
|
||||||
Scale = 1.0f;
|
Scale = 1.0f;
|
||||||
LockSingleSrcConfigIdx = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImFont::~ImFont()
|
ImFont::~ImFont()
|
||||||
|
Reference in New Issue
Block a user