Skip to content

Add CJK font support and fallback mechanism in AFont class - #762

Open
luadebug wants to merge 37 commits into
aui-framework:developfrom
luadebug:cjk
Open

Add CJK font support and fallback mechanism in AFont class#762
luadebug wants to merge 37 commits into
aui-framework:developfrom
luadebug:cjk

Conversation

@luadebug

@luadebug luadebug commented Jul 28, 2026

Copy link
Copy Markdown
Member

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@luadebug
luadebug marked this pull request as draft July 28, 2026 07:41
Comment thread aui.views/src/AUI/Font/AFont.cpp Outdated
};
static const AString fontsDir = [] {
char buf[MAX_PATH];
UINT len = GetWindowsDirectoryA(buf, MAX_PATH);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use A-suffixed winapi methods

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use GetWindowsDirectory instead

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use GetWindowsDirectoryW instead

Comment thread aui.views/src/AUI/Font/AFont.cpp Outdated
return FT_Get_Char_Index(mFace, codepoint) != 0;
}

void AFont::ensureFallbackFace() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why fallback font is stored per font and not per font manager?

@luadebug
luadebug marked this pull request as ready for review July 29, 2026 00:14
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Comment thread aui.views/src/AUI/Font/AFont.cpp Outdated
return FT_Get_Char_Index(mFace, codepoint) != 0;
}

void AFontManager::ensureFallbackFace() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to AFontManager.cpp?

@Nelonn Nelonn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zaebis

luadebug added 19 commits July 29, 2026 11:39
…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
luadebug added 15 commits July 30, 2026 17:01
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants