Fonts: Added a bit of user facing tooling.
This commit is contained in:
@@ -15594,6 +15594,7 @@ void ImGui::ShowFontAtlas(ImFontAtlas* atlas)
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
|
||||||
|
SeparatorText("Fonts");
|
||||||
Text("Read ");
|
Text("Read ");
|
||||||
SameLine(0, 0);
|
SameLine(0, 0);
|
||||||
TextLinkOpenURL("https://www.dearimgui.com/faq/");
|
TextLinkOpenURL("https://www.dearimgui.com/faq/");
|
||||||
@@ -15641,6 +15642,28 @@ void ImGui::ShowFontAtlas(ImFontAtlas* atlas)
|
|||||||
PopID();
|
PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SeparatorText("Font Atlas");
|
||||||
|
if (Button("Clear Cache"))
|
||||||
|
atlas->ClearCache();
|
||||||
|
SameLine();
|
||||||
|
if (Button("Grow"))
|
||||||
|
ImFontAtlasBuildGrowTexture(atlas);
|
||||||
|
SameLine();
|
||||||
|
if (Button("Compact"))
|
||||||
|
ImFontAtlasBuildCompactTexture(atlas);
|
||||||
|
|
||||||
|
for (int tex_n = 0; tex_n < atlas->TexList.Size; tex_n++)
|
||||||
|
{
|
||||||
|
ImTextureData* tex = atlas->TexList[tex_n];
|
||||||
|
if (tex_n > 0)
|
||||||
|
SameLine();
|
||||||
|
Text("Tex: %dx%d", tex->Width, tex->Height);
|
||||||
|
}
|
||||||
|
const int packed_surface_sqrt = (int)sqrtf((float)atlas->Builder->RectsPackedSurface);
|
||||||
|
const int discarded_surface_sqrt = (int)sqrtf((float)atlas->Builder->RectsDiscardedSurface);
|
||||||
|
Text("Packed rects: %d, area: about %d px ~%dx%d px", atlas->Builder->RectsPackedCount, atlas->Builder->RectsPackedSurface, packed_surface_sqrt, packed_surface_sqrt);
|
||||||
|
Text("incl. Discarded rects: %d, area: about %d px ~%dx%d px", atlas->Builder->RectsDiscardedCount, atlas->Builder->RectsDiscardedSurface, discarded_surface_sqrt, discarded_surface_sqrt);
|
||||||
|
|
||||||
// Texture list
|
// Texture list
|
||||||
for (ImTextureData* tex : atlas->TexList)
|
for (ImTextureData* tex : atlas->TexList)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -8446,11 +8446,11 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
{
|
{
|
||||||
ImGuiIO& io = GetIO();
|
ImGuiIO& io = GetIO();
|
||||||
ImFontAtlas* atlas = io.Fonts;
|
ImFontAtlas* atlas = io.Fonts;
|
||||||
HelpMarker("Read FAQ and docs/FONTS.md for details on font loading.");
|
|
||||||
ShowFontAtlas(atlas);
|
ShowFontAtlas(atlas);
|
||||||
|
|
||||||
// Post-baking font scaling. Note that this is NOT the nice way of scaling fonts, read below.
|
// Post-baking font scaling. Note that this is NOT the nice way of scaling fonts, read below.
|
||||||
// (we enforce hard clamping manually as by default DragFloat/SliderFloat allows CTRL+Click text to get out of bounds).
|
// (we enforce hard clamping manually as by default DragFloat/SliderFloat allows CTRL+Click text to get out of bounds).
|
||||||
|
SeparatorText("Legacy Scaling");
|
||||||
const float MIN_SCALE = 0.3f;
|
const float MIN_SCALE = 0.3f;
|
||||||
const float MAX_SCALE = 2.0f;
|
const float MAX_SCALE = 2.0f;
|
||||||
HelpMarker(
|
HelpMarker(
|
||||||
|
|||||||
Reference in New Issue
Block a user