mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 12:51:42 +00:00
Fix default ImGui font and font scales.
This commit is contained in:
parent
3eff02d19f
commit
8fa706558c
3 changed files with 4 additions and 4 deletions
|
|
@ -179,10 +179,10 @@ static bool FontBuilder_Build(ImFontAtlas* atlas)
|
||||||
auto font = msdfgen::loadFontData(freeType, reinterpret_cast<const msdfgen::byte*>(config.FontData), config.FontDataSize);
|
auto font = msdfgen::loadFontData(freeType, reinterpret_cast<const msdfgen::byte*>(config.FontData), config.FontDataSize);
|
||||||
|
|
||||||
msdf_atlas::FontGeometry fontGeometry(&glyphs);
|
msdf_atlas::FontGeometry fontGeometry(&glyphs);
|
||||||
fontGeometry.loadCharset(font, 1.0, charset);
|
fontGeometry.loadCharset(font, config.SizePixels, charset);
|
||||||
|
|
||||||
auto& metrics = fontGeometry.getMetrics();
|
auto& metrics = fontGeometry.getMetrics();
|
||||||
config.DstFont->FontSize = 1.0f;
|
config.DstFont->FontSize = config.SizePixels;
|
||||||
config.DstFont->ConfigData = &config;
|
config.DstFont->ConfigData = &config;
|
||||||
config.DstFont->ConfigDataCount = 1;
|
config.DstFont->ConfigDataCount = 1;
|
||||||
config.DstFont->ContainerAtlas = atlas;
|
config.DstFont->ContainerAtlas = atlas;
|
||||||
|
|
@ -203,7 +203,6 @@ static bool FontBuilder_Build(ImFontAtlas* atlas)
|
||||||
TightAtlasPacker packer;
|
TightAtlasPacker packer;
|
||||||
packer.spacing = 1;
|
packer.spacing = 1;
|
||||||
packer.dimensionsConstraint = msdf_atlas::DimensionsConstraint::POWER_OF_TWO_RECTANGLE;
|
packer.dimensionsConstraint = msdf_atlas::DimensionsConstraint::POWER_OF_TWO_RECTANGLE;
|
||||||
packer.minScale = 24.0;
|
|
||||||
packer.miterLimit = 1.0;
|
packer.miterLimit = 1.0;
|
||||||
packer.pxRange = 8.0;
|
packer.pxRange = 8.0;
|
||||||
packer.pack(glyphs.data(), glyphs.size(), customRects.data(), customRects.size());
|
packer.pack(glyphs.data(), glyphs.size(), customRects.data(), customRects.size());
|
||||||
|
|
|
||||||
|
|
@ -265,5 +265,5 @@ ImFont* ImFontAtlasSnapshot::GetFont(const char* name)
|
||||||
assert(false && "Unable to locate equivalent font in the atlas file.");
|
assert(false && "Unable to locate equivalent font in the atlas file.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return fontAtlas->AddFontFromFileTTF(name, 1.0f, nullptr, g_glyphRanges.data());
|
return fontAtlas->AddFontFromFileTTF(name, 24.0f, nullptr, g_glyphRanges.data());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1124,6 +1124,7 @@ static void CreateImGuiBackend()
|
||||||
IM_DELETE(io.Fonts);
|
IM_DELETE(io.Fonts);
|
||||||
io.Fonts = ImFontAtlasSnapshot::Load();
|
io.Fonts = ImFontAtlasSnapshot::Load();
|
||||||
#else
|
#else
|
||||||
|
io.Fonts->AddFontDefault();
|
||||||
ImFontAtlasSnapshot::GenerateGlyphRanges();
|
ImFontAtlasSnapshot::GenerateGlyphRanges();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue