Add CJK font support and fallback mechanism in AFont class - #762
Open
luadebug wants to merge 37 commits into
Open
Add CJK font support and fallback mechanism in AFont class#762luadebug wants to merge 37 commits into
luadebug wants to merge 37 commits into
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
luadebug
marked this pull request as draft
July 28, 2026 07:41
Nelonn
requested changes
Jul 28, 2026
| }; | ||
| static const AString fontsDir = [] { | ||
| char buf[MAX_PATH]; | ||
| UINT len = GetWindowsDirectoryA(buf, MAX_PATH); |
Contributor
There was a problem hiding this comment.
Do not use A-suffixed winapi methods
Collaborator
There was a problem hiding this comment.
use GetWindowsDirectory instead
Contributor
There was a problem hiding this comment.
Use GetWindowsDirectoryW instead
| return FT_Get_Char_Index(mFace, codepoint) != 0; | ||
| } | ||
|
|
||
| void AFont::ensureFallbackFace() { |
Contributor
There was a problem hiding this comment.
Why fallback font is stored per font and not per font manager?
luadebug
marked this pull request as ready for review
July 29, 2026 00:14
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Nelonn
requested changes
Jul 29, 2026
| return FT_Get_Char_Index(mFace, codepoint) != 0; | ||
| } | ||
|
|
||
| void AFontManager::ensureFallbackFace() { |
… fallback font resources
… proper mutex locking in AFontManager
…uce scoped locking for thread safety
…aceLocked and improve fallback face handling with scoped locking
…s are captured while the fallback lock is held
…, including pre-warming fallback faces and improving glyph metrics capture.
…, including the introduction of FallbackCandidate struct and pre-warming fallback faces to enhance performance.
…, including improvements to fallback face management and glyph rendering logic.
…oving unused fallback font path and data buffer, and simplifying fallback face loading logic.
…ack font loading, simplifying logic and improving performance.
…e character advance calculations and kerning handling.
…twareRenderer to unify handling of empty glyphs, ensuring consistent rendering and measurement across components.
…ate calls in OpenGLRenderer and SoftwareRenderer for improved kerning calculations.
… OpenGLRenderer, and SoftwareRenderer to improve thread safety and handle glyph loading failures more effectively.
…d CJK support and deferred loading of candidates.
…ge for glyph rendering and fallback face loading
…d safety and clarity in AFont, AFontManager, and related components
…ode support and update related calls in AFontManager for better handling of CJK fonts.
…g mutex usage for glyph rendering and fallback face loading, ensuring proper locking during FreeType operations.
…ding documentation for AFontManager pointer usage in AFont.
…andling, ensuring thread safety and efficient memory usage in AFont and AFontManager.
…visional glyphs, improving fallback discovery on a separate thread, and refining mutex usage for better thread safety in AFont and AFontManager.
…safety in AFontManager and updating CharEntry to use shared references for images in SoftwareRenderer, ensuring proper memory management during glyph re-rendering.
…Font, ensuring that provisional and failed glyphs are handled correctly during re-renders, and refining fallback face loading in AFontManager with error logging for missing fonts.
…s in AFontManager, ensuring robustness during font fallback processes.
…ing that cached failed/provisional glyphs are re-rendered at most once per fallback face load, improving efficiency during font rendering processes.
… reprogramming in AFont, ensuring that the primary face's size is only set when needed. Additionally, include SharedPtrTypes header in AFont.h for improved memory management.
- Introduced a new function `programPixelSize` to encapsulate pixel size programming logic for font faces, improving code readability and maintainability. - Updated `AFont::renderGlyph` to utilize `programPixelSize`, simplifying the pixel size setting process and handling fallback logic more effectively. - Modified `AFontManager` to manage fallback font candidates across different platforms, implementing platform-specific logic for CJK font discovery. - Enhanced fallback candidate loading mechanisms for Windows, macOS, Linux, and Android, ensuring proper handling of system fonts. - Improved handling of font file reading by utilizing memory buffers to avoid file I/O during critical sections, reducing potential performance bottlenecks. - Adjusted glyph rendering logic in `SoftwareRenderer` to use float accumulators for advance calculations, ensuring more accurate text width measurements. - Added logging for fallback discovery failures and font loading issues to aid in debugging and user feedback.
…ncing thread safety and cache integrity during glyph rendering. Introduce fallback worker management in AFontManager for improved asynchronous font loading and fallback discovery.
…safely. Improve error handling for font loading in macOS by catching exceptions and logging warnings. Update fallback font paths to include CJK font names for better compatibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#646