BunnyFl ran firmware 13.42's libSceFont natively against this PR's
checks. With both set, the surface's style frame wins over the argument,
so it is now taken first. A frame that sets no scale, zeroed or only
initialised, is accepted and keeps the glyph's generation scale instead
of returning SCE_FONT_ERROR_INVALID_PARAMETER. A valid
sceFontGlyphRenderImageVertical call, and sceFontGlyphRenderImage on a
vertical font, throw again: the module draws the char call's pixels
there but reports a different advance and stride (40/40 against 90/90
at 40 px), and one case doesn't name the rule.
The test drops the vertical comparison and the non-renderer pointer
check, whose result in the module depends on memory past the pointer,
and checks the frame order and the unscaled frames.
Draw a glyph from sceFontGenerateCharGlyph through the sceFontRenderCharGlyphImage rasterizer at the glyph's own scale, with the renderer argument checked as sceFontBindRenderer checks it and the style frame argument, else the surface's frame, applied as surface frames are. The horizontal and vertical forms place the image like their character forms. The three functions build on RenderCodeWithStyle and ApplyStyleFrame from the previous commit and move out of Unimplemented.cpp.
RenderCharGlyphImageCore keeps its handle and bound-renderer checks and
hands the rest of the render, from the glyph lookup to the output fill,
to RenderCodeWithStyle, which takes the style as an argument. The
surface style-frame rule moves into ApplyStyleFrame, with
SurfaceStyleFrame finding a surface's valid frame, and
ResolveSurfaceStyleState now calls the two. The char render calls pass
the same style as before and behave as before.
A string created from a text source in the default horizontal form (0x10)
reported 0x10. TEKKEN: DARK RESURRECTION (PPSA31371) passes the reported form
to sceFontCreateWritingLine, which only accepts 0x11 and 0x12, so the call
failed and the layout width was 0.
On firmware 13.42 sceFontCreateString decides the direction for a default-form
source and sceFontStringGetWritingForm returns the stored form. The string
gets 0x12 when its first strong character is left to right, 0x11 when it is
right to left, and 0x12 when it has none. Left-to-right and right-to-left marks
count as strong, embeddings and overrides do not, and text between an isolate
initiator and its PDI is skipped. Explicit 0x11 and 0x12 sources keep their
form.
The test follows the table reported on the pull request. Which characters are
strong is decided by Unicode block ranges here, not by the full bidi class
tables.
A valid font-set handle with a null output now returns
SCE_FONT_ERROR_INVALID_PARAMETER instead of throwing, matching the
handle, then output, order of the firmware.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ComputeFontGlyphsOutlineProfile read font->library before checking the
handle and cleared the output only after the context lookup, relying on
sceFontGetFontGlyphsOutlineProfile to have validated the handle. It now
rejects a null or non-font handle with SCE_FONT_ERROR_INVALID_FONT_HANDLE
first, clearing a non-null output, then checks the output, then clears it
before the library and context lookups, matching the firmware 13.60 order.
The test also covers a null output with a bad handle and a handle with no
library.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sceFontGetFontGlyphsOutlineProfile reports the maxp maximum contours,
points, composite contours and composite points through the driver slot
at SysDriver+0x70, as libSceFont and libSceFontFt do in firmware 13.60.
A maxp older than 1.0 returns SCE_FONT_ERROR_NO_SUPPORT_FUNCTION, and a
failed call clears the output. Font-set records, which the console
merges over system font entries, still throw.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sceFontGetFontStyleInformation fills the 24-byte style block through the
driver slot at SysDriver+0x48, as libSceFont and libSceFontFt do in
firmware 13.60: the FreeType family and style names, the italic and bold
flags, the OS/2 weight class when it is a multiple of 100 from 100 to 900,
the width class below 10, and 1 plus a right-to-left head direction plus
0x80 for vertical metrics. A font-set record supplies the same fields
directly. A failed call points both names at an empty string and clears
the rest.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sceFontGetFontMetrics fills the 64-byte metrics block through a new
driver slot at SysDriver+0x98, as libSceFont and libSceFontFt do in
firmware 13.60. Form 1 reads hhea, 2 the OS/2 typographic values, 3 the
OS/2 Windows values and 4 the vertical values from vhea or OS/2; 2 and 3
fall back to hhea when OS/2 is missing or gives an empty range. The
bounding box, em size, raw weight deltas and slant follow. A failed call
clears the block and sets both weights to 1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>