mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Fonts: added ExtraSizeScale feature (undocumented).
This commit is contained in:
parent
d1de937c31
commit
55ad3b4abd
4 changed files with 9 additions and 2 deletions
|
|
@ -17236,6 +17236,9 @@ void ImGui::DebugNodeFont(ImFont* font)
|
||||||
{
|
{
|
||||||
const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader;
|
const ImFontLoader* loader = src->FontLoader ? src->FontLoader : atlas->FontLoader;
|
||||||
Text("Loader: '%s'", loader->Name ? loader->Name : "N/A");
|
Text("Loader: '%s'", loader->Name ? loader->Name : "N/A");
|
||||||
|
|
||||||
|
//if (DragFloat("ExtraSizeScale", &src->ExtraSizeScale, 0.01f, 0.10f, 2.0f))
|
||||||
|
// ImFontAtlasFontRebuildOutput(atlas, font);
|
||||||
#ifdef IMGUI_ENABLE_FREETYPE
|
#ifdef IMGUI_ENABLE_FREETYPE
|
||||||
if (loader->Name != NULL && strcmp(loader->Name, "FreeType") == 0)
|
if (loader->Name != NULL && strcmp(loader->Name, "FreeType") == 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
5
imgui.h
5
imgui.h
|
|
@ -3532,7 +3532,7 @@ struct ImFontConfig
|
||||||
ImS8 OversampleH; // 0 (2) // Rasterize at higher quality for sub-pixel positioning. 0 == auto == 1 or 2 depending on size. Note the difference between 2 and 3 is minimal. You can reduce this to 1 for large glyphs save memory. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
|
ImS8 OversampleH; // 0 (2) // Rasterize at higher quality for sub-pixel positioning. 0 == auto == 1 or 2 depending on size. Note the difference between 2 and 3 is minimal. You can reduce this to 1 for large glyphs save memory. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
|
||||||
ImS8 OversampleV; // 0 (1) // Rasterize at higher quality for sub-pixel positioning. 0 == auto == 1. This is not really useful as we don't use sub-pixel positions on the Y axis.
|
ImS8 OversampleV; // 0 (1) // Rasterize at higher quality for sub-pixel positioning. 0 == auto == 1. This is not really useful as we don't use sub-pixel positions on the Y axis.
|
||||||
ImWchar EllipsisChar; // 0 // Explicitly specify Unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
|
ImWchar EllipsisChar; // 0 // Explicitly specify Unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
|
||||||
float SizePixels; // // Size in pixels for rasterizer (more or less maps to the resulting font height).
|
float SizePixels; // // Output size in pixels for rasterizer (more or less maps to the resulting font height).
|
||||||
const ImWchar* GlyphRanges; // NULL // *LEGACY* THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list).
|
const ImWchar* GlyphRanges; // NULL // *LEGACY* THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list).
|
||||||
const ImWchar* GlyphExcludeRanges; // NULL // Pointer to a small user-provided list of Unicode ranges (2 value per range, values are inclusive, zero-terminated list). This is very close to GlyphRanges[] but designed to exclude ranges from a font source, when merging fonts with overlapping glyphs. Use "Input Glyphs Overlap Detection Tool" to find about your overlapping ranges.
|
const ImWchar* GlyphExcludeRanges; // NULL // Pointer to a small user-provided list of Unicode ranges (2 value per range, values are inclusive, zero-terminated list). This is very close to GlyphRanges[] but designed to exclude ranges from a font source, when merging fonts with overlapping glyphs. Use "Input Glyphs Overlap Detection Tool" to find about your overlapping ranges.
|
||||||
//ImVec2 GlyphExtraSpacing; // 0, 0 // (REMOVED AT IT SEEMS LARGELY OBSOLETE. PLEASE REPORT IF YOU WERE USING THIS). Extra spacing (in pixels) between glyphs when rendered: essentially add to glyph->AdvanceX. Only X axis is supported for now.
|
//ImVec2 GlyphExtraSpacing; // 0, 0 // (REMOVED AT IT SEEMS LARGELY OBSOLETE. PLEASE REPORT IF YOU WERE USING THIS). Extra spacing (in pixels) between glyphs when rendered: essentially add to glyph->AdvanceX. Only X axis is supported for now.
|
||||||
|
|
@ -3542,9 +3542,10 @@ struct ImFontConfig
|
||||||
float GlyphExtraAdvanceX; // 0 // Extra spacing (in pixels) between glyphs. Please contact us if you are using this. // FIXME-NEWATLAS: Intentionally unscaled
|
float GlyphExtraAdvanceX; // 0 // Extra spacing (in pixels) between glyphs. Please contact us if you are using this. // FIXME-NEWATLAS: Intentionally unscaled
|
||||||
ImU32 FontNo; // 0 // Index of font within TTF/OTF file
|
ImU32 FontNo; // 0 // Index of font within TTF/OTF file
|
||||||
unsigned int FontLoaderFlags; // 0 // Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure.
|
unsigned int FontLoaderFlags; // 0 // Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT. Leave as zero if unsure.
|
||||||
//unsigned int FontBuilderFlags; // -- // [Renamed in 1.92] Ue FontLoaderFlags.
|
//unsigned int FontBuilderFlags; // -- // [Renamed in 1.92] Use FontLoaderFlags.
|
||||||
float RasterizerMultiply; // 1.0f // Linearly brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. This is a silly thing we may remove in the future.
|
float RasterizerMultiply; // 1.0f // Linearly brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. This is a silly thing we may remove in the future.
|
||||||
float RasterizerDensity; // 1.0f // [LEGACY: this only makes sense when ImGuiBackendFlags_RendererHasTextures is not supported] DPI scale multiplier for rasterization. Not altering other font metrics: makes it easy to swap between e.g. a 100% and a 400% fonts for a zooming display, or handle Retina screen. IMPORTANT: If you change this it is expected that you increase/decrease font scale roughly to the inverse of this, otherwise quality may look lowered.
|
float RasterizerDensity; // 1.0f // [LEGACY: this only makes sense when ImGuiBackendFlags_RendererHasTextures is not supported] DPI scale multiplier for rasterization. Not altering other font metrics: makes it easy to swap between e.g. a 100% and a 400% fonts for a zooming display, or handle Retina screen. IMPORTANT: If you change this it is expected that you increase/decrease font scale roughly to the inverse of this, otherwise quality may look lowered.
|
||||||
|
float ExtraSizeScale; // 1.0f // Extra rasterizer scale over SizePixels.
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
ImFontFlags Flags; // Font flags (don't use just yet, will be exposed in upcoming 1.92.X updates)
|
ImFontFlags Flags; // Font flags (don't use just yet, will be exposed in upcoming 1.92.X updates)
|
||||||
|
|
|
||||||
|
|
@ -2418,6 +2418,7 @@ ImFontConfig::ImFontConfig()
|
||||||
FontDataOwnedByAtlas = true;
|
FontDataOwnedByAtlas = true;
|
||||||
OversampleH = 0; // Auto == 1 or 2 depending on size
|
OversampleH = 0; // Auto == 1 or 2 depending on size
|
||||||
OversampleV = 0; // Auto == 1
|
OversampleV = 0; // Auto == 1
|
||||||
|
ExtraSizeScale = 1.0f;
|
||||||
GlyphMaxAdvanceX = FLT_MAX;
|
GlyphMaxAdvanceX = FLT_MAX;
|
||||||
RasterizerMultiply = 1.0f;
|
RasterizerMultiply = 1.0f;
|
||||||
RasterizerDensity = 1.0f;
|
RasterizerDensity = 1.0f;
|
||||||
|
|
@ -4612,6 +4613,7 @@ static bool ImGui_ImplStbTrueType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig*
|
||||||
bd_font_data->ScaleFactor = stbtt_ScaleForPixelHeight(&bd_font_data->FontInfo, 1.0f);
|
bd_font_data->ScaleFactor = stbtt_ScaleForPixelHeight(&bd_font_data->FontInfo, 1.0f);
|
||||||
if (src->MergeMode && src->SizePixels != 0.0f && ref_size != 0.0f)
|
if (src->MergeMode && src->SizePixels != 0.0f && ref_size != 0.0f)
|
||||||
bd_font_data->ScaleFactor *= src->SizePixels / ref_size; // FIXME-NEWATLAS: Should tidy up that a bit
|
bd_font_data->ScaleFactor *= src->SizePixels / ref_size; // FIXME-NEWATLAS: Should tidy up that a bit
|
||||||
|
bd_font_data->ScaleFactor *= src->ExtraSizeScale;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -420,6 +420,7 @@ static bool ImGui_ImplFreeType_FontBakedInit(ImFontAtlas* atlas, ImFontConfig* s
|
||||||
float size = baked->Size;
|
float size = baked->Size;
|
||||||
if (src->MergeMode && src->SizePixels != 0.0f)
|
if (src->MergeMode && src->SizePixels != 0.0f)
|
||||||
size *= (src->SizePixels / baked->OwnerFont->Sources[0]->SizePixels);
|
size *= (src->SizePixels / baked->OwnerFont->Sources[0]->SizePixels);
|
||||||
|
size *= src->ExtraSizeScale;
|
||||||
|
|
||||||
ImGui_ImplFreeType_FontSrcData* bd_font_data = (ImGui_ImplFreeType_FontSrcData*)src->FontLoaderData;
|
ImGui_ImplFreeType_FontSrcData* bd_font_data = (ImGui_ImplFreeType_FontSrcData*)src->FontLoaderData;
|
||||||
bd_font_data->BakedLastActivated = baked;
|
bd_font_data->BakedLastActivated = baked;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue