Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions core/libs/prx/libSceFont/src/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ int APS5_VABI sceFontGetKerning(FontHandle fontHandle, std::uint32_t preCode, st

int APS5_VABI sceFontGetRenderScaledKerning(FontHandle fontHandle, std::uint32_t preCode, std::uint32_t code, FontKerning* kerning) {
if (!kerning) return SCE_FONT_ERROR_INVALID_PARAMETER;
*kerning = {};
FontKerning localKerning{};
if (!CopyOutGuest(kerning, localKerning)) return SCE_FONT_ERROR_INVALID_PARAMETER;
auto* font = GetNativeFont(fontHandle);
std::uint32_t fontLock = 0;
if (!font || font->magic != HANDLE_MAGIC || !AcquireFontLock(font, fontLock)) return SCE_FONT_ERROR_INVALID_FONT_HANDLE;
Expand All @@ -331,7 +332,10 @@ int APS5_VABI sceFontGetRenderScaledKerning(FontHandle fontHandle, std::uint32_t
float scaleH = 0.0f;
rc = StyleStateGetScalePixel(&font->cached_style.state, &scaleW, &scaleH);
const FontState* state = TryGetState(fontHandle);
if (rc == SCE_FONT_OK && state) LoadKerning(*state, scaleW, scaleH, preCode, code, kerning);
if (rc == SCE_FONT_OK && state) {
LoadKerning(*state, scaleW, scaleH, preCode, code, &localKerning);
if (!CopyOutGuest(kerning, localKerning)) rc = SCE_FONT_ERROR_INVALID_PARAMETER;
}
}
ReleaseCachedStyleLock(font, cachedLock);
ReleaseFontLock(font, fontLock);
Expand Down
2 changes: 2 additions & 0 deletions core/libs/tests/GuestFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,8 @@ int main() {
kerning = {1.0f, 1.0f, 1.0f, 1.0f};
Require(sceFontGetRenderScaledKerning(font, 'A', 'B', &kerning) == SCE_FONT_OK && KerningIs(kerning, 0.0f));
Require(sceFontGetRenderScaledKerning(font, 'A', 'V', nullptr) == SCE_FONT_ERROR_INVALID_PARAMETER);
errno = EBUSY;
Require(sceFontGetRenderScaledKerning(font, 'A', 'V', reinterpret_cast<FontKerning*>(std::uintptr_t{0x10})) == SCE_FONT_ERROR_INVALID_PARAMETER && errno == EBUSY);
kerning = {1.0f, 1.0f, 1.0f, 1.0f};
Require(sceFontGetRenderScaledKerning(nullptr, 'A', 'V', &kerning) == SCE_FONT_ERROR_INVALID_FONT_HANDLE && KerningIs(kerning, 0.0f));
kerning = {1.0f, 1.0f, 1.0f, 1.0f};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# libSceFont

## add Functional

- [sceFontGetRenderScaledKerning](../../../core/libs/prx/libSceFont/src/Render.cpp) (libSceFont) - returning `SCE_FONT_ERROR_INVALID_PARAMETER` for an unwritable `kerning` pointer via `CopyOutGuest` with caller `errno` preserved is a host-safety fallback with console behavior unmeasured. Closes when: measured on hardware. Labels: console, tested.
Loading