Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazily load font face variations #187

Closed
burg opened this issue Nov 10, 2012 · 3 comments
Closed

Lazily load font face variations #187

burg opened this issue Nov 10, 2012 · 3 comments

Comments

@burg
Copy link

@burg burg commented Nov 10, 2012

Currently, the FontList::refresh() method marches over all font faces installed on the system and creates CTFont, FontEntry, etc for it. If possible with CoreText APIs, we should instead eagerly create FontFamily entries, but lazily create the FontEntries whenever the FontFamily is queried.

This is approximately what Gecko does, but they use the ATS API instead of CoreText. The main challenge is getting reliable family names without creating CTFont instances, and then going from family name to CTFont instance using descriptors or whatever.

Promising API:

  • CTFontManagerCopyAvailableFontFamilyNames
@burg
Copy link
Author

@burg burg commented Nov 14, 2012

Gecko does the same thing using Fontconfig:

burg pushed a commit that referenced this issue Nov 14, 2012
…p. This breaks the linux build temporarily. Provides the Mac implementation for Issue #187.
@dhedlund
Copy link
Contributor

@dhedlund dhedlund commented Dec 7, 2013

This was addressed in 905ad4a when load_variations_for_family got fleshed out; all three platforms appear to have working implementations. A quick way to verify this is via the already embedded debug statements.

The following verifies FontEntries are being created lazily under Linux:

$ RUST_LOG=gfx ./servo -x ../src/test/html/about-mozilla.html 2>&1 | grep -o 'Creating new Font\(Family\|Entry\)' | uniq -c
    254 Creating new FontFamily
      4 Creating new FontEntry
@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Dec 7, 2013

Thanks for checking on this!

glennw pushed a commit to glennw/servo that referenced this issue Jan 16, 2017
Fix speed regressions in spheres demo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.