Summary: | [Qt] Support CSS2 Custom Fonts | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Pierre-Luc Beaudoin <pierre-luc.beaudoin> | ||||
Component: | WebKit Qt | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Enhancement | CC: | jonathon | ||||
Priority: | P2 | Keywords: | Qt | ||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | PC | ||||||
OS: | Linux | ||||||
URL: | http://www.alistapart.com/articles/cssatten | ||||||
Attachments: |
|
Description
Pierre-Luc Beaudoin
2008-06-20 12:15:17 PDT
Created attachment 21859 [details]
Hacki implementation
In this hack, I was able to use the code that is already in place to get the Custom Font loaded. This patch is an hack for many reasons:
- All fonts are loaded wether they are needed or not
- It by passes all the Font classes
- It shortcuts the notifying
- ...
Still, you can experience Custom Fonts with this patch.
A problem that will soon araise, is that once the font is loading into the QFontDatabase, only the family name from the .ttf file is actually available. So if the CSS profices a different font-face name, QtWebKit won't be able to make the link between the given name and the actual name of the font. Use of QFont::insertSubstitution should come over that issue, although you don't have access to both names anywhere in the code right now. A quick look at other ports give us there pseudo call stack: On page rendering: Font::fontDataAt() FontFallbackList::fontDataAt() FontCache::getFontData() CSSFontSelector->getFontData() CSSFontFace->getFontData() CSSFontFaceSource::getFontData() CachedFont::beginLoadIfNeeded(); which will trigger the font request, and it will be downloaded Once it is downloaded, CachedFont::checkNotify() CSSFontFaceSource::fontLoaded(CachedFont*) CSSFontFace::fontLoaded(CSSFontFaceSource*) CSSSegmentedFontFace::fontLoaded(CSSFontFace*) CSSFontSelector::fontLoaded(CSSSegmentedFontFace*) m_document->renderer()->setNeedsLayoutAndPrefWidthsRecalc(); which will relayout the page using the new downloaded font. With the recent font work the mentioned examples started to work. |