Following up on #711, some macOS devices still experienced font rendering issues.
This commit:
- Simplifies macOS font options to use only essential fonts
- Uses Hiragino Sans GB as primary font for its complete Unicode support
- Keeps .AppleSystemUIFont as system fallback
- Retains Apple Color Emoji for emoji support
This change ensures more reliable CJK text rendering across different macOS versions
without requiring additional font installations.
Fixes remaining font issues from #711
- Add system-specific Unicode font support for Windows/macOS/Linux
- Prioritize native system fonts with good Unicode coverage:
- Windows: Microsoft YaHei, Segoe UI
- macOS: PingFang, Apple Color Emoji
- Linux: DejaVuSans
- Add common fallback fonts for better compatibility
- Add debug logging for font loading
- Improve error handling with informative warnings
This change ensures proper text rendering for multiple languages
in generated GIFs without requiring additional font installations.
Problem
When using CDP (Chrome DevTools Protocol) connections, page operations were resulting in timeout errors after 30000ms. This specifically occurred during page load state verification:
pythonCopyawait page.wait_for_load_state()
The error manifests in the following call stack:
context.py line 219 - Initial wait_for_load_state call
Propagates through Playwright's async API
Times out in frame implementation while waiting for load state
Solution
Implemented page reloading specifically for CDP connections to prevent these timeout errors. This addresses the underlying issue where the page load state was not being properly detected in CDP scenarios.
Implementation Details
Added conditional page reload for CDP connection types
Maintains existing behavior for non-CDP connections
Ensures proper page load state verification
Testing
Verified fix resolves timeout errors with CDP connections
Confirmed existing functionality remains intact for other connection types
Reference
Solution approach based on discords support ticket - https://discord.com/channels/1303749220842340412/1334218695509016657/1334517519611990056
Full credit due to @jhachirag7 on this, I've set them as the commit
author. They also opened #602 but it looks like it has some indentation
issue (fixed here) and a few spurious commits and removed files; I only
mean to make it as easy as possible for maintainers to get this merged.
I (mike@mbaynton.com) have tested that with this fix it is possible to
run against AWS Bedrock + Sonnet 3.5 v2.
Fixes#580