Skip to content

feat(libSceFont): implement attributes and text code stepping - #2497

Closed
tarfouss3 wants to merge 2 commits into
boykopovar:mainfrom
tarfouss3:feat/font-attributes-text-codes
Closed

tarfouss3 wants to merge 2 commits into
boykopovar:mainfrom
tarfouss3:feat/font-attributes-text-codes

Conversation

@tarfouss3

Copy link
Copy Markdown

What

Implements 6 exports that called NotImplemented: sceFontDefineAttribute, sceFontGetAttribute, sceFontCharactersRefersTextCodes, sceFontTextCodesStepNext, sceFontTextCodesStepBack, sceFontCharacterGetSyllableStringState.

The source of each function's signature and behaviour is recorded in docs/dev/TechnicalDebt.md; none is confirmed on a title, and inputs whose console behaviour is not established throw.

Left as stubs, as no reference establishes their signature or behaviour: sceFontControl, sceFontCreateWords, sceFontDestroyWords, sceFontWordsFindWordCharacters, sceFontGetFontGlyphsOutlineProfile, sceFontGetFontMetrics, sceFontGetFontStyleInformation, sceFontGetGlyphExpandBufferState, sceFontSupportGlyphs, sceFontGetScriptLanguage, sceFontSetScriptLanguage, sceFontGetTypographicDesign, sceFontSetTypographicDesign, sceFontGlyphGetAttribute, sceFontGlyphRenderImage, sceFontGlyphRenderImageHorizontal, sceFontGlyphRenderImageVertical, sceFontCreateGraphicsDevice, sceFontCreateGraphicsService, sceFontCreateGraphicsServiceWithEdition, sceFontDestroyGraphicsDevice, sceFontDestroyGraphicsService, sceFontGraphicsBeginFrame, sceFontGraphicsDrawingCancel, sceFontGraphicsDrawingFinish, sceFontGraphicsEndFrame, sceFontGraphicsExchangeResource, sceFontGraphicsGetDeviceUsage, sceFontGraphicsRegionInit, sceFontGraphicsRegionInitCircular, sceFontGraphicsRegionInitRoundish, sceFontGraphicsRelease, sceFontGraphicsRenderResource, sceFontGraphicsSetFramePolicy, sceFontGraphicsStructureCanvas, sceFontGraphicsStructureCanvasSequence, sceFontGraphicsStructureDesign, sceFontGraphicsStructureDesignResource, sceFontGraphicsStructureSurfaceTexture, sceFontGraphicsDrawupFillTextureImageObject, sceFontGraphicsDrawupFillTexturePatternObject, sceFontGraphicsFillMethodInit, sceFontGraphicsFillPlotInit, sceFontGraphicsFillPlotSetLayout, sceFontGraphicsFillPlotSetMapping, sceFontGraphicsFillRatesInit, sceFontGraphicsFillRatesSetFillEffect, sceFontGraphicsFillRatesSetLayout, sceFontGraphicsFillRatesSetMapping, sceFontGraphicsSetupClipping, sceFontGraphicsSetupColorRates, sceFontGraphicsSetupFillMethod, sceFontGraphicsSetupFillRates, sceFontGraphicsSetupGlyphFill, sceFontGraphicsSetupGlyphFillPlot, sceFontGraphicsSetupHandleDefault, sceFontGraphicsSetupLocation, sceFontGraphicsSetupPositioning, sceFontGraphicsSetupRotation, sceFontGraphicsSetupScaling, sceFontGraphicsSetupShapeFill, sceFontGraphicsSetupShapeFillPlot, sceFontGraphicsUpdateClipping, sceFontGraphicsUpdateColorRates, sceFontGraphicsUpdateFillMethod, sceFontGraphicsUpdateFillRates, sceFontGraphicsUpdateGlyphFill, sceFontGraphicsUpdateGlyphFillPlot, sceFontGraphicsUpdateLocation, sceFontGraphicsUpdatePositioning, sceFontGraphicsUpdateRotation, sceFontGraphicsUpdateScaling, sceFontGraphicsUpdateShapeFill, sceFontGraphicsUpdateShapeFillPlot, sceFontFtInitAliases, sceFontFtSetAliasFont, sceFontFtSetAliasPath, sceFontFtSupportBdf, sceFontFtSupportCid, sceFontFtSupportFontFormats, sceFontFtSupportOpenType, sceFontFtSupportOpenTypeOtf, sceFontFtSupportOpenTypeTtf, sceFontFtSupportPcf, sceFontFtSupportPfr, sceFontFtSupportSystemFonts, sceFontFtSupportTrueType, sceFontFtSupportTrueTypeGx, sceFontFtSupportType1, sceFontFtSupportType42, sceFontFtSupportWinFonts, sceFontFtTermAliases, sceFontSelectGlyphsFt.

Tested

Linux x86-64 (Ubuntu 24.04, GCC 13.3, Release, BUILD_TESTING=ON), this branch alone on top of main (5bc7886): full build and libs, then the whole ctest suite with Vulkan on lavapipe: 521 of 523 passed. The two failures are environmental and also fail without this change: agc_driver_vopc_compare (lavapipe result) and guest_sce_net (the test machine has no IPv6, so the existing CheckUnspecifiedIpv6 aborts). Tests added or extended for this change: guest_font, guest_font_text, guest_font_writing_line, guest_system_font. tools/check_conventions.py passes. Not tested with a title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes. Written with Claude Code: agents looked up each signature in the public reimplementations cited above, implemented and tested it, and a second agent reviewed every function against those sources and reverted what they did not support.

🤖 Generated with Claude Code

tarfouss3 and others added 2 commits October 10, 2026 01:16
Implements 6 exports that called NotImplemented: sceFontDefineAttribute, sceFontGetAttribute, sceFontCharactersRefersTextCodes, sceFontTextCodesStepNext, sceFontTextCodesStepBack, sceFontCharacterGetSyllableStringState.

Left as stubs, as no reference establishes their signature or behaviour: sceFontControl, sceFontCreateWords, sceFontDestroyWords, sceFontWordsFindWordCharacters, sceFontGetFontGlyphsOutlineProfile, sceFontGetFontMetrics, sceFontGetFontStyleInformation, sceFontGetGlyphExpandBufferState, sceFontSupportGlyphs, sceFontGetScriptLanguage, sceFontSetScriptLanguage, sceFontGetTypographicDesign, sceFontSetTypographicDesign, sceFontGlyphGetAttribute, sceFontGlyphRenderImage, sceFontGlyphRenderImageHorizontal, sceFontGlyphRenderImageVertical, sceFontCreateGraphicsDevice, sceFontCreateGraphicsService, sceFontCreateGraphicsServiceWithEdition, sceFontDestroyGraphicsDevice, sceFontDestroyGraphicsService, sceFontGraphicsBeginFrame, sceFontGraphicsDrawingCancel, sceFontGraphicsDrawingFinish, sceFontGraphicsEndFrame, sceFontGraphicsExchangeResource, sceFontGraphicsGetDeviceUsage, sceFontGraphicsRegionInit, sceFontGraphicsRegionInitCircular, sceFontGraphicsRegionInitRoundish, sceFontGraphicsRelease, sceFontGraphicsRenderResource, sceFontGraphicsSetFramePolicy, sceFontGraphicsStructureCanvas, sceFontGraphicsStructureCanvasSequence, sceFontGraphicsStructureDesign, sceFontGraphicsStructureDesignResource, sceFontGraphicsStructureSurfaceTexture, sceFontGraphicsDrawupFillTextureImageObject, sceFontGraphicsDrawupFillTexturePatternObject, sceFontGraphicsFillMethodInit, sceFontGraphicsFillPlotInit, sceFontGraphicsFillPlotSetLayout, sceFontGraphicsFillPlotSetMapping, sceFontGraphicsFillRatesInit, sceFontGraphicsFillRatesSetFillEffect, sceFontGraphicsFillRatesSetLayout, sceFontGraphicsFillRatesSetMapping, sceFontGraphicsSetupClipping, sceFontGraphicsSetupColorRates, sceFontGraphicsSetupFillMethod, sceFontGraphicsSetupFillRates, sceFontGraphicsSetupGlyphFill, sceFontGraphicsSetupGlyphFillPlot, sceFontGraphicsSetupHandleDefault, sceFontGraphicsSetupLocation, sceFontGraphicsSetupPositioning, sceFontGraphicsSetupRotation, sceFontGraphicsSetupScaling, sceFontGraphicsSetupShapeFill, sceFontGraphicsSetupShapeFillPlot, sceFontGraphicsUpdateClipping, sceFontGraphicsUpdateColorRates, sceFontGraphicsUpdateFillMethod, sceFontGraphicsUpdateFillRates, sceFontGraphicsUpdateGlyphFill, sceFontGraphicsUpdateGlyphFillPlot, sceFontGraphicsUpdateLocation, sceFontGraphicsUpdatePositioning, sceFontGraphicsUpdateRotation, sceFontGraphicsUpdateScaling, sceFontGraphicsUpdateShapeFill, sceFontGraphicsUpdateShapeFillPlot, sceFontFtInitAliases, sceFontFtSetAliasFont, sceFontFtSetAliasPath, sceFontFtSupportBdf, sceFontFtSupportCid, sceFontFtSupportFontFormats, sceFontFtSupportOpenType, sceFontFtSupportOpenTypeOtf, sceFontFtSupportOpenTypeTtf, sceFontFtSupportPcf, sceFontFtSupportPfr, sceFontFtSupportSystemFonts, sceFontFtSupportTrueType, sceFontFtSupportTrueTypeGx, sceFontFtSupportType1, sceFontFtSupportType42, sceFontFtSupportWinFonts, sceFontFtTermAliases, sceFontSelectGlyphsFt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CM3ZvU1gP32iEs7abAt7N6
@github-actions github-actions Bot mentioned this pull request Oct 9, 2026
9 tasks done
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked build and ctest (guest_font, guest_font_writing_line, guest_font_text), the attribute/stepping behaviour against KytyPS5 libFont.cpp and the vertical flag against sceFontRenderCharGlyphImage on main.

Added one commit: dropped the three TechnicalDebt entries for the Graphics/Ft stubs, which this PR does not touch (they belong in a PR that changes those functions).

Merging once CI is green.

@adriadam10
adriadam10 force-pushed the feat/font-attributes-text-codes branch from a2ca24a to 57bd47c Compare October 9, 2026 23:17
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#2150 core/libs/tests/GuestFont.cpp L5-6, L79-86

@github-actions github-actions Bot added the intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

@github-actions github-actions Bot closed this Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Progress report (5cb747c → 57bd47c)

📈 System libraries: 85.88% (+0.2%, +6 implemented functions)

✅ 6 implemented
Library Name
libSceFont sceFontCharacterGetSyllableStringState
libSceFont sceFontCharactersRefersTextCodes
libSceFont sceFontDefineAttribute
libSceFont sceFontGetAttribute
libSceFont sceFontTextCodesStepBack
libSceFont sceFontTextCodesStepNext

@Mouad-Scriptz-0

Copy link
Copy Markdown

A title now stops on sceFontCharacterGetSyllableStringState on main: Killzone: Liberation (PPSA11142 01.000.004, Sony's PSP emulator wrapper), Linux, main 0f863c1 with #1693, #3428 and my fence branch from #3534 merged locally for its three earlier stops, and Noto fonts in anyps5-fonts/ so sceFontOpenFontSet(0x1808B4D4) succeeds:

[libc] unhandled exception 'St13runtime_error' thrown from 0x7f255e360c64
terminate called after throwing an instance of 'std::runtime_error'
  what():  sceFontCharacterGetSyllableStringState not implemented

The title's layout loop (0x353a82) walks sceFontStringRefersTextCharacters → sceFontCharacterGetBidiLevel → sceFontCharacterGetTextFontCode → sceFontCharacterLooksWhiteSpace → sceFontCharacterGetSyllableStringState(character, &state) → sceFontCharacterRefersTextNext, so the (const FontTextCharacter*, int*) signature here matches the call, and the title tests state == 1 before checking the text code against ", ( and [.

With this branch's libSceFont-module.prx (head 57bd47c, built as is) the title gets past it and stops at the next font gap, sceFontWritingLineWritesOrder: writing attribute 2147483898 is not modelled (attribute 0x8000010A), which is outside this PR. Without fonts the title runs to its controls screen with no text. The branch no longer merges cleanly onto current main.

AI-assisted: yes (Claude Code).

@santhoshkumar-dev

Copy link
Copy Markdown
Contributor

@tarfouss3 @Mouad-Scriptz-0 Since #2497 was closed by the intake pause and Killzone now stops on sceFontCharacterGetSyllableStringState, I've carried just that function from this PR onto current main (a11c8f7f), with tarfouss3 as co-author: santhoshkumar-dev:feat/font-syllable-string-state (3f202abb). It reports 0 when the character and its neighbours are outside complex scripts (this PR's ranges) and throws otherwise. The new guest_font_text test passes on Windows and Linux; with main's stub it aborts with the same not implemented line as the title.

Killzone's next stop you saw (WritesOrder attribute 0x800000FA) should already pass on current main: since #3260, bit 31 is SPACE_AFTER, and guest_font_writing_line covers 0xFA | SPACE_AFTER.

@tarfouss3, if you'd rather reopen #2497 yourself, say so and I'll drop mine. @Mouad-Scriptz-0, could you run Killzone with this branch's libSceFont? I can only open it as a PR once my current one merges (open-PR limit).

AI-assisted: yes (Claude Code)

@Mouad-Scriptz-0

Copy link
Copy Markdown

Ran Killzone: Liberation (PPSA11142 01.000.004, Linux, Fedora 44, Intel Arc Meteor Lake) with santhoshkumar-dev:feat/font-syllable-string-state (3f202abb) applied on main a11c8f7, together with #1693, #3428, the fence branch from #3534, the vertex-table branch from #3622 and a local recompiler change for its barycentric stop, Noto fonts in anyps5-fonts/.

  • guest_font_text passes here (1/1).
  • The title no longer stops in libSceFont on its text: sceFontCharacterGetSyllableStringState returns without a throw, there is no Failed to measure / Failed to render text to buffer line in the log, and the sceFontWritingLineWritesOrder attribute stop I reported earlier does not reappear on this main, as you said.
  • With settings already in save data the title skips its controls screen, loads KZL.PRX and stops in the graphics driver on last provoking vertex is unsupported for generated primitive pipelines, which is unrelated to fonts.
  • With fresh save data the controls screen's text goes one step further and stops in the wrapper's own surface validation: it creates a 0 x 32 R8 texture for "Press START to play!" and asserts (DrawEnginePS5.cpp(1529), 0x8a6c000b). The width comes from sceFontWritingLineGetRenderMetrics, so that is a render-metrics gap in libSceFont's writing line, outside this branch; with no fonts the screen renders blank text and runs.

So from this title's side the branch does what #2497's function did. AI-assisted: yes (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants