WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
proposed patch
locl.diff (text/plain), 4.48 KB, created by
Koan-Sin Tan
on 2010-12-31 21:35:12 PST
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Koan-Sin Tan
Created:
2010-12-31 21:35:12 PST
Size:
4.48 KB
patch
obsolete
>Index: WebCore/ChangeLog >=================================================================== >--- WebCore/ChangeLog (revision 74843) >+++ WebCore/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2010-12-31 Koan-Sin Tan <koansin.tan@gmail.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WebKit freetype backend doesn't support "locl" tables >+ https://bugs.webkit.org/show_bug.cgi?id=37984 >+ >+ No new tests. (OOPS!) >+ >+ * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp: >+ (WebCore::substituteWithForCurrentLocale): >+ (WebCore::GlyphPage::fill): >+ > 2010-12-31 Adam Barth <abarth@webkit.org> > > Reviewed by Darin Adler. >Index: WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp >=================================================================== >--- WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp (revision 74843) >+++ WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp (working copy) >@@ -31,13 +31,85 @@ > #include "config.h" > #include "GlyphPageTreeNode.h" > >+#include "GRefPtr.h" > #include "SimpleFontData.h" > #include <cairo-ft.h> > #include <cairo.h> > #include <fontconfig/fcfreetype.h> >+#include <pango/pango.h> >+#define PANGO_ENABLE_ENGINE 1 >+#include <pango/pangoft2.h> >+#include <pango/pangoxft.h> > > namespace WebCore { > >+static bool substituteWithForCurrentLocale(unsigned offset, unsigned length, const SimpleFontData* fontData, FT_Face face, GlyphPage* glyphPage, const char* feature) >+{ >+ >+ PangoLanguage* pangoLanguage = pango_language_get_default(); >+ int numberScript; >+ const PangoScript* scripts = pango_language_get_scripts(pangoLanguage, &numberScript); >+ if (!numberScript) >+ return false; >+ >+ PangoOTInfo* info = pango_ot_info_get(face); >+ >+ FcChar8* fontConfigFamilyName; >+ if (!fontData->platformData().m_pattern.get()) { >+ return false; >+ } >+ >+ FcPatternGetString(fontData->platformData().m_pattern.get(), FC_FAMILY, 0, &fontConfigFamilyName); >+ >+ PlatformRefPtr<PangoFontMap> pangoFontMap = pango_ft2_font_map_new(); >+ if (!pangoFontMap) >+ return false; >+ >+ PlatformRefPtr<PangoContext> pangoContext = pango_font_map_create_context(PANGO_FONT_MAP(pangoFontMap.get())); >+ if (!pangoContext) >+ return false; >+ >+ PangoFontDescription* pangoDescription = pango_font_description_from_string(reinterpret_cast<char*>(fontConfigFamilyName)); >+ if (!pangoDescription) >+ return false; >+ >+ PlatformRefPtr<PangoFont> pangoFont = pango_font_map_load_font(pangoFontMap.get(), pangoContext.get(), pangoDescription); >+ if (!pangoFont) { >+ pango_font_description_free(pangoDescription); >+ return false; >+ } >+ >+ PangoFcFont* fcFont = PANGO_FC_FONT(pangoFont.get()); >+ if (!fcFont) { >+ pango_font_description_free(pangoDescription); >+ return false; >+ } >+ >+ PangoOTBuffer* pangoBuffer = pango_ot_buffer_new(fcFont); >+ for (unsigned int i = 0; i < length; i++) >+ pango_ot_buffer_add_glyph(pangoBuffer, glyphPage->glyphAt(i), 0, 1); >+ >+ PlatformRefPtr<PangoOTRuleset> ruleset = pango_ot_ruleset_new_for(info, scripts[0], pangoLanguage); >+ gboolean foundFeature = >+ pango_ot_ruleset_maybe_add_feature(ruleset.get(), PANGO_OT_TABLE_GSUB, PANGO_OT_TAG_MAKE_FROM_STRING(feature), PANGO_OT_ALL_GLYPHS); >+ if (!foundFeature) { >+ pango_font_description_free(pangoDescription); >+ return false; >+ } >+ >+ pango_ot_ruleset_substitute(ruleset.get(), pangoBuffer); >+ >+ PangoOTGlyph* otGlyphs; >+ int glyphLength; >+ pango_ot_buffer_get_glyphs(pangoBuffer, &otGlyphs, &glyphLength); >+ for (int i = 0; i < glyphLength; i++) >+ glyphPage->setGlyphDataForIndex(offset + i, otGlyphs[i].glyph, fontData); >+ pango_ot_buffer_destroy(pangoBuffer); >+ pango_font_description_free(pangoDescription); >+ >+ return true; >+} >+ > bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData) > { > // The bufferLength will be greater than the glyph page size if the buffer has Unicode supplementary characters. >@@ -60,6 +132,11 @@ bool GlyphPage::fill(unsigned offset, un > } > } > >+ // if there is GSUB "locl" table, apply it >+ // FIXME: 1. I don't know how to avoid unnecessary checkings >+ // 2. how about using <lang> instead of locale >+ substituteWithForCurrentLocale(offset, length, fontData, face, this, "locl"); >+ > cairo_ft_scaled_font_unlock_face(fontData->platformData().scaledFont()); > > return haveGlyphs;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 37984
:
54046
|
71970
|
77714
|
77736
|
77739
|
77796
|
77994
|
77997
|
78101
|
78222
|
78501
|
439060
|
442519