Open
Bug 968058
Opened 11 years ago
Updated 2 years ago
rebuild osx platform fontlist more efficiently when font changes occur
Categories
(Core :: Graphics: Text, defect)
Tracking
()
NEW
People
(Reporter: jtd, Unassigned)
Details
Attachments
(1 file)
While working on bug 964613, I noticed some funky behavior in the way font change notifications occur under OSX. Current OSX platform fontlist code deals with underlying changes to the system fontlist by using the OSX CFNotificationCenter API. A callback is registered within the gfxMacPlatformFontList constructor which calls RegisteredFontsChangedNotificationCallback when changes occur. This callback rebuilds the fontlist via a call to the UpdateFontList method. However, it turns out that this API has some quirks. When fonts are disabled, the callback is called a single time but when fonts are enabled, the callback is called twice. So in the enable case, Gecko re-initializes the fontlist twice (including associated background fontloader thread runs). At this point there's nothing cataclysmic about this, it's just inefficient. The attached patch dumps out the information within the dictionary passed to the callback: Disable two fonts: CTFontManagerFontChangedNotification CTFontManagerAvailableFontURLsRemoved ( "file:///Library/Fonts/Georgia%20Bold.ttf#postscript-name=Georgia-Bold", "file:///Library/Fonts/Georgia%20Bold%20Italic.ttf#postscript-name=Georgia-BoldItalic" ) Enable the same two fonts: CTFontManagerFontChangedNotification CTFontManagerAvailableFontURLsAdded ( "file://localhost/Library/Fonts/Georgia%20Bold%20Italic.ttf", "file://localhost/Library/Fonts/Georgia%20Bold.ttf" ) CTFontManagerFontChangedNotification CTFontManagerAvailableFontURLsAdded ( "file:///Library/Fonts/Georgia%20Bold.ttf#postscript-name=Georgia-Bold", "file:///Library/Fonts/Georgia%20Bold%20Italic.ttf#postscript-name=Georgia-BoldItalic" ) Seems like the first of the two enable callbacks can be ignored, since it doesn't contain the font URLs that match the disabled font URLs. I think it would also be a good idea to simply rebuild the affected families (i.e. destroy the existing gfxFontFamily object and insert a new, empty one) rather than dumping and rebuilding the entire font list.
Reporter | ||
Updated•9 years ago
|
Assignee: jd.bugzilla → nobody
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•