Qt-4.8 WebKit + QtWebKit-2.3.x上CSS3 Web Fonts支援的一些記錄

來源:互聯網
上載者:User

標籤:webkit   css3   web fonts   browser   

  Chrome 37 Firefox 32 IE 8
TTF(TrueType) ○ ○ ○ ╳
OTF(OpenType) ○ ○ ○ ╳
WOFF ○ ○ ○ ╳
SVG ╳ ○ ╳ ╳
local() ╳ ○ ○ ╳
EOT ╳ ╳ ╳ ○
WOFF 2.0 ╳ ╳ ╳ ╳

TTF/OTF格式的字型檔屬於Web Fonts預設支援的;

WOFF需要開啟一個條件宏,也沒什麼問題
EOT是IE專用的

SVG需要啟用ENABLE(SVG_FONTS),問題是最終連結時報錯:


g++ -fuse-ld=gold -Wl,--gc-sections -Wl,--no-undefined -Wl,-O1 -Wl,-rpath,/home/cteng/qt48/WebKitBuild/Release/lib -Wl,-rpath,/opt/browser13/qt/lib -o ../../bin/QtTestBrowser obj/release/QtInitializeTestFonts.o obj/release/locationedit.o obj/release/launcherwindow.o obj/release/main.o obj/release/mainwindow.o obj/release/urlloader.o obj/release/utils.o obj/release/webpage.o obj/release/webview.o obj/release/fpstimer.o obj/release/cookiejar.o obj/release/moc_locationedit.o obj/release/moc_launcherwindow.o obj/release/moc_mainwindow.o obj/release/moc_urlloader.o obj/release/moc_webinspector.o obj/release/moc_webpage.o obj/release/moc_webview.o obj/release/moc_fpstimer.o obj/release/moc_cookiejar.o obj/release/qrc_QtTestBrowser.o -L/home/cteng/qt48/WebKitBuild/Release/lib -L/opt/browser13/qt/plugins/platforms -L/opt/browser13/qt/plugins/generic -L/opt/browser13/qt/lib -L/usr/X11R6/lib -lQtWebKit -lgio-2.0 -lgstapp-0.10 -lgstpbutils-0.10 -lgstvideo-0.10 -lgstaudio-0.10 -lgstbase-0.10 -lgstinterfaces-0.10 -pthread -lgstfft-0.10 -lm -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lxml2 -lglib-2.0 -lQtSql -L/opt/browser13/qt/lib -lQtXmlPatterns -lQtOpenGL -L/usr/lib/i386-linux-gnu -lQtGui -lQtNetwork -lQtCore -lGLESv2 -lpthread 
/home/cteng/qt48/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::GlyphPageTreeNode::getRoot(unsigned int)‘ 
/home/cteng/qt48/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::GlyphPageTreeNode::getChild(WebCore::FontData const*, unsigned int)‘ 
/home/cteng/qt48/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::WidthIterator::WidthIterator(WebCore::Font const*, WebCore::TextRun const&, WTF::HashSet<WebCore::SimpleFontData const*, WTF::PtrHash<WebCore::SimpleFontData const*>, WTF::HashTraits<WebCore::SimpleFontData const*> >*, bool, bool)‘ 
/home/cteng/qt48/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::Font::glyphDataForCharacter(unsigned int, bool, WebCore::FontDataVariant) const‘ 
/home/cteng/qt48/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator(unsigned short const*, int, int, int)‘ 
/home/cteng/qt48/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::WidthIterator::advance(int, WebCore::GlyphBuffer*)‘ 
/home/cteng/qt48/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::SimpleFontData::widthForGlyph(unsigned short) const‘ 
/home/cteng/qt48/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::Font::glyphDataAndPageForCharacter(unsigned int, bool, WebCore::FontDataVariant) const‘ 
/home/cteng/qt48/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::SurrogatePairAwareTextIterator::advance(unsigned int)‘ 
/home/cteng/qt48/WebKitBuild/Release/lib/libQtWebKit.so: undefined reference to `WebCore::SurrogatePairAwareTextIterator::consume(unsigned int&, unsigned int&)‘ 


進一步調查發現,函數依賴於QRawFont特性,而這個特性在qt-4.8上不支援:


#if !(PLATFORM(QT) && !HAVE(QRAWFONT)) 
ALWAYS_INLINE FloatRect SimpleFontData::boundsForGlyph(Glyph glyph) const 
{ 
    if (isZeroWidthSpaceGlyph(glyph)) 
        return FloatRect(); 

    FloatRect bounds; 
    if (m_glyphToBoundsMap) { 
        bounds = m_glyphToBoundsMap->metricsForGlyph(glyph); 
        if (bounds.width() != cGlyphSizeUnknown) 
            return bounds; 
    } 

    bounds = platformBoundsForGlyph(glyph); 
    if (!m_glyphToBoundsMap) 
        m_glyphToBoundsMap = adoptPtr(new GlyphMetricsMap<FloatRect>); 
    m_glyphToBoundsMap->setMetricsForGlyph(glyph, bounds); 
    return bounds; 
} 

ALWAYS_INLINE float SimpleFontData::widthForGlyph(Glyph glyph) const 
{ 
    if (isZeroWidthSpaceGlyph(glyph)) 
        return 0; 

    float width = m_glyphToWidthMap.metricsForGlyph(glyph); 
    if (width != cGlyphSizeUnknown) 
        return width; 

    if (m_fontData) 
        width = m_fontData->widthForSVGGlyph(glyph, m_platformData.size()); 
#if ENABLE(OPENTYPE_VERTICAL) 
    else if (m_verticalData) 
#if USE(CG) || USE(CAIRO) || PLATFORM(WX) || USE(SKIA_ON_MAC_CHROMIUM) 
        width = m_verticalData->advanceHeight(this, glyph) + m_syntheticBoldOffset; 
#else 
        width = m_verticalData->advanceHeight(this, glyph); 
#endif 
#endif 
    else 
        width = platformWidthForGlyph(glyph); 

    m_glyphToWidthMap.setMetricsForGlyph(glyph, width); 
    return width; 
} 
#endif // HAVE(QRAWFONT) 



Qt-4.8 WebKit + QtWebKit-2.3.x上CSS3 Web Fonts支援的一些記錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.