Changeset 141291 in webkit
- Timestamp:
- Jan 30, 2013 11:39:35 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
- 7 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r141290 r141291 1 2013-01-30 Dominik Röttsches <dominik.rottsches@intel.com> 2 3 [HarfBuzz] Naming fixes after removing old HarfBuzz code 4 https://bugs.webkit.org/show_bug.cgi?id=108170 5 6 Reviewed by Tony Chang. 7 8 Since the old harfbuzz code is gone in r141241, it makes sense to get rid 9 of the now unnecessray NG suffix in a number of places. While at it, 10 I am also fixing some naming inconsistencies. 11 12 Renamed all occurences of HarfBuzzNG* to HarfBuzz*, 13 renamed lowercase variants of harfbuzz* in variable and function names to camel-case harfBuzz*, 14 moved files in platform/graphics/harfbuzz/ng/* one level up and removed ng folder. 15 Updated corresponding entries in Chromium, GTK and EFL build system files. 16 17 No new tests, no change in behavior. 18 19 * GNUmakefile.list.am: 20 * PlatformEfl.cmake: 21 * WebCore.gyp/WebCore.gyp: 22 * WebCore.gypi: 23 * platform/graphics/FontPlatformData.cpp: 24 * platform/graphics/FontPlatformData.h: 25 (WebCore): 26 (FontPlatformData): 27 * platform/graphics/cocoa/FontPlatformDataCocoa.mm: 28 (WebCore::FontPlatformData::platformDataInit): 29 (WebCore::FontPlatformData::platformDataAssign): 30 (WebCore::FontPlatformData::harfBuzzFace): 31 * platform/graphics/freetype/FontPlatformData.h: 32 (FontPlatformData): 33 * platform/graphics/freetype/FontPlatformDataFreeType.cpp: 34 (WebCore::FontPlatformData::operator=): 35 (WebCore::FontPlatformData::FontPlatformData): 36 (WebCore::FontPlatformData::harfBuzzFace): 37 * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp: 38 (WebCore::FontPlatformData::FontPlatformData): 39 (WebCore::FontPlatformData::operator=): 40 (WebCore::FontPlatformData::harfBuzzFace): 41 * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h: 42 (WebCore): 43 (FontPlatformData): 44 * platform/graphics/harfbuzz/HarfBuzzFace.cpp: Renamed from Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFace.cpp. 45 (WebCore): 46 (FaceCacheEntry): 47 (WebCore::FaceCacheEntry::create): 48 (WebCore::FaceCacheEntry::~FaceCacheEntry): 49 (WebCore::FaceCacheEntry::face): 50 (WebCore::FaceCacheEntry::glyphCache): 51 (WebCore::FaceCacheEntry::FaceCacheEntry): 52 (WebCore::harfBuzzFaceCache): 53 (WebCore::HarfBuzzFace::HarfBuzzFace): 54 (WebCore::HarfBuzzFace::~HarfBuzzFace): 55 (WebCore::findScriptForVerticalGlyphSubstitution): 56 (WebCore::HarfBuzzFace::setScriptForVerticalGlyphSubstitution): 57 * platform/graphics/harfbuzz/HarfBuzzFace.h: Renamed from Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h. 58 (WebCore): 59 (HarfBuzzFace): 60 (WebCore::HarfBuzzFace::create): 61 * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: Renamed from Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCairo.cpp. 62 (WebCore): 63 (CairoFtFaceLocker): 64 (WebCore::CairoFtFaceLocker::CairoFtFaceLocker): 65 (WebCore::CairoFtFaceLocker::lock): 66 (WebCore::CairoFtFaceLocker::~CairoFtFaceLocker): 67 (WebCore::floatToHarfBuzzPosition): 68 (WebCore::doubleToHarfBuzzPosition): 69 (WebCore::CairoGetGlyphWidthAndExtents): 70 (WebCore::harfBuzzGetGlyph): 71 (WebCore::harfBuzzGetGlyphHorizontalAdvance): 72 (WebCore::harfBuzzGetGlyphHorizontalOrigin): 73 (WebCore::harfBuzzGetGlyphExtents): 74 (WebCore::harfBuzzCairoTextGetFontFuncs): 75 (WebCore::harfBuzzCairoGetTable): 76 (WebCore::HarfBuzzFace::createFace): 77 (WebCore::HarfBuzzFace::createFont): 78 (WebCore::HarfBuzzShaper::createGlyphBufferAdvance): 79 * platform/graphics/harfbuzz/HarfBuzzFaceCoreText.cpp: Renamed from Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCoreText.cpp. 80 (WebCore): 81 (WebCore::floatToHarfBuzzPosition): 82 (WebCore::getGlyph): 83 (WebCore::getGlyphHorizontalAdvance): 84 (WebCore::getGlyphHorizontalOrigin): 85 (WebCore::getGlyphExtents): 86 (WebCore::harfbuzzCoreTextGetFontFuncs): 87 (WebCore::releaseTableData): 88 (WebCore::harfBuzzCoreTextGetTable): 89 (WebCore::HarfBuzzFace::createFace): 90 (WebCore::HarfBuzzFace::createFont): 91 (WebCore::HarfBuzzShaper::createGlyphBufferAdvance): 92 * platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp: Renamed from Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzNGFaceSkia.cpp. 93 (WebCore): 94 (WebCore::HarfBuzzFontData::HarfBuzzFontData): 95 (HarfBuzzFontData): 96 (WebCore::SkiaScalarToHarfBuzzPosition): 97 (WebCore::SkiaGetGlyphWidthAndExtents): 98 (WebCore::harfBuzzGetGlyph): 99 (WebCore::harfBuzzGetGlyphHorizontalAdvance): 100 (WebCore::harfBuzzGetGlyphHorizontalOrigin): 101 (WebCore::harfBuzzGetGlyphExtents): 102 (WebCore::harfBuzzSkiaGetFontFuncs): 103 (WebCore::harfBuzzSkiaGetTable): Also fixed style checker whitespace complaint / indentation. 104 (WebCore::destroyHarfBuzzFontData): 105 (WebCore::HarfBuzzFace::createFace): 106 (WebCore::HarfBuzzFace::createFont): 107 (WebCore::HarfBuzzShaper::createGlyphBufferAdvance): 108 * platform/graphics/harfbuzz/HarfBuzzShaper.cpp: Renamed from Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp. 109 (WebCore): 110 (HarfBuzzScopedPtr): 111 (WebCore::HarfBuzzScopedPtr::HarfBuzzScopedPtr): 112 (WebCore::HarfBuzzScopedPtr::~HarfBuzzScopedPtr): 113 (WebCore::HarfBuzzScopedPtr::get): 114 (WebCore::harfBuzzPositionToFloat): 115 (WebCore::HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun): 116 (WebCore::HarfBuzzShaper::HarfBuzzRun::applyShapeResult): 117 (WebCore::HarfBuzzShaper::HarfBuzzRun::setGlyphAndPositions): 118 (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition): 119 (WebCore::HarfBuzzShaper::HarfBuzzRun::xPositionForOffset): 120 (WebCore::normalizeCharacters): 121 (WebCore::HarfBuzzShaper::HarfBuzzShaper): 122 (WebCore::HarfBuzzShaper::~HarfBuzzShaper): 123 (WebCore::HarfBuzzShaper::setDrawRange): 124 (WebCore::HarfBuzzShaper::setFontFeatures): 125 (WebCore::HarfBuzzShaper::shape): 126 (WebCore::HarfBuzzShaper::adjustStartPoint): 127 (WebCore::HarfBuzzShaper::collectHarfBuzzRuns): 128 (WebCore::HarfBuzzShaper::shapeHarfBuzzRuns): 129 (WebCore::HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun): 130 (WebCore::HarfBuzzShaper::fillGlyphBufferFromHarfBuzzRun): 131 (WebCore::HarfBuzzShaper::fillGlyphBuffer): 132 (WebCore::HarfBuzzShaper::offsetForPosition): 133 (WebCore::HarfBuzzShaper::selectionRect): 134 * platform/graphics/harfbuzz/HarfBuzzShaper.h: Renamed from Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h. 135 (WebCore): 136 (HarfBuzzShaper): 137 (WebCore::HarfBuzzShaper::totalWidth): 138 (HarfBuzzRun): 139 (WebCore::HarfBuzzShaper::HarfBuzzRun::create): 140 (WebCore::HarfBuzzShaper::HarfBuzzRun::setWidth): 141 (WebCore::HarfBuzzShaper::HarfBuzzRun::fontData): 142 (WebCore::HarfBuzzShaper::HarfBuzzRun::startIndex): 143 (WebCore::HarfBuzzShaper::HarfBuzzRun::numCharacters): 144 (WebCore::HarfBuzzShaper::HarfBuzzRun::numGlyphs): 145 (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphs): 146 (WebCore::HarfBuzzShaper::HarfBuzzRun::advances): 147 (WebCore::HarfBuzzShaper::HarfBuzzRun::offsets): 148 (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphToCharacterIndexes): 149 (WebCore::HarfBuzzShaper::HarfBuzzRun::width): 150 (WebCore::HarfBuzzShaper::HarfBuzzRun::rtl): 151 (WebCore::HarfBuzzShaper::HarfBuzzRun::script): 152 1 153 2013-01-30 Tony Chang <tony@chromium.org> 2 154 -
trunk/Source/WebCore/GNUmakefile.list.am
r141265 r141291 4239 4239 Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp \ 4240 4240 Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.h \ 4241 Source/WebCore/platform/graphics/harfbuzz/ ng/HarfBuzzNGFace.cpp \4242 Source/WebCore/platform/graphics/harfbuzz/ ng/HarfBuzzNGFace.h \4243 Source/WebCore/platform/graphics/harfbuzz/ ng/HarfBuzzNGFaceCairo.cpp \4244 Source/WebCore/platform/graphics/harfbuzz/ ng/HarfBuzzShaper.cpp \4245 Source/WebCore/platform/graphics/harfbuzz/ ng/HarfBuzzShaper.h \4241 Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.cpp \ 4242 Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.h \ 4243 Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp \ 4244 Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp \ 4245 Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h \ 4246 4246 Source/WebCore/plugins/npapi.h \ 4247 4247 Source/WebCore/plugins/npruntime.h \ -
trunk/Source/WebCore/PlatformEfl.cmake
r140518 r141291 128 128 129 129 platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp 130 platform/graphics/harfbuzz/ ng/HarfBuzzNGFaceCairo.cpp131 platform/graphics/harfbuzz/ ng/HarfBuzzNGFace.cpp132 platform/graphics/harfbuzz/ ng/HarfBuzzShaper.cpp130 platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp 131 platform/graphics/harfbuzz/HarfBuzzFace.cpp 132 platform/graphics/harfbuzz/HarfBuzzShaper.cpp 133 133 134 134 platform/graphics/surfaces/glx/GLXContext.cpp -
trunk/Source/WebCore/WebCore.gyp/WebCore.gyp
r141007 r141291 1716 1716 ['include', 'platform/graphics/harfbuzz/FontHarfBuzz\\.cpp$'], 1717 1717 ['include', 'platform/graphics/harfbuzz/FontPlatformDataHarfBuzz\\.cpp$'], 1718 ['include', 'platform/graphics/harfbuzz/HarfBuzzFace\\.(cpp|h)$'], 1719 ['include', 'platform/graphics/harfbuzz/HarfBuzzFaceSkia\\.cpp$'], 1720 ['include', 'platform/graphics/harfbuzz/HarfBuzzShaper\\.(cpp|h)$'], 1718 1721 ['include', 'platform/graphics/harfbuzz/HarfBuzzShaperBase\\.(cpp|h)$'], 1719 ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzNGFace\\.(cpp|h)$'],1720 ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzNGFaceSkia\\.cpp$'],1721 ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzShaper\\.(cpp|h)$'],1722 1722 ['include', 'platform/graphics/opentype/OpenTypeTypes\\.h$'], 1723 1723 ['include', 'platform/graphics/opentype/OpenTypeVerticalData\\.(cpp|h)$'], … … 1857 1857 ['exclude', 'platform/graphics/skia/SimpleFontDataSkia\\.cpp$'], 1858 1858 1859 # Mac uses Harfbuzz-ng. 1859 # Mac uses Harfbuzz. 1860 ['include', 'platform/graphics/harfbuzz/HarfBuzzFaceCoreText\\.cpp$'], 1861 ['include', 'platform/graphics/harfbuzz/HarfBuzzFace\\.(cpp|h)$'], 1862 ['include', 'platform/graphics/harfbuzz/HarfBuzzShaper\\.(cpp|h)$'], 1860 1863 ['include', 'platform/graphics/harfbuzz/HarfBuzzShaperBase\\.(cpp|h)$'], 1861 ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCoreText\\.cpp$'],1862 ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzNGFace\\.(cpp|h)$'],1863 ['include', 'platform/graphics/harfbuzz/ng/HarfBuzzShaper\\.(cpp|h)$'],1864 1864 ], 1865 1865 },{ # OS!="mac" -
trunk/Source/WebCore/WebCore.gypi
r141272 r141291 4044 4044 'platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp', 4045 4045 'platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h', 4046 'platform/graphics/harfbuzz/HarfBuzzFaceCoreText.cpp', 4047 'platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp', 4048 'platform/graphics/harfbuzz/HarfBuzzFace.cpp', 4049 'platform/graphics/harfbuzz/HarfBuzzFace.h', 4050 'platform/graphics/harfbuzz/HarfBuzzShaper.cpp', 4051 'platform/graphics/harfbuzz/HarfBuzzShaper.h', 4046 4052 'platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp', 4047 4053 'platform/graphics/harfbuzz/HarfBuzzShaperBase.h', 4048 'platform/graphics/harfbuzz/ng/HarfBuzzNGFaceCoreText.cpp',4049 'platform/graphics/harfbuzz/ng/HarfBuzzNGFaceSkia.cpp',4050 'platform/graphics/harfbuzz/ng/HarfBuzzNGFace.cpp',4051 'platform/graphics/harfbuzz/ng/HarfBuzzNGFace.h',4052 'platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp',4053 'platform/graphics/harfbuzz/ng/HarfBuzzShaper.h',4054 4054 'platform/graphics/mac/ColorMac.mm', 4055 4055 'platform/graphics/mac/ComplexTextController.cpp', -
trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp
r136520 r141291 29 29 30 30 #if PLATFORM(CHROMIUM) && OS(DARWIN) 31 #include "HarfBuzz NGFace.h"31 #include "HarfBuzzFace.h" 32 32 #endif 33 33 -
trunk/Source/WebCore/platform/graphics/FontPlatformData.h
r137263 r141291 91 91 92 92 #if PLATFORM(CHROMIUM) && OS(DARWIN) 93 class HarfBuzz NGFace;93 class HarfBuzzFace; 94 94 #endif 95 95 … … 165 165 166 166 #if PLATFORM(CHROMIUM) && OS(DARWIN) 167 HarfBuzz NGFace* harfbuzzFace();167 HarfBuzzFace* harfBuzzFace(); 168 168 #endif 169 169 … … 269 269 #if PLATFORM(CHROMIUM) && OS(DARWIN) 270 270 RefPtr<MemoryActivatedFont> m_inMemoryFont; 271 RefPtr<HarfBuzz NGFace> m_harfbuzzFace;271 RefPtr<HarfBuzzFace> m_harfBuzzFace; 272 272 #endif 273 273 -
trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
r136520 r141291 30 30 31 31 #if PLATFORM(CHROMIUM) && OS(DARWIN) 32 #import "HarfBuzz NGFace.h"32 #import "HarfBuzzFace.h" 33 33 #endif 34 34 … … 95 95 #if PLATFORM(CHROMIUM) && OS(DARWIN) 96 96 m_inMemoryFont = f.m_inMemoryFont; 97 m_harf buzzFace = f.m_harfbuzzFace;97 m_harfBuzzFace = f.m_harfBuzzFace; 98 98 #endif 99 99 } … … 112 112 #if PLATFORM(CHROMIUM) && OS(DARWIN) 113 113 m_inMemoryFont = f.m_inMemoryFont; 114 m_harf buzzFace = f.m_harfbuzzFace;114 m_harfBuzzFace = f.m_harfBuzzFace; 115 115 #endif 116 116 return *this; … … 310 310 } 311 311 312 HarfBuzz NGFace* FontPlatformData::harfbuzzFace()312 HarfBuzzFace* FontPlatformData::harfBuzzFace() 313 313 { 314 314 CTFontRef font = ctFont(); … … 317 317 return 0; 318 318 319 if (!m_harf buzzFace) {319 if (!m_harfBuzzFace) { 320 320 uint64_t uniqueID = reinterpret_cast<uintptr_t>(font); 321 m_harf buzzFace = HarfBuzzNGFace::create(const_cast<FontPlatformData*>(this), uniqueID);322 } 323 return m_harf buzzFace.get();321 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this), uniqueID); 322 } 323 return m_harfBuzzFace.get(); 324 324 } 325 325 #endif -
trunk/Source/WebCore/platform/graphics/freetype/FontPlatformData.h
r141241 r141291 30 30 #include "FontOrientation.h" 31 31 #include "GlyphBuffer.h" 32 #include "HarfBuzz NGFace.h"32 #include "HarfBuzzFace.h" 33 33 #include "RefPtrCairo.h" 34 34 #include <wtf/Forward.h> … … 36 36 37 37 typedef struct _FcFontSet FcFontSet; 38 class HarfBuzz NGFace;38 class HarfBuzzFace; 39 39 40 40 namespace WebCore { … … 66 66 ~FontPlatformData(); 67 67 68 HarfBuzz NGFace* harfbuzzFace() const;68 HarfBuzzFace* harfBuzzFace() const; 69 69 70 70 bool isFixedPitch(); … … 103 103 bool m_fixedWidth; 104 104 cairo_scaled_font_t* m_scaledFont; 105 mutable RefPtr<HarfBuzz NGFace> m_harfbuzzFace;105 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; 106 106 107 107 private: -
trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
r141241 r141291 192 192 m_scaledFont = cairo_scaled_font_reference(other.m_scaledFont); 193 193 194 m_harf buzzFace = other.m_harfbuzzFace;194 m_harfBuzzFace = other.m_harfBuzzFace; 195 195 196 196 return *this; … … 200 200 : m_fallbacks(0) 201 201 , m_scaledFont(0) 202 , m_harf buzzFace(other.m_harfbuzzFace)202 , m_harfBuzzFace(other.m_harfBuzzFace) 203 203 { 204 204 *this = other; … … 206 206 207 207 FontPlatformData::FontPlatformData(const FontPlatformData& other, float size) 208 : m_harf buzzFace(other.m_harfbuzzFace)208 : m_harfBuzzFace(other.m_harfBuzzFace) 209 209 { 210 210 *this = other; … … 227 227 } 228 228 229 HarfBuzz NGFace* FontPlatformData::harfbuzzFace() const230 { 231 if (!m_harf buzzFace)232 m_harf buzzFace = HarfBuzzNGFace::create(const_cast<FontPlatformData*>(this), hash());233 234 return m_harf buzzFace.get();229 HarfBuzzFace* FontPlatformData::harfBuzzFace() const 230 { 231 if (!m_harfBuzzFace) 232 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this), hash()); 233 234 return m_harfBuzzFace.get(); 235 235 } 236 236 -
trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp
r141241 r141291 33 33 34 34 #include "FontCache.h" 35 #include "HarfBuzz NGFace.h"35 #include "HarfBuzzFace.h" 36 36 #include "NotImplemented.h" 37 37 #include "SkAdvancedTypefaceMetrics.h" … … 125 125 , m_orientation(src.m_orientation) 126 126 , m_style(src.m_style) 127 , m_harf buzzFace(src.m_harfbuzzFace)127 , m_harfBuzzFace(src.m_harfBuzzFace) 128 128 { 129 129 SkSafeRef(m_typeface); … … 151 151 , m_fakeItalic(src.m_fakeItalic) 152 152 , m_orientation(src.m_orientation) 153 , m_harf buzzFace(src.m_harfbuzzFace)153 , m_harfBuzzFace(src.m_harfBuzzFace) 154 154 { 155 155 SkSafeRef(m_typeface); … … 189 189 m_fakeBold = src.m_fakeBold; 190 190 m_fakeItalic = src.m_fakeItalic; 191 m_harf buzzFace = src.m_harfbuzzFace;191 m_harfBuzzFace = src.m_harfBuzzFace; 192 192 m_orientation = src.m_orientation; 193 193 m_style = src.m_style; … … 269 269 } 270 270 271 HarfBuzz NGFace* FontPlatformData::harfbuzzFace() const272 { 273 if (!m_harf buzzFace)274 m_harf buzzFace = HarfBuzzNGFace::create(const_cast<FontPlatformData*>(this), uniqueID());275 276 return m_harf buzzFace.get();271 HarfBuzzFace* FontPlatformData::harfBuzzFace() const 272 { 273 if (!m_harfBuzzFace) 274 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this), uniqueID()); 275 276 return m_harfBuzzFace.get(); 277 277 } 278 278 -
trunk/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h
r141241 r141291 48 48 49 49 class FontDescription; 50 class HarfBuzz NGFace;50 class HarfBuzzFace; 51 51 52 52 // ----------------------------------------------------------------------------- … … 108 108 #endif 109 109 110 HarfBuzz NGFace* harfbuzzFace() const;110 HarfBuzzFace* harfBuzzFace() const; 111 111 112 112 // The returned styles are all actual styles without FontRenderStyle::NoPreference. … … 136 136 FontOrientation m_orientation; 137 137 FontRenderStyle m_style; 138 mutable RefPtr<HarfBuzz NGFace> m_harfbuzzFace;138 mutable RefPtr<HarfBuzzFace> m_harfBuzzFace; 139 139 140 140 SkTypeface* hashTableDeletedFontValue() const { return reinterpret_cast<SkTypeface*>(-1); } -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.cpp
r141290 r141291 30 30 31 31 #include "config.h" 32 #include "HarfBuzz NGFace.h"32 #include "HarfBuzzFace.h" 33 33 34 34 #include "FontPlatformData.h" … … 38 38 namespace WebCore { 39 39 40 const hb_tag_t HarfBuzz NGFace::vertTag = HB_TAG('v', 'e', 'r', 't');41 const hb_tag_t HarfBuzz NGFace::vrt2Tag = HB_TAG('v', 'r', 't', '2');40 const hb_tag_t HarfBuzzFace::vertTag = HB_TAG('v', 'e', 'r', 't'); 41 const hb_tag_t HarfBuzzFace::vrt2Tag = HB_TAG('v', 'r', 't', '2'); 42 42 43 43 // Though we have FontCache class, which provides the cache mechanism for … … 70 70 }; 71 71 72 typedef HashMap<uint64_t, RefPtr<FaceCacheEntry>, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t> > HarfBuzz NGFaceCache;72 typedef HashMap<uint64_t, RefPtr<FaceCacheEntry>, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t> > HarfBuzzFaceCache; 73 73 74 static HarfBuzz NGFaceCache* harfbuzzFaceCache()74 static HarfBuzzFaceCache* harfBuzzFaceCache() 75 75 { 76 DEFINE_STATIC_LOCAL(HarfBuzz NGFaceCache, s_harfbuzzFaceCache, ());77 return &s_harf buzzFaceCache;76 DEFINE_STATIC_LOCAL(HarfBuzzFaceCache, s_harfBuzzFaceCache, ()); 77 return &s_harfBuzzFaceCache; 78 78 } 79 79 80 HarfBuzz NGFace::HarfBuzzNGFace(FontPlatformData* platformData, uint64_t uniqueID)80 HarfBuzzFace::HarfBuzzFace(FontPlatformData* platformData, uint64_t uniqueID) 81 81 : m_platformData(platformData) 82 82 , m_uniqueID(uniqueID) 83 83 , m_scriptForVerticalText(HB_SCRIPT_INVALID) 84 84 { 85 HarfBuzz NGFaceCache::AddResult result = harfbuzzFaceCache()->add(m_uniqueID, 0);85 HarfBuzzFaceCache::AddResult result = harfBuzzFaceCache()->add(m_uniqueID, 0); 86 86 if (result.isNewEntry) 87 87 result.iterator->value = FaceCacheEntry::create(createFace()); … … 91 91 } 92 92 93 HarfBuzz NGFace::~HarfBuzzNGFace()93 HarfBuzzFace::~HarfBuzzFace() 94 94 { 95 HarfBuzz NGFaceCache::iterator result = harfbuzzFaceCache()->find(m_uniqueID);96 ASSERT(result != harf buzzFaceCache()->end());95 HarfBuzzFaceCache::iterator result = harfBuzzFaceCache()->find(m_uniqueID); 96 ASSERT(result != harfBuzzFaceCache()->end()); 97 97 ASSERT(result.get()->value->refCount() > 1); 98 98 result.get()->value->deref(); 99 99 if (result.get()->value->refCount() == 1) 100 harf buzzFaceCache()->remove(m_uniqueID);100 harfBuzzFaceCache()->remove(m_uniqueID); 101 101 } 102 102 … … 114 114 for (unsigned languageIndex = 0; languageIndex < languageCount; ++languageIndex) { 115 115 unsigned featureIndex; 116 if (hb_ot_layout_language_find_feature(face, HB_OT_TAG_GSUB, scriptIndex, languageIndex, HarfBuzz NGFace::vertTag, &featureIndex)117 || hb_ot_layout_language_find_feature(face, HB_OT_TAG_GSUB, scriptIndex, languageIndex, HarfBuzz NGFace::vrt2Tag, &featureIndex))116 if (hb_ot_layout_language_find_feature(face, HB_OT_TAG_GSUB, scriptIndex, languageIndex, HarfBuzzFace::vertTag, &featureIndex) 117 || hb_ot_layout_language_find_feature(face, HB_OT_TAG_GSUB, scriptIndex, languageIndex, HarfBuzzFace::vrt2Tag, &featureIndex)) 118 118 return hb_ot_tag_to_script(scriptTags[scriptIndex]); 119 119 } … … 122 122 } 123 123 124 void HarfBuzz NGFace::setScriptForVerticalGlyphSubstitution(hb_buffer_t* buffer)124 void HarfBuzzFace::setScriptForVerticalGlyphSubstitution(hb_buffer_t* buffer) 125 125 { 126 126 if (m_scriptForVerticalText == HB_SCRIPT_INVALID) -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFace.h
r141290 r141291 29 29 */ 30 30 31 #ifndef HarfBuzz NGFace_h32 #define HarfBuzz NGFace_h31 #ifndef HarfBuzzFace_h 32 #define HarfBuzzFace_h 33 33 34 34 #include <hb.h> … … 43 43 class FontPlatformData; 44 44 45 class HarfBuzz NGFace : public RefCounted<HarfBuzzNGFace> {45 class HarfBuzzFace : public RefCounted<HarfBuzzFace> { 46 46 public: 47 47 static const hb_tag_t vertTag; 48 48 static const hb_tag_t vrt2Tag; 49 49 50 static PassRefPtr<HarfBuzz NGFace> create(FontPlatformData* platformData, uint64_t uniqueID)50 static PassRefPtr<HarfBuzzFace> create(FontPlatformData* platformData, uint64_t uniqueID) 51 51 { 52 return adoptRef(new HarfBuzz NGFace(platformData, uniqueID));52 return adoptRef(new HarfBuzzFace(platformData, uniqueID)); 53 53 } 54 ~HarfBuzz NGFace();54 ~HarfBuzzFace(); 55 55 56 56 hb_font_t* createFont(); … … 59 59 60 60 private: 61 HarfBuzz NGFace(FontPlatformData*, uint64_t);61 HarfBuzzFace(FontPlatformData*, uint64_t); 62 62 63 63 hb_face_t* createFace(); … … 73 73 } 74 74 75 #endif // HarfBuzz NGFace_h75 #endif // HarfBuzzFace_h -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp
r141290 r141291 31 31 32 32 #include "config.h" 33 #include "HarfBuzz NGFace.h"33 #include "HarfBuzzFace.h" 34 34 35 35 #include "FontPlatformData.h" … … 91 91 } 92 92 93 static hb_bool_t harf buzzGetGlyph(hb_font_t*, void* fontData, hb_codepoint_t unicode, hb_codepoint_t, hb_codepoint_t* glyph, void*)93 static hb_bool_t harfBuzzGetGlyph(hb_font_t*, void* fontData, hb_codepoint_t unicode, hb_codepoint_t, hb_codepoint_t* glyph, void*) 94 94 { 95 95 FontPlatformData* platformData = reinterpret_cast<FontPlatformData*>(fontData); … … 109 109 } 110 110 111 static hb_position_t harf buzzGetGlyphHorizontalAdvance(hb_font_t*, void* fontData, hb_codepoint_t glyph, void*)111 static hb_position_t harfBuzzGetGlyphHorizontalAdvance(hb_font_t*, void* fontData, hb_codepoint_t glyph, void*) 112 112 { 113 113 FontPlatformData* platformData = reinterpret_cast<FontPlatformData*>(fontData); … … 120 120 } 121 121 122 static hb_bool_t harf buzzGetGlyphHorizontalOrigin(hb_font_t*, void*, hb_codepoint_t, hb_position_t*, hb_position_t*, void*)122 static hb_bool_t harfBuzzGetGlyphHorizontalOrigin(hb_font_t*, void*, hb_codepoint_t, hb_position_t*, hb_position_t*, void*) 123 123 { 124 124 // Just return true, following the way that Harfbuzz-FreeType … … 127 127 } 128 128 129 static hb_bool_t harf buzzGetGlyphExtents(hb_font_t*, void* fontData, hb_codepoint_t glyph, hb_glyph_extents_t* extents, void*)129 static hb_bool_t harfBuzzGetGlyphExtents(hb_font_t*, void* fontData, hb_codepoint_t glyph, hb_glyph_extents_t* extents, void*) 130 130 { 131 131 FontPlatformData* platformData = reinterpret_cast<FontPlatformData*>(fontData); … … 137 137 } 138 138 139 static hb_font_funcs_t* harf buzzCairoTextGetFontFuncs()140 { 141 static hb_font_funcs_t* harf buzzCairoFontFuncs = 0;139 static hb_font_funcs_t* harfBuzzCairoTextGetFontFuncs() 140 { 141 static hb_font_funcs_t* harfBuzzCairoFontFuncs = 0; 142 142 143 143 // We don't set callback functions which we can't support. 144 144 // Harfbuzz will use the fallback implementation if they aren't set. 145 if (!harf buzzCairoFontFuncs) {146 harf buzzCairoFontFuncs = hb_font_funcs_create();147 hb_font_funcs_set_glyph_func(harf buzzCairoFontFuncs, harfbuzzGetGlyph, 0, 0);148 hb_font_funcs_set_glyph_h_advance_func(harf buzzCairoFontFuncs, harfbuzzGetGlyphHorizontalAdvance, 0, 0);149 hb_font_funcs_set_glyph_h_origin_func(harf buzzCairoFontFuncs, harfbuzzGetGlyphHorizontalOrigin, 0, 0);150 hb_font_funcs_set_glyph_extents_func(harf buzzCairoFontFuncs, harfbuzzGetGlyphExtents, 0, 0);151 hb_font_funcs_make_immutable(harf buzzCairoFontFuncs);152 } 153 return harf buzzCairoFontFuncs;154 } 155 156 static hb_blob_t* harf buzzCairoGetTable(hb_face_t*, hb_tag_t tag, void* userData)145 if (!harfBuzzCairoFontFuncs) { 146 harfBuzzCairoFontFuncs = hb_font_funcs_create(); 147 hb_font_funcs_set_glyph_func(harfBuzzCairoFontFuncs, harfBuzzGetGlyph, 0, 0); 148 hb_font_funcs_set_glyph_h_advance_func(harfBuzzCairoFontFuncs, harfBuzzGetGlyphHorizontalAdvance, 0, 0); 149 hb_font_funcs_set_glyph_h_origin_func(harfBuzzCairoFontFuncs, harfBuzzGetGlyphHorizontalOrigin, 0, 0); 150 hb_font_funcs_set_glyph_extents_func(harfBuzzCairoFontFuncs, harfBuzzGetGlyphExtents, 0, 0); 151 hb_font_funcs_make_immutable(harfBuzzCairoFontFuncs); 152 } 153 return harfBuzzCairoFontFuncs; 154 } 155 156 static hb_blob_t* harfBuzzCairoGetTable(hb_face_t*, hb_tag_t tag, void* userData) 157 157 { 158 158 cairo_scaled_font_t* scaledFont = reinterpret_cast<cairo_scaled_font_t*>(userData); … … 183 183 } 184 184 185 hb_face_t* HarfBuzz NGFace::createFace()186 { 187 hb_face_t* face = hb_face_create_for_tables(harf buzzCairoGetTable, m_platformData->scaledFont(), 0);185 hb_face_t* HarfBuzzFace::createFace() 186 { 187 hb_face_t* face = hb_face_create_for_tables(harfBuzzCairoGetTable, m_platformData->scaledFont(), 0); 188 188 ASSERT(face); 189 189 return face; 190 190 } 191 191 192 hb_font_t* HarfBuzz NGFace::createFont()192 hb_font_t* HarfBuzzFace::createFont() 193 193 { 194 194 hb_font_t* font = hb_font_create(m_face); 195 hb_font_set_funcs(font, harf buzzCairoTextGetFontFuncs(), m_platformData, 0);195 hb_font_set_funcs(font, harfBuzzCairoTextGetFontFuncs(), m_platformData, 0); 196 196 const float size = m_platformData->size(); 197 197 if (floorf(size) == size) -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCoreText.cpp
r141290 r141291 30 30 31 31 #include "config.h" 32 #include "HarfBuzz NGFace.h"32 #include "HarfBuzzFace.h" 33 33 34 34 #include "FontPlatformData.h" … … 88 88 static hb_font_funcs_t* harfbuzzCoreTextGetFontFuncs() 89 89 { 90 static hb_font_funcs_t* harf buzzCoreTextFontFuncs = 0;90 static hb_font_funcs_t* harfBuzzCoreTextFontFuncs = 0; 91 91 92 if (!harf buzzCoreTextFontFuncs) {93 harf buzzCoreTextFontFuncs = hb_font_funcs_create();94 hb_font_funcs_set_glyph_func(harf buzzCoreTextFontFuncs, getGlyph, 0, 0);95 hb_font_funcs_set_glyph_h_advance_func(harf buzzCoreTextFontFuncs, getGlyphHorizontalAdvance, 0, 0);96 hb_font_funcs_set_glyph_h_origin_func(harf buzzCoreTextFontFuncs, getGlyphHorizontalOrigin, 0, 0);97 hb_font_funcs_set_glyph_extents_func(harf buzzCoreTextFontFuncs, getGlyphExtents, 0, 0);98 hb_font_funcs_make_immutable(harf buzzCoreTextFontFuncs);92 if (!harfBuzzCoreTextFontFuncs) { 93 harfBuzzCoreTextFontFuncs = hb_font_funcs_create(); 94 hb_font_funcs_set_glyph_func(harfBuzzCoreTextFontFuncs, getGlyph, 0, 0); 95 hb_font_funcs_set_glyph_h_advance_func(harfBuzzCoreTextFontFuncs, getGlyphHorizontalAdvance, 0, 0); 96 hb_font_funcs_set_glyph_h_origin_func(harfBuzzCoreTextFontFuncs, getGlyphHorizontalOrigin, 0, 0); 97 hb_font_funcs_set_glyph_extents_func(harfBuzzCoreTextFontFuncs, getGlyphExtents, 0, 0); 98 hb_font_funcs_make_immutable(harfBuzzCoreTextFontFuncs); 99 99 } 100 return harf buzzCoreTextFontFuncs;100 return harfBuzzCoreTextFontFuncs; 101 101 } 102 102 … … 107 107 } 108 108 109 static hb_blob_t* harf buzzCoreTextGetTable(hb_face_t* face, hb_tag_t tag, void* userData)109 static hb_blob_t* harfBuzzCoreTextGetTable(hb_face_t* face, hb_tag_t tag, void* userData) 110 110 { 111 111 CGFontRef cgFont = reinterpret_cast<CGFontRef>(userData); … … 121 121 } 122 122 123 hb_face_t* HarfBuzz NGFace::createFace()123 hb_face_t* HarfBuzzFace::createFace() 124 124 { 125 125 // It seems that CTFontCopyTable of MacOSX10.5 sdk doesn't work for 126 126 // OpenType layout tables(GDEF, GSUB, GPOS). Use CGFontCopyTableForTag instead. 127 hb_face_t* face = hb_face_create_for_tables(harf buzzCoreTextGetTable, m_platformData->cgFont(), 0);127 hb_face_t* face = hb_face_create_for_tables(harfBuzzCoreTextGetTable, m_platformData->cgFont(), 0); 128 128 ASSERT(face); 129 129 return face; 130 130 } 131 131 132 hb_font_t* HarfBuzz NGFace::createFont()132 hb_font_t* HarfBuzzFace::createFont() 133 133 { 134 134 hb_font_t* font = hb_font_create(m_face); 135 hb_font_set_funcs(font, harf buzzCoreTextGetFontFuncs(), m_platformData, 0);135 hb_font_set_funcs(font, harfBuzzCoreTextGetFontFuncs(), m_platformData, 0); 136 136 const float size = m_platformData->m_size; 137 137 hb_font_set_ppem(font, size, size); -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceSkia.cpp
r141290 r141291 30 30 31 31 #include "config.h" 32 #include "HarfBuzz NGFace.h"32 #include "HarfBuzzFace.h" 33 33 34 34 #include "FontPlatformData.h" … … 48 48 namespace WebCore { 49 49 50 // Our implementation of the callbacks which Harf buzz requires by using Skia51 // calls. See the Harf buzz source for references about what these callbacks do.50 // Our implementation of the callbacks which HarfBuzz requires by using Skia 51 // calls. See the HarfBuzz source for references about what these callbacks do. 52 52 53 53 struct HarfBuzzFontData { … … 59 59 }; 60 60 61 static hb_position_t SkiaScalarToHarf buzzPosition(SkScalar value)61 static hb_position_t SkiaScalarToHarfBuzzPosition(SkScalar value) 62 62 { 63 63 return SkScalarToFixed(value); … … 75 75 paint->getTextWidths(&glyph, sizeof(glyph), &skWidth, &skBounds); 76 76 if (width) 77 *width = SkiaScalarToHarf buzzPosition(skWidth);77 *width = SkiaScalarToHarfBuzzPosition(skWidth); 78 78 if (extents) { 79 // Invert y-axis because Skia is y-grows-down but we set up harfbuzz to be y-grows-up.80 extents->x_bearing = SkiaScalarToHarf buzzPosition(skBounds.fLeft);81 extents->y_bearing = SkiaScalarToHarf buzzPosition(-skBounds.fTop);82 extents->width = SkiaScalarToHarf buzzPosition(skBounds.width());83 extents->height = SkiaScalarToHarf buzzPosition(-skBounds.height());79 // Invert y-axis because Skia is y-grows-down but we set up HarfBuzz to be y-grows-up. 80 extents->x_bearing = SkiaScalarToHarfBuzzPosition(skBounds.fLeft); 81 extents->y_bearing = SkiaScalarToHarfBuzzPosition(-skBounds.fTop); 82 extents->width = SkiaScalarToHarfBuzzPosition(skBounds.width()); 83 extents->height = SkiaScalarToHarfBuzzPosition(-skBounds.height()); 84 84 } 85 85 } 86 86 87 static hb_bool_t harf buzzGetGlyph(hb_font_t* hbFont, void* fontData, hb_codepoint_t unicode, hb_codepoint_t variationSelector, hb_codepoint_t* glyph, void* userData)87 static hb_bool_t harfBuzzGetGlyph(hb_font_t* hbFont, void* fontData, hb_codepoint_t unicode, hb_codepoint_t variationSelector, hb_codepoint_t* glyph, void* userData) 88 88 { 89 89 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData); … … 102 102 } 103 103 104 static hb_position_t harf buzzGetGlyphHorizontalAdvance(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, void* userData)104 static hb_position_t harfBuzzGetGlyphHorizontalAdvance(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, void* userData) 105 105 { 106 106 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData); … … 111 111 } 112 112 113 static hb_bool_t harf buzzGetGlyphHorizontalOrigin(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_position_t* x, hb_position_t* y, void* userData)113 static hb_bool_t harfBuzzGetGlyphHorizontalOrigin(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_position_t* x, hb_position_t* y, void* userData) 114 114 { 115 // Just return true, following the way that Harf buzz-FreeType115 // Just return true, following the way that HarfBuzz-FreeType 116 116 // implementation does. 117 117 return true; 118 118 } 119 119 120 static hb_bool_t harf buzzGetGlyphExtents(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_glyph_extents_t* extents, void* userData)120 static hb_bool_t harfBuzzGetGlyphExtents(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_glyph_extents_t* extents, void* userData) 121 121 { 122 122 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData); … … 126 126 } 127 127 128 static hb_font_funcs_t* harf buzzSkiaGetFontFuncs()128 static hb_font_funcs_t* harfBuzzSkiaGetFontFuncs() 129 129 { 130 static hb_font_funcs_t* harf buzzSkiaFontFuncs = 0;130 static hb_font_funcs_t* harfBuzzSkiaFontFuncs = 0; 131 131 132 132 // We don't set callback functions which we can't support. 133 // Harf buzz will use the fallback implementation if they aren't set.134 if (!harf buzzSkiaFontFuncs) {135 harf buzzSkiaFontFuncs = hb_font_funcs_create();136 hb_font_funcs_set_glyph_func(harf buzzSkiaFontFuncs, harfbuzzGetGlyph, 0, 0);137 hb_font_funcs_set_glyph_h_advance_func(harf buzzSkiaFontFuncs, harfbuzzGetGlyphHorizontalAdvance, 0, 0);138 hb_font_funcs_set_glyph_h_origin_func(harf buzzSkiaFontFuncs, harfbuzzGetGlyphHorizontalOrigin, 0, 0);139 hb_font_funcs_set_glyph_extents_func(harf buzzSkiaFontFuncs, harfbuzzGetGlyphExtents, 0, 0);140 hb_font_funcs_make_immutable(harf buzzSkiaFontFuncs);133 // HarfBuzz will use the fallback implementation if they aren't set. 134 if (!harfBuzzSkiaFontFuncs) { 135 harfBuzzSkiaFontFuncs = hb_font_funcs_create(); 136 hb_font_funcs_set_glyph_func(harfBuzzSkiaFontFuncs, harfBuzzGetGlyph, 0, 0); 137 hb_font_funcs_set_glyph_h_advance_func(harfBuzzSkiaFontFuncs, harfBuzzGetGlyphHorizontalAdvance, 0, 0); 138 hb_font_funcs_set_glyph_h_origin_func(harfBuzzSkiaFontFuncs, harfBuzzGetGlyphHorizontalOrigin, 0, 0); 139 hb_font_funcs_set_glyph_extents_func(harfBuzzSkiaFontFuncs, harfBuzzGetGlyphExtents, 0, 0); 140 hb_font_funcs_make_immutable(harfBuzzSkiaFontFuncs); 141 141 } 142 return harf buzzSkiaFontFuncs;142 return harfBuzzSkiaFontFuncs; 143 143 } 144 144 145 static hb_blob_t* harf buzzSkiaGetTable(hb_face_t* face, hb_tag_t tag, void* userData)145 static hb_blob_t* harfBuzzSkiaGetTable(hb_face_t* face, hb_tag_t tag, void* userData) 146 146 { 147 147 SkFontID uniqueID = static_cast<SkFontID>(reinterpret_cast<uint64_t>(userData)); … … 160 160 } 161 161 162 return hb_blob_create(const_cast<char*>(buffer), tableSize, 163 HB_MEMORY_MODE_WRITABLE, buffer, fastFree); 162 return hb_blob_create(const_cast<char*>(buffer), tableSize, HB_MEMORY_MODE_WRITABLE, buffer, fastFree); 164 163 } 165 164 … … 170 169 } 171 170 172 hb_face_t* HarfBuzz NGFace::createFace()171 hb_face_t* HarfBuzzFace::createFace() 173 172 { 174 hb_face_t* face = hb_face_create_for_tables(harf buzzSkiaGetTable, reinterpret_cast<void*>(m_platformData->uniqueID()), 0);173 hb_face_t* face = hb_face_create_for_tables(harfBuzzSkiaGetTable, reinterpret_cast<void*>(m_platformData->uniqueID()), 0); 175 174 ASSERT(face); 176 175 return face; 177 176 } 178 177 179 hb_font_t* HarfBuzz NGFace::createFont()178 hb_font_t* HarfBuzzFace::createFont() 180 179 { 181 180 HarfBuzzFontData* hbFontData = new HarfBuzzFontData(m_glyphCacheForFaceCacheEntry); 182 181 m_platformData->setupPaint(&hbFontData->m_paint); 183 182 hb_font_t* font = hb_font_create(m_face); 184 hb_font_set_funcs(font, harf buzzSkiaGetFontFuncs(), hbFontData, destroyHarfBuzzFontData);183 hb_font_set_funcs(font, harfBuzzSkiaGetFontFuncs(), hbFontData, destroyHarfBuzzFontData); 185 184 float size = m_platformData->size(); 186 int scale = SkiaScalarToHarf buzzPosition(size);185 int scale = SkiaScalarToHarfBuzzPosition(size); 187 186 hb_font_set_scale(font, scale, scale); 188 187 hb_font_make_immutable(font); -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp
r141290 r141291 33 33 34 34 #include "Font.h" 35 #include "HarfBuzz NGFace.h"35 #include "HarfBuzzFace.h" 36 36 #include "SurrogatePairAwareTextIterator.h" 37 37 #include "TextRun.h" … … 68 68 }; 69 69 70 static inline float harf buzzPositionToFloat(hb_position_t value)70 static inline float harfBuzzPositionToFloat(hb_position_t value) 71 71 { 72 72 return static_cast<float>(value) / (1 << 16); … … 82 82 } 83 83 84 void HarfBuzzShaper::HarfBuzzRun::applyShapeResult(hb_buffer_t* harf buzzBuffer)85 { 86 m_numGlyphs = hb_buffer_get_length(harf buzzBuffer);84 void HarfBuzzShaper::HarfBuzzRun::applyShapeResult(hb_buffer_t* harfBuzzBuffer) 85 { 86 m_numGlyphs = hb_buffer_get_length(harfBuzzBuffer); 87 87 m_glyphs.resize(m_numGlyphs); 88 88 m_advances.resize(m_numGlyphs); … … 204 204 const FontDescription& description = m_font->fontDescription(); 205 205 if (description.orientation() == Vertical) { 206 static hb_feature_t vert = { HarfBuzz NGFace::vertTag, 1, 0, static_cast<unsigned>(-1) };207 static hb_feature_t vrt2 = { HarfBuzz NGFace::vrt2Tag, 1, 0, static_cast<unsigned>(-1) };206 static hb_feature_t vert = { HarfBuzzFace::vertTag, 1, 0, static_cast<unsigned>(-1) }; 207 static hb_feature_t vrt2 = { HarfBuzzFace::vrt2Tag, 1, 0, static_cast<unsigned>(-1) }; 208 208 m_features.append(vert); 209 209 m_features.append(vrt2); … … 306 306 unsigned numCharactersOfCurrentRun = iterator.currentCharacter() - startIndexOfCurrentRun; 307 307 hb_script_t script = hb_icu_script_to_script(currentScript); 308 m_harf buzzRuns.append(HarfBuzzRun::create(currentFontData, startIndexOfCurrentRun, numCharactersOfCurrentRun, m_run.direction(), script));308 m_harfBuzzRuns.append(HarfBuzzRun::create(currentFontData, startIndexOfCurrentRun, numCharactersOfCurrentRun, m_run.direction(), script)); 309 309 currentFontData = nextFontData; 310 310 startIndexOfCurrentRun = iterator.currentCharacter(); 311 311 } while (iterator.consume(character, clusterLength)); 312 312 313 return !m_harf buzzRuns.isEmpty();313 return !m_harfBuzzRuns.isEmpty(); 314 314 } 315 315 316 316 bool HarfBuzzShaper::shapeHarfBuzzRuns(bool shouldSetDirection) 317 317 { 318 HarfBuzzScopedPtr<hb_buffer_t> harf buzzBuffer(hb_buffer_create(), hb_buffer_destroy);319 320 hb_buffer_set_unicode_funcs(harf buzzBuffer.get(), hb_icu_get_unicode_funcs());321 322 for (unsigned i = 0; i < m_harf buzzRuns.size(); ++i) {323 unsigned runIndex = m_run.rtl() ? m_harf buzzRuns.size() - i - 1 : i;324 HarfBuzzRun* currentRun = m_harf buzzRuns[runIndex].get();318 HarfBuzzScopedPtr<hb_buffer_t> harfBuzzBuffer(hb_buffer_create(), hb_buffer_destroy); 319 320 hb_buffer_set_unicode_funcs(harfBuzzBuffer.get(), hb_icu_get_unicode_funcs()); 321 322 for (unsigned i = 0; i < m_harfBuzzRuns.size(); ++i) { 323 unsigned runIndex = m_run.rtl() ? m_harfBuzzRuns.size() - i - 1 : i; 324 HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get(); 325 325 const SimpleFontData* currentFontData = currentRun->fontData(); 326 326 327 hb_buffer_set_script(harf buzzBuffer.get(), currentRun->script());327 hb_buffer_set_script(harfBuzzBuffer.get(), currentRun->script()); 328 328 if (shouldSetDirection) 329 hb_buffer_set_direction(harf buzzBuffer.get(), currentRun->rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);329 hb_buffer_set_direction(harfBuzzBuffer.get(), currentRun->rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR); 330 330 331 331 // Add a space as pre-context to the buffer. This prevents showing dotted-circle 332 332 // for combining marks at the beginning of runs. 333 333 static const uint16_t preContext = ' '; 334 hb_buffer_add_utf16(harf buzzBuffer.get(), &preContext, 1, 1, 0);334 hb_buffer_add_utf16(harfBuzzBuffer.get(), &preContext, 1, 1, 0); 335 335 336 336 if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->startIndex()])) { … … 338 338 upperText.makeUpper(); 339 339 currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData; 340 hb_buffer_add_utf16(harf buzzBuffer.get(), upperText.characters(), currentRun->numCharacters(), 0, currentRun->numCharacters());340 hb_buffer_add_utf16(harfBuzzBuffer.get(), upperText.characters(), currentRun->numCharacters(), 0, currentRun->numCharacters()); 341 341 } else 342 hb_buffer_add_utf16(harf buzzBuffer.get(), m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters(), 0, currentRun->numCharacters());342 hb_buffer_add_utf16(harfBuzzBuffer.get(), m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters(), 0, currentRun->numCharacters()); 343 343 344 344 FontPlatformData* platformData = const_cast<FontPlatformData*>(¤tFontData->platformData()); 345 HarfBuzz NGFace* face = platformData->harfbuzzFace();345 HarfBuzzFace* face = platformData->harfBuzzFace(); 346 346 if (!face) 347 347 return false; 348 348 349 349 if (m_font->fontDescription().orientation() == Vertical) 350 face->setScriptForVerticalGlyphSubstitution(harf buzzBuffer.get());351 352 HarfBuzzScopedPtr<hb_font_t> harf buzzFont(face->createFont(), hb_font_destroy);353 354 hb_shape(harf buzzFont.get(), harfbuzzBuffer.get(), m_features.isEmpty() ? 0 : m_features.data(), m_features.size());355 356 currentRun->applyShapeResult(harf buzzBuffer.get());357 setGlyphPositionsForHarfBuzzRun(currentRun, harf buzzBuffer.get());358 359 hb_buffer_reset(harf buzzBuffer.get());350 face->setScriptForVerticalGlyphSubstitution(harfBuzzBuffer.get()); 351 352 HarfBuzzScopedPtr<hb_font_t> harfBuzzFont(face->createFont(), hb_font_destroy); 353 354 hb_shape(harfBuzzFont.get(), harfBuzzBuffer.get(), m_features.isEmpty() ? 0 : m_features.data(), m_features.size()); 355 356 currentRun->applyShapeResult(harfBuzzBuffer.get()); 357 setGlyphPositionsForHarfBuzzRun(currentRun, harfBuzzBuffer.get()); 358 359 hb_buffer_reset(harfBuzzBuffer.get()); 360 360 } 361 361 … … 363 363 } 364 364 365 void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, hb_buffer_t* harf buzzBuffer)365 void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, hb_buffer_t* harfBuzzBuffer) 366 366 { 367 367 const SimpleFontData* currentFontData = currentRun->fontData(); 368 hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(harf buzzBuffer, 0);369 hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(harf buzzBuffer, 0);368 hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(harfBuzzBuffer, 0); 369 hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(harfBuzzBuffer, 0); 370 370 371 371 unsigned numGlyphs = currentRun->numGlyphs(); … … 377 377 bool runEnd = i + 1 == numGlyphs; 378 378 uint16_t glyph = glyphInfos[i].codepoint; 379 float offsetX = harf buzzPositionToFloat(glyphPositions[i].x_offset);380 float offsetY = -harf buzzPositionToFloat(glyphPositions[i].y_offset);381 float advance = harf buzzPositionToFloat(glyphPositions[i].x_advance);379 float offsetX = harfBuzzPositionToFloat(glyphPositions[i].x_offset); 380 float offsetY = -harfBuzzPositionToFloat(glyphPositions[i].y_offset); 381 float advance = harfBuzzPositionToFloat(glyphPositions[i].x_advance); 382 382 383 383 unsigned currentCharacterIndex = currentRun->startIndex() + glyphInfos[i].cluster; … … 444 444 bool HarfBuzzShaper::fillGlyphBuffer(GlyphBuffer* glyphBuffer) 445 445 { 446 unsigned numRuns = m_harf buzzRuns.size();446 unsigned numRuns = m_harfBuzzRuns.size(); 447 447 if (m_run.rtl()) { 448 m_startOffset = m_harf buzzRuns.last()->offsets()[0];448 m_startOffset = m_harfBuzzRuns.last()->offsets()[0]; 449 449 for (int runIndex = numRuns - 1; runIndex >= 0; --runIndex) { 450 HarfBuzzRun* currentRun = m_harf buzzRuns[runIndex].get();451 FloatPoint firstOffsetOfNextRun = !runIndex ? FloatPoint() : m_harf buzzRuns[runIndex - 1]->offsets()[0];450 HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get(); 451 FloatPoint firstOffsetOfNextRun = !runIndex ? FloatPoint() : m_harfBuzzRuns[runIndex - 1]->offsets()[0]; 452 452 fillGlyphBufferFromHarfBuzzRun(glyphBuffer, currentRun, firstOffsetOfNextRun); 453 453 } 454 454 } else { 455 m_startOffset = m_harf buzzRuns.first()->offsets()[0];455 m_startOffset = m_harfBuzzRuns.first()->offsets()[0]; 456 456 for (unsigned runIndex = 0; runIndex < numRuns; ++runIndex) { 457 HarfBuzzRun* currentRun = m_harf buzzRuns[runIndex].get();458 FloatPoint firstOffsetOfNextRun = runIndex == numRuns - 1 ? FloatPoint() : m_harf buzzRuns[runIndex + 1]->offsets()[0];457 HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get(); 458 FloatPoint firstOffsetOfNextRun = runIndex == numRuns - 1 ? FloatPoint() : m_harfBuzzRuns[runIndex + 1]->offsets()[0]; 459 459 fillGlyphBufferFromHarfBuzzRun(glyphBuffer, currentRun, firstOffsetOfNextRun); 460 460 } … … 470 470 if (m_run.rtl()) { 471 471 charactersSoFar = m_normalizedBufferLength; 472 for (int i = m_harf buzzRuns.size() - 1; i >= 0; --i) {473 charactersSoFar -= m_harf buzzRuns[i]->numCharacters();474 float nextX = currentX + m_harf buzzRuns[i]->width();472 for (int i = m_harfBuzzRuns.size() - 1; i >= 0; --i) { 473 charactersSoFar -= m_harfBuzzRuns[i]->numCharacters(); 474 float nextX = currentX + m_harfBuzzRuns[i]->width(); 475 475 float offsetForRun = targetX - currentX; 476 if (offsetForRun >= 0 && offsetForRun <= m_harf buzzRuns[i]->width()) {476 if (offsetForRun >= 0 && offsetForRun <= m_harfBuzzRuns[i]->width()) { 477 477 // The x value in question is within this script run. 478 const unsigned index = m_harf buzzRuns[i]->characterIndexForXPosition(offsetForRun);478 const unsigned index = m_harfBuzzRuns[i]->characterIndexForXPosition(offsetForRun); 479 479 return charactersSoFar + index; 480 480 } … … 482 482 } 483 483 } else { 484 for (unsigned i = 0; i < m_harf buzzRuns.size(); ++i) {485 float nextX = currentX + m_harf buzzRuns[i]->width();484 for (unsigned i = 0; i < m_harfBuzzRuns.size(); ++i) { 485 float nextX = currentX + m_harfBuzzRuns[i]->width(); 486 486 float offsetForRun = targetX - currentX; 487 if (offsetForRun >= 0 && offsetForRun <= m_harf buzzRuns[i]->width()) {488 const unsigned index = m_harf buzzRuns[i]->characterIndexForXPosition(offsetForRun);487 if (offsetForRun >= 0 && offsetForRun <= m_harfBuzzRuns[i]->width()) { 488 const unsigned index = m_harfBuzzRuns[i]->characterIndexForXPosition(offsetForRun); 489 489 return charactersSoFar + index; 490 490 } 491 charactersSoFar += m_harf buzzRuns[i]->numCharacters();491 charactersSoFar += m_harfBuzzRuns[i]->numCharacters(); 492 492 currentX = nextX; 493 493 } … … 507 507 if (m_run.rtl()) 508 508 currentX = m_totalWidth; 509 for (unsigned i = 0; i < m_harf buzzRuns.size(); ++i) {509 for (unsigned i = 0; i < m_harfBuzzRuns.size(); ++i) { 510 510 if (m_run.rtl()) 511 currentX -= m_harf buzzRuns[i]->width();512 int numCharacters = m_harf buzzRuns[i]->numCharacters();511 currentX -= m_harfBuzzRuns[i]->width(); 512 int numCharacters = m_harfBuzzRuns[i]->numCharacters(); 513 513 if (!foundFromX && from >= 0 && from < numCharacters) { 514 fromX = m_harf buzzRuns[i]->xPositionForOffset(from) + currentX;514 fromX = m_harfBuzzRuns[i]->xPositionForOffset(from) + currentX; 515 515 foundFromX = true; 516 516 } else … … 518 518 519 519 if (!foundToX && to >= 0 && to < numCharacters) { 520 toX = m_harf buzzRuns[i]->xPositionForOffset(to) + currentX;520 toX = m_harfBuzzRuns[i]->xPositionForOffset(to) + currentX; 521 521 foundToX = true; 522 522 } else … … 526 526 break; 527 527 if (!m_run.rtl()) 528 currentX += m_harf buzzRuns[i]->width();528 currentX += m_harfBuzzRuns[i]->width(); 529 529 } 530 530 -
trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h
r141290 r141291 113 113 114 114 Vector<hb_feature_t, 4> m_features; 115 Vector<OwnPtr<HarfBuzzRun>, 16> m_harf buzzRuns;115 Vector<OwnPtr<HarfBuzzRun>, 16> m_harfBuzzRuns; 116 116 117 117 FloatPoint m_startOffset;
Note: See TracChangeset
for help on using the changeset viewer.