feat(font): port shadPS4's sceFont and sceFontFt on FreeType #58
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/58"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-28T03:46:19Z.
What
Every
libSceFont,libSceFont.nativeandlibSceFontFtexport wasNotImplemented, and a retail title renders its text through them. This ports shadPS4'ssceFont/sceFontFtimplementation on top of FreeType.Licensing: the code comes from shadPS4, which is GPL-2.0-or-later. That's compatible with this project's GPL-2.0-only, and every ported file keeps shadPS4's SPDX copyright and license header.
How
libSceFontandlibSceFont.nativeare built from the same sources throughFontLibrary.cmake, andlibSceFontFtprovides the FreeType driver and renderer tables (sceFontSelectLibraryFt,sceFontSelectRendererFt).sceFontCloseFont(not implemented in shadPS4);sceFontSupportSystemFontsstill succeeds, butsceFontOpenFontSetreturnsSCE_FONT_ERROR_FONT_OPEN_FAILEDfor a known system font set, andSCE_FONT_ERROR_NO_SUPPORT_FONTSETfor an unknown one.NotImplemented.Font*placeholder types inSceTypes.hppare removed. The libraries have their own headers now, and nothing else used those types.NotImplemented:sceFontCharacterGetSyllableStringState,sceFontCharactersRefersTextCodes,sceFontControl,sceFontCreateGraphicsDevice,sceFontCreateGraphicsService,sceFontCreateGraphicsServiceWithEdition,sceFontCreateWords,sceFontCreateWritingLine,sceFontDefineAttribute,sceFontDestroyGraphicsDevice,sceFontDestroyGraphicsService,sceFontDestroyWords,sceFontDestroyWritingLine,sceFontDettachDeviceCacheBuffer,sceFontGetAttribute,sceFontGetCharGlyphCode,sceFontGetFontGlyphsCount,sceFontGetFontGlyphsOutlineProfile,sceFontGetFontMetrics,sceFontGetFontResolution,sceFontGetFontStyleInformation,sceFontGetGlyphExpandBufferState,sceFontGetPixelResolution,sceFontGetRenderScaledKerning,sceFontGetResolutionDpi,sceFontGetScriptLanguage,sceFontGetTypographicDesign,sceFontGlyphDefineAttribute,sceFontGlyphGetAttribute,sceFontGlyphRenderImage,sceFontGlyphRenderImageHorizontal,sceFontGlyphRenderImageVertical,sceFontGraphicsBeginFrame,sceFontGraphicsDrawingCancel,sceFontGraphicsDrawingFinish,sceFontGraphicsEndFrame,sceFontGraphicsExchangeResource,sceFontGraphicsFillMethodInit,sceFontGraphicsFillPlotInit,sceFontGraphicsFillPlotSetLayout,sceFontGraphicsFillPlotSetMapping,sceFontGraphicsFillRatesInit,sceFontGraphicsFillRatesSetFillEffect,sceFontGraphicsFillRatesSetLayout,sceFontGraphicsFillRatesSetMapping,sceFontGraphicsGetDeviceUsage,sceFontGraphicsRegionInit,sceFontGraphicsRegionInitCircular,sceFontGraphicsRegionInitRoundish,sceFontGraphicsRelease,sceFontGraphicsRenderResource,sceFontGraphicsSetFramePolicy,sceFontGraphicsSetupClipping,sceFontGraphicsSetupColorRates,sceFontGraphicsSetupFillMethod,sceFontGraphicsSetupFillRates,sceFontGraphicsSetupGlyphFill,sceFontGraphicsSetupGlyphFillPlot,sceFontGraphicsSetupHandleDefault,sceFontGraphicsSetupLocation,sceFontGraphicsSetupPositioning,sceFontGraphicsSetupRotation,sceFontGraphicsSetupScaling,sceFontGraphicsSetupShapeFill,sceFontGraphicsSetupShapeFillPlot,sceFontGraphicsStructureCanvas,sceFontGraphicsStructureCanvasSequence,sceFontGraphicsStructureDesign,sceFontGraphicsStructureDesignResource,sceFontGraphicsStructureSurfaceTexture,sceFontGraphicsUpdateClipping,sceFontGraphicsUpdateColorRates,sceFontGraphicsUpdateFillMethod,sceFontGraphicsUpdateFillRates,sceFontGraphicsUpdateGlyphFill,sceFontGraphicsUpdateGlyphFillPlot,sceFontGraphicsUpdateLocation,sceFontGraphicsUpdatePositioning,sceFontGraphicsUpdateRotation,sceFontGraphicsUpdateScaling,sceFontGraphicsUpdateShapeFill,sceFontGraphicsUpdateShapeFillPlot,sceFontSetScriptLanguage,sceFontSetTypographicDesign,sceFontSupportGlyphs,sceFontTextCodesStepBack,sceFontTextCodesStepNext,sceFontWordsFindWordCharacters,sceFontWritingLineClear,sceFontWritingLineGetOrderingSpace,sceFontWritingLineGetRenderMetrics,sceFontWritingLineRefersRenderStep,sceFontWritingLineWritesOrder.sceFontFtInitAliases,sceFontFtSetAliasFont,sceFontFtSetAliasPath,sceFontFtTermAliases, thesceFontFtSupport*format selectors andsceFontSelectGlyphsFt.New build dependency: FreeType is found with
find_package(Freetype REQUIRED). I've only built this on Linux against the system FreeType. The Windows/MinGW build is untested. How would you like FreeType provided there? For example, a submodule in3rdpartylike SDL2, or should it stay a system package?Testing
New
guest_fonttest (lifecycle and error paths; rendering needs font data, which the repository doesn't ship):sceFontOpenFontSet: fails before system fonts are supported; after support, returnsFONT_OPEN_FAILEDfor a known set andNO_SUPPORT_FONTSETfor an unknown one, and rejects a bad open mode and a null library.sceFontOpenFontMemory: fails before external fonts are supported, rejects a null buffer, and returnsNO_SUPPORT_FORMATfor bytes that aren't a font.Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-09-28T06:48:06Z.
As I understand it, this requires the presence of a library in the system.
find_package(Freetype REQUIRED). Is it possible to add the library as a submodule and build from source?