Update spacing for default font & pixel snap 2D primitives.

This commit is contained in:
Skyth 2025-02-04 14:24:36 +03:00
parent bbb3ebc25d
commit faa292123a
3 changed files with 13 additions and 5 deletions

View file

@ -221,6 +221,8 @@ static bool FontBuilder_Build(ImFontAtlas* atlas)
for (size_t i = 0; i < atlas->ConfigData.size(); i++)
{
auto& config = atlas->ConfigData[i];
bool increaseSpacing = strstr(config.Name, "Seurat") != nullptr;
auto& [index, count] = ranges[i];
for (size_t j = 0; j < count; j++)
{
@ -228,6 +230,11 @@ static bool FontBuilder_Build(ImFontAtlas* atlas)
double x0, y0, x1, y1, u0, v0, u1, v1;
glyph.getQuadPlaneBounds(x0, y0, x1, y1);
glyph.getQuadAtlasBounds(u0, v0, u1, v1);
double advance = glyph.getAdvance();
if (increaseSpacing && glyph.getCodepoint() == ' ')
advance *= 1.5;
config.DstFont->AddGlyph(
&config,
glyph.getCodepoint(),
@ -239,7 +246,7 @@ static bool FontBuilder_Build(ImFontAtlas* atlas)
v1 / packer.height,
u1 / packer.width,
v0 / packer.height,
glyph.getAdvance());
advance);
}
config.DstFont->BuildLookupTable();

View file

@ -3,6 +3,7 @@
#include <app.h>
#include <ui/game_window.h>
#include <gpu/video.h>
#include <xxHashMap.h>
#include "aspect_ratio_patches.h"
#include "camera_patches.h"
@ -348,7 +349,7 @@ struct CsdModifier
uint32_t cornerIndex{};
};
static const ankerl::unordered_dense::map<XXH64_hash_t, CsdModifier> g_modifiers =
static const xxHashMap<CsdModifier> g_modifiers =
{
// ui_balloon
{ HashStr("ui_balloon/window/bg"), { STRETCH } },
@ -1147,8 +1148,8 @@ PPC_FUNC(sub_830D1EF0)
y = g_aspectRatioOffsetY + (y + 0.5f) * g_aspectRatioScale;
}
vertex[i].x = ((x - 0.5f) / Video::s_viewportWidth) * 2.0f - 1.0f;
vertex[i].y = ((y - 0.5f) / Video::s_viewportHeight) * -2.0f + 1.0f;
vertex[i].x = ((round(x) - 0.5f) / Video::s_viewportWidth) * 2.0f - 1.0f;
vertex[i].y = ((round(y) - 0.5f) / Video::s_viewportHeight) * -2.0f + 1.0f;
}
bool letterboxTop = PPC_LOAD_U8(r3.u32 + PRIMITIVE_2D_PADDING_OFFSET + 0x1);

@ -1 +1 @@
Subproject commit 2d135d175dfbedd84d78fb846bcc7de4a859f8ef
Subproject commit 1d2ae6b5f7fd5805e59465e66953bbd8066e75dd