Changeset 89988 in webkit
- Timestamp:
- Jun 28, 2011 11:01:53 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r89987 r89988 1 2011-06-28 Kenichi Ishibashi <bashi@chromium.org> 2 3 Reviewed by Tony Chang. 4 5 [Chromium] Remove dependencies on harfbuzz from FontPlatformDataLinux and FontLinux 6 https://bugs.webkit.org/show_bug.cgi?id=62530 7 8 - Moved codes of FontLinux which depend on harfbuzz APIs to ComplexTextController. Removed Some methods of ComplexTextController(advances() and logClusters()) since they are no longer needed. 9 - Moved RefCountedHarfbuzzFace from FontPlatformDataLinux to HarfbuzzSkia and renamed it to HarfbuzzFace. 10 11 No new tests because there is no behavior change (The existing tests should cover the changes). 12 13 * platform/graphics/chromium/ComplexTextControllerLinux.cpp: 14 (WebCore::ComplexTextController::ComplexTextController): Added arguments so eliminating setter invocations. 15 (WebCore::ComplexTextController::setupForRTL): Added. 16 (WebCore::ComplexTextController::setupFontForScriptRun): Adopt the change of HarfbuzzFace class. 17 (WebCore::ComplexTextController::setGlyphPositions): Use m_item.log_clusters instead of removed method. 18 (WebCore::ComplexTextController::glyphIndexForXPositionInScriptRun): Added. 19 (WebCore::ComplexTextController::offsetForPosition): Ditto. 20 (WebCore::ComplexTextController::selectionRect): Ditto. 21 * platform/graphics/chromium/ComplexTextControllerLinux.h: 22 (WebCore::ComplexTextController::width): 23 * platform/graphics/chromium/FontLinux.cpp: Removed truncateFixedPointToInteger(). 24 (WebCore::Font::drawComplexText): Removed setter invocations of ComplexTextController. 25 (WebCore::Font::floatWidthForComplexText): Ditto. 26 (WebCore::Font::offsetForPositionForComplexText): Moved harfbuzz dependent code to ComplexTextController. 27 (WebCore::Font::selectionRectForComplexText): Ditto. 28 * platform/graphics/chromium/FontPlatformDataLinux.cpp: 29 (WebCore::FontPlatformData::harfbuzzFace): Wrapped up HB_FaceRec in HarfbuzzFace class. 30 * platform/graphics/chromium/FontPlatformDataLinux.h: Moved RefCountedHarfbuzzFace class and renamed to HarfbuzzFace. 31 * platform/graphics/chromium/HarfbuzzSkia.cpp: 32 (WebCore::allocHarfbuzzFont): Moved from ComplexTextControllerLinux.cpp. 33 (WebCore::HarfbuzzFace::HarfbuzzFace): Added. 34 (WebCore::HarfbuzzFace::~HarfbuzzFace): Added. 35 * platform/graphics/chromium/HarfbuzzSkia.h: 36 (WebCore::HarfbuzzFace::create): Added. 37 (WebCore::HarfbuzzFace::face): Added. 38 * platform/graphics/skia/GlyphPageTreeNodeSkia.cpp: 39 (WebCore::substituteWithVerticalGlyphs): Adopt the change of HarfbuzzFace class. 40 1 41 2011-06-28 Roland Steiner <rolandsteiner@chromium.org> 2 42 -
trunk/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp
r88139 r89988 32 32 #include "ComplexTextControllerLinux.h" 33 33 34 #include "FloatRect.h" 34 35 #include "Font.h" 35 36 #include "TextRun.h" 37 38 extern "C" { 39 #include "harfbuzz-unicode.h" 40 } 36 41 37 42 #include <unicode/normlzr.h> … … 47 52 } 48 53 49 ComplexTextController::ComplexTextController(const TextRun& run, unsigned startingX, unsigned startingY, const Font* font)54 ComplexTextController::ComplexTextController(const TextRun& run, unsigned startingX, unsigned startingY, unsigned wordSpacing, unsigned letterSpacing, unsigned padding, const Font* font) 50 55 : m_font(font) 51 56 , m_run(getNormalizedTextRun(run, m_normalizedRun, m_normalizedBuffer)) 52 , m_wordSpacingAdjustment(0)53 , m_padding(0)54 , m_padPerWordBreak(0)55 , m_padError(0)56 , m_letterSpacing(0)57 57 { 58 58 // Do not use |run| inside this constructor. Use |m_run| instead. … … 77 77 reset(startingX); 78 78 m_startingY = startingY; 79 80 setWordSpacingAdjustment(wordSpacing); 81 setLetterSpacingAdjustment(letterSpacing); 82 setPadding(padding); 79 83 } 80 84 … … 119 123 { 120 124 m_padding = padding; 125 m_padError = 0; 121 126 if (!m_padding) 122 127 return; … … 142 147 m_indexOfNextScriptRun = 0; 143 148 m_offsetX = offset; 149 } 150 151 void ComplexTextController::setupForRTL() 152 { 153 int padding = m_padding; 154 // FIXME: this causes us to shape the text twice -- once to compute the width and then again 155 // below when actually rendering. Change ComplexTextController to match platform/mac and 156 // platform/chromium/win by having it store the shaped runs, so we can reuse the results. 157 reset(m_offsetX + widthOfFullRun()); 158 // We need to set the padding again because ComplexTextController layout consumed the value. 159 // Fixing the above problem would help here too. 160 setPadding(padding); 144 161 } 145 162 … … 203 220 const FontData* fontData = m_font->glyphDataForCharacter(m_item.string[m_item.item.pos], false, fontDataVariant).fontData; 204 221 const FontPlatformData& platformData = fontData->fontDataForCharacter(' ')->platformData(); 205 m_item.face = platformData.harfbuzzFace() ;222 m_item.face = platformData.harfbuzzFace()->face(); 206 223 void* opaquePlatformData = const_cast<FontPlatformData*>(&platformData); 207 224 m_item.font->userData = opaquePlatformData; … … 216 233 m_item.font->x_scale = scale; 217 234 m_item.font->y_scale = scale; 218 }219 220 HB_FontRec* ComplexTextController::allocHarfbuzzFont()221 {222 HB_FontRec* font = reinterpret_cast<HB_FontRec*>(fastMalloc(sizeof(HB_FontRec)));223 memset(font, 0, sizeof(HB_FontRec));224 font->klass = &harfbuzzSkiaClass;225 font->userData = 0;226 227 return font;228 235 } 229 236 … … 298 305 // Glyphs are positioned starting from m_offsetX; in RTL mode they go leftwards from there. 299 306 for (size_t i = 0; i < m_item.num_glyphs; ++i) { 300 while (static_cast<unsigned>(logClustersIndex) < m_item.item.length && logClusters()[logClustersIndex] < i)307 while (static_cast<unsigned>(logClustersIndex) < m_item.item.length && m_item.log_clusters[logClustersIndex] < i) 301 308 logClustersIndex++; 302 309 … … 400 407 } 401 408 409 int ComplexTextController::glyphIndexForXPositionInScriptRun(int targetX) const 410 { 411 // Iterate through the glyphs in logical order, seeing whether targetX falls between the previous 412 // position and halfway through the current glyph. 413 // FIXME: this code probably belongs in ComplexTextController. 414 int lastX = offsetX() - (rtl() ? -m_pixelWidth : m_pixelWidth); 415 for (int glyphIndex = 0; static_cast<unsigned>(glyphIndex) < length(); ++glyphIndex) { 416 int advance = truncateFixedPointToInteger(m_item.advances[glyphIndex]); 417 int nextX = static_cast<int>(positions()[glyphIndex].x()) + advance / 2; 418 if (std::min(nextX, lastX) <= targetX && targetX <= std::max(nextX, lastX)) 419 return glyphIndex; 420 lastX = nextX; 421 } 422 423 return length() - 1; 424 } 425 426 int ComplexTextController::offsetForPosition(int targetX) 427 { 428 unsigned basePosition = 0; 429 430 int x = offsetX(); 431 while (nextScriptRun()) { 432 int nextX = offsetX(); 433 434 if (std::min(x, nextX) <= targetX && targetX <= std::max(x, nextX)) { 435 // The x value in question is within this script run. 436 const int glyphIndex = glyphIndexForXPositionInScriptRun(targetX); 437 438 // Now that we have a glyph index, we have to turn that into a 439 // code-point index. Because of ligatures, several code-points may 440 // have gone into a single glyph. We iterate over the clusters log 441 // and find the first code-point which contributed to the glyph. 442 443 // Some shapers (i.e. Khmer) will produce cluster logs which report 444 // that /no/ code points contributed to certain glyphs. Because of 445 // this, we take any code point which contributed to the glyph in 446 // question, or any subsequent glyph. If we run off the end, then 447 // we take the last code point. 448 for (unsigned j = 0; j < numCodePoints(); ++j) { 449 if (m_item.log_clusters[j] >= glyphIndex) 450 return basePosition + j; 451 } 452 453 return basePosition + numCodePoints() - 1; 454 } 455 456 basePosition += numCodePoints(); 457 } 458 459 return basePosition; 460 } 461 462 FloatRect ComplexTextController::selectionRect(const FloatPoint& point, int height, int from, int to) 463 { 464 int fromX = -1, toX = -1; 465 // Iterate through the script runs in logical order, searching for the run covering the positions of interest. 466 while (nextScriptRun() && (fromX == -1 || toX == -1)) { 467 if (fromX == -1 && from >= 0 && static_cast<unsigned>(from) < numCodePoints()) { 468 // |from| is within this script run. So we index the clusters log to 469 // find which glyph this code-point contributed to and find its x 470 // position. 471 int glyph = m_item.log_clusters[from]; 472 fromX = positions()[glyph].x(); 473 if (rtl()) 474 fromX += truncateFixedPointToInteger(m_item.advances[glyph]); 475 } else 476 from -= numCodePoints(); 477 478 if (toX == -1 && to >= 0 && static_cast<unsigned>(to) < numCodePoints()) { 479 int glyph = m_item.log_clusters[to]; 480 toX = positions()[glyph].x(); 481 if (rtl()) 482 toX += truncateFixedPointToInteger(m_item.advances[glyph]); 483 } else 484 to -= numCodePoints(); 485 } 486 487 // The position in question might be just after the text. 488 if (fromX == -1) 489 fromX = offsetX(); 490 if (toX == -1) 491 toX = offsetX(); 492 493 ASSERT(fromX != -1 && toX != -1); 494 495 if (fromX < toX) 496 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); 497 498 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); 499 } 500 402 501 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h
r85013 r89988 37 37 #include "TextRun.h" 38 38 39 extern "C" { 40 #include "harfbuzz-shaper.h" 41 } 42 39 43 #include <unicode/uchar.h> 40 44 #include <wtf/OwnArrayPtr.h> … … 62 66 class ComplexTextController { 63 67 public: 64 ComplexTextController(const TextRun&, unsigned , unsigned, const Font*);68 ComplexTextController(const TextRun&, unsigned startingX, unsigned startingY, unsigned wordSpacing, unsigned letterSpacing, unsigned padding, const Font*); 65 69 ~ComplexTextController(); 66 70 … … 86 90 int letterSpacing() const { return m_letterSpacing; } 87 91 88 // Set the x offset for the next script run. This affects the values in 89 // |xPositions| 92 void setupForRTL(); 90 93 bool rtl() const { return m_run.rtl(); } 91 94 const uint16_t* glyphs() const { return m_glyphs16; } … … 99 102 const SkPoint* positions() const { return m_positions; } 100 103 101 // Get the advances (widths) for each glyph.102 const HB_Fixed* advances() const { return m_item.advances; }103 104 // Return the width (in px) of the current script run.105 const unsigned width() const { return m_pixelWidth; }106 107 // Return the cluster log for the current script run. For example:108 // script run: f i a n c é (fi gets ligatured)109 // log clutrs: 0 0 1 2 3 4110 // So, for each input code point, the log tells you which output glyph was111 // generated for it.112 const unsigned short* logClusters() const { return m_item.log_clusters; }113 114 104 // return the number of code points in the current script run 115 105 const unsigned numCodePoints() const { return m_item.item.length; } … … 120 110 const FontPlatformData* fontPlatformDataForScriptRun() { return reinterpret_cast<FontPlatformData*>(m_item.font->userData); } 121 111 112 int offsetForPosition(int); 113 FloatRect selectionRect(const FloatPoint&, int height, int from , int to); 114 122 115 private: 116 // Return the width (in px) of the current script run. 117 unsigned width() const { return m_pixelWidth; } 118 123 119 void setupFontForScriptRun(); 124 HB_FontRec* allocHarfbuzzFont();125 120 void deleteGlyphArrays(); 126 121 void createGlyphArrays(int); … … 134 129 // This matches the logic in RenderBlock::findNextLineBreak 135 130 static bool isCodepointSpace(HB_UChar16 c) { return c == ' ' || c == '\t'; } 131 132 int glyphIndexForXPositionInScriptRun(int targetX) const; 136 133 137 134 const Font* const m_font; -
trunk/Source/WebCore/platform/graphics/chromium/FontLinux.cpp
r89250 r89988 166 166 } 167 167 168 // Harfbuzz uses 26.6 fixed point values for pixel offsets. However, we don't169 // handle subpixel positioning so this function is used to truncate Harfbuzz170 // values to a number of pixels.171 static int truncateFixedPointToInteger(HB_Fixed value)172 {173 return value >> 6;174 }175 176 168 static void setupForTextPainting(SkPaint* paint, SkColor color) 177 169 { … … 206 198 } 207 199 208 ComplexTextController controller(run, point.x(), point.y(), this); 209 controller.setWordSpacingAdjustment(wordSpacing()); 210 controller.setLetterSpacingAdjustment(letterSpacing()); 211 controller.setPadding(run.expansion()); 212 213 if (run.rtl()) { 214 // FIXME: this causes us to shape the text twice -- once to compute the width and then again 215 // below when actually rendering. Change ComplexTextController to match platform/mac and 216 // platform/chromium/win by having it store the shaped runs, so we can reuse the results. 217 controller.reset(point.x() + controller.widthOfFullRun()); 218 // We need to set the padding again because ComplexTextController layout consumed the value. 219 // Fixing the above problem would help here too. 220 controller.setPadding(run.expansion()); 221 } 200 ComplexTextController controller(run, point.x(), point.y(), wordSpacing(), letterSpacing(), run.expansion(), this); 201 202 if (run.rtl()) 203 controller.setupForRTL(); 222 204 223 205 while (controller.nextScriptRun()) { … … 243 225 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const 244 226 { 245 ComplexTextController controller(run, 0, 0, this); 246 controller.setWordSpacingAdjustment(wordSpacing()); 247 controller.setLetterSpacingAdjustment(letterSpacing()); 248 controller.setPadding(run.expansion()); 227 ComplexTextController controller(run, 0, 0, wordSpacing(), letterSpacing(), run.expansion(), this); 249 228 return controller.widthOfFullRun(); 250 }251 252 static int glyphIndexForXPositionInScriptRun(const ComplexTextController& controller, int targetX)253 {254 // Iterate through the glyphs in logical order, seeing whether targetX falls between the previous255 // position and halfway through the current glyph.256 // FIXME: this code probably belongs in ComplexTextController.257 int lastX = controller.offsetX() - (controller.rtl() ? -controller.width() : controller.width());258 for (int glyphIndex = 0; static_cast<unsigned>(glyphIndex) < controller.length(); ++glyphIndex) {259 int advance = truncateFixedPointToInteger(controller.advances()[glyphIndex]);260 int nextX = static_cast<int>(controller.positions()[glyphIndex].x()) + advance / 2;261 if (std::min(nextX, lastX) <= targetX && targetX <= std::max(nextX, lastX))262 return glyphIndex;263 lastX = nextX;264 }265 266 return controller.length() - 1;267 229 } 268 230 … … 277 239 // (Mac code ignores includePartialGlyphs, and they don't know what it's 278 240 // supposed to do, so we just ignore it as well.) 279 ComplexTextController controller(run, 0, 0, this); 280 controller.setWordSpacingAdjustment(wordSpacing()); 281 controller.setLetterSpacingAdjustment(letterSpacing()); 282 controller.setPadding(run.expansion()); 283 if (run.rtl()) { 284 // See FIXME in drawComplexText. 285 controller.reset(controller.widthOfFullRun()); 286 controller.setPadding(run.expansion()); 287 } 288 289 unsigned basePosition = 0; 290 291 int x = controller.offsetX(); 292 while (controller.nextScriptRun()) { 293 int nextX = controller.offsetX(); 294 295 if (std::min(x, nextX) <= targetX && targetX <= std::max(x, nextX)) { 296 // The x value in question is within this script run. 297 const int glyphIndex = glyphIndexForXPositionInScriptRun(controller, targetX); 298 299 // Now that we have a glyph index, we have to turn that into a 300 // code-point index. Because of ligatures, several code-points may 301 // have gone into a single glyph. We iterate over the clusters log 302 // and find the first code-point which contributed to the glyph. 303 304 // Some shapers (i.e. Khmer) will produce cluster logs which report 305 // that /no/ code points contributed to certain glyphs. Because of 306 // this, we take any code point which contributed to the glyph in 307 // question, or any subsequent glyph. If we run off the end, then 308 // we take the last code point. 309 const unsigned short* log = controller.logClusters(); 310 for (unsigned j = 0; j < controller.numCodePoints(); ++j) { 311 if (log[j] >= glyphIndex) 312 return basePosition + j; 313 } 314 315 return basePosition + controller.numCodePoints() - 1; 316 } 317 318 basePosition += controller.numCodePoints(); 319 } 320 321 return basePosition; 241 ComplexTextController controller(run, 0, 0, wordSpacing(), letterSpacing(), run.expansion(), this); 242 if (run.rtl()) 243 controller.setupForRTL(); 244 return controller.offsetForPosition(targetX); 322 245 } 323 246 … … 327 250 int from, int to) const 328 251 { 329 int fromX = -1, toX = -1; 330 ComplexTextController controller(run, 0, 0, this); 331 controller.setWordSpacingAdjustment(wordSpacing()); 332 controller.setLetterSpacingAdjustment(letterSpacing()); 333 controller.setPadding(run.expansion()); 334 if (run.rtl()) { 335 // See FIXME in drawComplexText. 336 controller.reset(controller.widthOfFullRun()); 337 controller.setPadding(run.expansion()); 338 } 339 340 // Iterate through the script runs in logical order, searching for the run covering the positions of interest. 341 while (controller.nextScriptRun() && (fromX == -1 || toX == -1)) { 342 if (fromX == -1 && from >= 0 && static_cast<unsigned>(from) < controller.numCodePoints()) { 343 // |from| is within this script run. So we index the clusters log to 344 // find which glyph this code-point contributed to and find its x 345 // position. 346 int glyph = controller.logClusters()[from]; 347 fromX = controller.positions()[glyph].x(); 348 if (controller.rtl()) 349 fromX += truncateFixedPointToInteger(controller.advances()[glyph]); 350 } else 351 from -= controller.numCodePoints(); 352 353 if (toX == -1 && to >= 0 && static_cast<unsigned>(to) < controller.numCodePoints()) { 354 int glyph = controller.logClusters()[to]; 355 toX = controller.positions()[glyph].x(); 356 if (controller.rtl()) 357 toX += truncateFixedPointToInteger(controller.advances()[glyph]); 358 } else 359 to -= controller.numCodePoints(); 360 } 361 362 // The position in question might be just after the text. 363 if (fromX == -1) 364 fromX = controller.offsetX(); 365 if (toX == -1) 366 toX = controller.offsetX(); 367 368 ASSERT(fromX != -1 && toX != -1); 369 370 if (fromX < toX) 371 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); 372 373 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); 252 ComplexTextController controller(run, 0, 0, wordSpacing(), letterSpacing(), run.expansion(), this); 253 if (run.rtl()) 254 controller.setupForRTL(); 255 return controller.selectionRect(point, height, from, to); 374 256 } 375 257 -
trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp
r83020 r89988 32 32 #include "FontPlatformData.h" 33 33 34 #include "HarfbuzzSkia.h"35 34 #include "NotImplemented.h" 36 35 #include "PlatformBridge.h" … … 62 61 { 63 62 isSkiaSubpixelGlyphs = isSubpixelGlyphs; 64 }65 66 FontPlatformData::RefCountedHarfbuzzFace::~RefCountedHarfbuzzFace()67 {68 HB_FreeFace(m_harfbuzzFace);69 63 } 70 64 … … 230 224 } 231 225 232 H B_FaceRec_* FontPlatformData::harfbuzzFace() const226 HarfbuzzFace* FontPlatformData::harfbuzzFace() const 233 227 { 234 228 if (!m_harfbuzzFace) 235 m_harfbuzzFace = RefCountedHarfbuzzFace::create(HB_NewFace(const_cast<FontPlatformData*>(this), harfbuzzSkiaGetTable));236 237 return m_harfbuzzFace ->face();229 m_harfbuzzFace = HarfbuzzFace::create(const_cast<FontPlatformData*>(this)); 230 231 return m_harfbuzzFace.get(); 238 232 } 239 233 -
trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.h
r80654 r89988 34 34 #include "FontOrientation.h" 35 35 #include "FontRenderStyle.h" 36 #include "HarfbuzzSkia.h" 36 37 #include "TextOrientation.h" 37 38 #include <wtf/Forward.h> … … 43 44 class SkTypeface; 44 45 typedef uint32_t SkFontID; 45 46 struct HB_FaceRec_;47 46 48 47 namespace WebCore { … … 129 128 #endif 130 129 131 H B_FaceRec_* harfbuzzFace() const;130 HarfbuzzFace* harfbuzzFace() const; 132 131 133 132 // ------------------------------------------------------------------------- … … 139 138 140 139 private: 141 class RefCountedHarfbuzzFace : public RefCounted<RefCountedHarfbuzzFace> {142 public:143 static PassRefPtr<RefCountedHarfbuzzFace> create(HB_FaceRec_* harfbuzzFace)144 {145 return adoptRef(new RefCountedHarfbuzzFace(harfbuzzFace));146 }147 148 ~RefCountedHarfbuzzFace();149 150 HB_FaceRec_* face() const { return m_harfbuzzFace; }151 152 private:153 RefCountedHarfbuzzFace(HB_FaceRec_* harfbuzzFace) : m_harfbuzzFace(harfbuzzFace)154 {155 }156 157 HB_FaceRec_* m_harfbuzzFace;158 };159 160 140 void querySystemForRenderStyle(); 161 141 … … 170 150 TextOrientation m_textOrientation; 171 151 FontRenderStyle m_style; 172 mutable RefPtr< RefCountedHarfbuzzFace> m_harfbuzzFace;152 mutable RefPtr<HarfbuzzFace> m_harfbuzzFace; 173 153 174 154 SkTypeface* hashTableDeletedFontValue() const { return reinterpret_cast<SkTypeface*>(-1); } -
trunk/Source/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp
r86171 r89988 198 198 }; 199 199 200 HB_Font_* allocHarfbuzzFont() 201 { 202 HB_Font_* font = reinterpret_cast<HB_Font_*>(fastMalloc(sizeof(HB_Font_))); 203 memset(font, 0, sizeof(HB_Font_)); 204 font->klass = &harfbuzzSkiaClass; 205 font->userData = 0; 206 207 return font; 208 } 209 200 210 HB_Error harfbuzzSkiaGetTable(void* voidface, const HB_Tag tag, HB_Byte* buffer, HB_UInt* len) 201 211 { … … 217 227 } 218 228 229 HarfbuzzFace::HarfbuzzFace(FontPlatformData* platformData) 230 { 231 m_harfbuzzFace = HB_NewFace(platformData, harfbuzzSkiaGetTable); 232 } 233 234 HarfbuzzFace::~HarfbuzzFace() 235 { 236 HB_FreeFace(m_harfbuzzFace); 237 } 238 219 239 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/chromium/HarfbuzzSkia.h
r46144 r89988 32 32 #define HarfbuzzSkia_h 33 33 34 extern "C" { 35 #include "harfbuzz-shaper.h" 36 #include "harfbuzz-unicode.h" 37 } 34 #include <wtf/RefCounted.h> 35 #include <wtf/RefPtr.h> 36 37 struct HB_FaceRec_; 38 struct HB_Font_; 38 39 39 40 namespace WebCore { 40 HB_Error harfbuzzSkiaGetTable(void* voidface, const HB_Tag, HB_Byte* buffer, HB_UInt* len); 41 extern const HB_FontClass harfbuzzSkiaClass; 41 42 class FontPlatformData; 43 44 class HarfbuzzFace : public RefCounted<HarfbuzzFace> { 45 public: 46 static PassRefPtr<HarfbuzzFace> create(FontPlatformData* platformData) 47 { 48 return adoptRef(new HarfbuzzFace(platformData)); 49 } 50 51 ~HarfbuzzFace(); 52 53 HB_FaceRec_* face() const { return m_harfbuzzFace; } 54 55 private: 56 explicit HarfbuzzFace(FontPlatformData*); 57 58 HB_FaceRec_* m_harfbuzzFace; 59 }; 60 61 // FIXME: Remove this asymmetric alloc/free function. 62 // We'll remove this once we move to the new Harfbuzz API. 63 HB_Font_* allocHarfbuzzFont(); 64 42 65 } // namespace WebCore 43 66 -
trunk/Source/WebCore/platform/graphics/skia/GlyphPageTreeNodeSkia.cpp
r80610 r89988 40 40 #include "SkUtils.h" 41 41 42 extern "C" { 43 #include "harfbuzz-shaper.h" 44 } 45 42 46 namespace WebCore { 43 47 44 48 static int substituteWithVerticalGlyphs(const SimpleFontData* fontData, uint16_t* glyphs, unsigned bufferLength) 45 49 { 46 HB_FaceRec_* hbFace = fontData->platformData().harfbuzzFace() ;50 HB_FaceRec_* hbFace = fontData->platformData().harfbuzzFace()->face(); 47 51 if (!hbFace->gsub) { 48 52 // if there is no GSUB table, treat it as not covered
Note: See TracChangeset
for help on using the changeset viewer.