Changeset 85013 in webkit
- Timestamp:
- Apr 26, 2011 9:49:56 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r85012 r85013 1 2011-04-26 Kenichi Ishibashi <bashi@chromium.org> 2 3 Reviewed by Tony Chang. 4 5 [Chromium] Vertical positions are off for some Arabic glyphs on Linux 6 https://bugs.webkit.org/show_bug.cgi?id=59182 7 8 Add a test for checking vertical offsets of Arabic script shaping. 9 The font which is used in the test was created from scratch. 10 11 * platform/chromium-linux/fast/text/international/arabic-vertical-offset-expected.png: Added. 12 * platform/chromium-linux/fast/text/international/arabic-vertical-offset-expected.txt: Added. 13 * platform/chromium-linux/fast/text/international/arabic-vertical-offset.html: Added. 14 * platform/chromium-linux/fast/text/international/resources/font-for-arabic-offset-test.ttf: Added. 15 1 16 2011-04-26 Tony Chang <tony@chromium.org> 2 17 -
trunk/Source/WebCore/ChangeLog
r85011 r85013 1 2011-04-26 Kenichi Ishibashi <bashi@chromium.org> 2 3 Reviewed by Tony Chang. 4 5 [Chromium] Vertical positions are off for some Arabic glyphs on Linux 6 https://bugs.webkit.org/show_bug.cgi?id=59182 7 8 Use vertical offsets of the shaping results. 9 10 Test: platform/chromium-linux/fast/text/international/arabic-vertical-offset.html 11 12 * platform/graphics/chromium/ComplexTextControllerLinux.cpp: 13 (WebCore::ComplexTextController::ComplexTextController): 14 Added initialization of m_startingY. 15 (WebCore::ComplexTextController::nextScriptRun): 16 Followed the change in handling positions. 17 (WebCore::ComplexTextController::deleteGlyphArrays): Ditto. 18 (WebCore::ComplexTextController::createGlyphArrays): Ditto. 19 (WebCore::ComplexTextController::resetGlyphArrays): Ditto. 20 (WebCore::ComplexTextController::setGlyphPositions): 21 Changed to use vertical offsets as same as horizontal offsets. 22 * platform/graphics/chromium/ComplexTextControllerLinux.h: 23 Removed m_xPositions and Added m_positions and m_startingY. 24 (WebCore::ComplexTextController::positions): Added. 25 * platform/graphics/chromium/FontLinux.cpp: 26 Followed the change in ComplexTextController. 27 (WebCore::Font::drawComplexText): Ditto. 28 (WebCore::Font::floatWidthForComplexText): Ditto. 29 (WebCore::glyphIndexForXPositionInScriptRun): Ditto. 30 (WebCore::Font::offsetForPositionForComplexText): Ditto. 31 (WebCore::Font::selectionRectForComplexText): Ditto. 32 1 33 2011-04-26 Levi Weintraub <leviw@chromium.org> 2 34 -
trunk/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp
r77785 r85013 47 47 } 48 48 49 ComplexTextController::ComplexTextController(const TextRun& run, unsigned startingX, const Font* font)49 ComplexTextController::ComplexTextController(const TextRun& run, unsigned startingX, unsigned startingY, const Font* font) 50 50 : m_font(font) 51 51 , m_run(getNormalizedTextRun(run, m_normalizedRun, m_normalizedBuffer)) … … 76 76 77 77 reset(startingX); 78 m_startingY = startingY; 78 79 } 79 80 … … 172 173 setupFontForScriptRun(); 173 174 shapeGlyphs(); 174 setGlyph XPositions(rtl());175 setGlyphPositions(rtl()); 175 176 176 177 return true; … … 234 235 delete[] m_item.offsets; 235 236 delete[] m_glyphs16; 236 delete[] m_ xPositions;237 delete[] m_positions; 237 238 } 238 239 … … 245 246 246 247 m_glyphs16 = new uint16_t[size]; 247 m_ xPositions = new SkScalar[size];248 m_positions = new SkPoint[size]; 248 249 249 250 m_item.num_glyphs = size; … … 262 263 memset(m_item.offsets, 0, size * sizeof(HB_FixedPoint)); 263 264 memset(m_glyphs16, 0, size * sizeof(uint16_t)); 264 memset(m_ xPositions, 0, size * sizeof(SkScalar));265 memset(m_positions, 0, size * sizeof(SkPoint)); 265 266 } 266 267 … … 285 286 } 286 287 287 void ComplexTextController::setGlyph XPositions(bool isRTL)288 void ComplexTextController::setGlyphPositions(bool isRTL) 288 289 { 289 290 const double rtlFlip = isRTL ? -1 : 1; … … 305 306 m_glyphs16[i] = m_item.glyphs[i]; 306 307 double offsetX = truncateFixedPointToInteger(m_item.offsets[i].x); 308 double offsetY = truncateFixedPointToInteger(m_item.offsets[i].y); 307 309 double advance = truncateFixedPointToInteger(m_item.advances[i]); 308 310 if (isRTL) 309 311 offsetX -= advance; 310 312 311 m_xPositions[i] = m_offsetX + (position * rtlFlip) + offsetX; 313 m_positions[i].set(m_offsetX + (position * rtlFlip) + offsetX, 314 m_startingY + offsetY); 312 315 313 316 if (m_currentFontData->isZeroWidthSpaceGlyph(m_glyphs16[i])) -
trunk/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h
r76732 r85013 33 33 34 34 #include "HarfbuzzSkia.h" 35 #include "SkPoint.h" 35 36 #include "SkScalar.h" 36 37 #include "TextRun.h" … … 61 62 class ComplexTextController { 62 63 public: 63 ComplexTextController(const TextRun&, unsigned, const Font*);64 ComplexTextController(const TextRun&, unsigned, unsigned, const Font*); 64 65 ~ComplexTextController(); 65 66 … … 93 94 const unsigned length() const { return m_item.num_glyphs; } 94 95 95 // Return the xoffset for each of the glyphs. Note that this is translated96 // Return the offset for each of the glyphs. Note that this is translated 96 97 // by the current x offset and that the x offset is updated for each script 97 98 // run. 98 const Sk Scalar* xPositions() const { return m_xPositions; }99 const SkPoint* positions() const { return m_positions; } 99 100 100 101 // Get the advances (widths) for each glyph. … … 126 127 void resetGlyphArrays(); 127 128 void shapeGlyphs(); 128 void setGlyph XPositions(bool);129 void setGlyphPositions(bool); 129 130 130 131 static void normalizeSpacesAndMirrorChars(const UChar* source, bool rtl, UChar* destination, int length); … … 138 139 HB_ShaperItem m_item; 139 140 uint16_t* m_glyphs16; // A vector of 16-bit glyph ids. 140 Sk Scalar* m_xPositions; // A vector of xpositions for each glyph.141 SkPoint* m_positions; // A vector of positions for each glyph. 141 142 ssize_t m_indexOfNextScriptRun; // Indexes the script run in |m_run|. 142 143 unsigned m_offsetX; // Offset in pixels to the start of the next script run. 144 unsigned m_startingY; // The Y starting point of the script run. 143 145 unsigned m_pixelWidth; // Width (in px) of the current script run. 144 146 unsigned m_glyphsArrayCapacity; // Current size of all the Harfbuzz arrays. -
trunk/Source/WebCore/platform/graphics/chromium/FontLinux.cpp
r80610 r85013 207 207 } 208 208 209 ComplexTextController controller(run, point.x(), this);209 ComplexTextController controller(run, point.x(), point.y(), this); 210 210 controller.setWordSpacingAdjustment(wordSpacing()); 211 211 controller.setLetterSpacingAdjustment(letterSpacing()); … … 226 226 controller.fontPlatformDataForScriptRun()->setupPaint(&fillPaint); 227 227 adjustTextRenderMode(&fillPaint, gc->platformContext()); 228 canvas->drawPosText H(controller.glyphs(), controller.length() << 1, controller.xPositions(), point.y(), fillPaint);228 canvas->drawPosText(controller.glyphs(), controller.length() << 1, controller.positions(), fillPaint); 229 229 } 230 230 … … 232 232 controller.fontPlatformDataForScriptRun()->setupPaint(&strokePaint); 233 233 adjustTextRenderMode(&strokePaint, gc->platformContext()); 234 canvas->drawPosText H(controller.glyphs(), controller.length() << 1, controller.xPositions(), point.y(), strokePaint);234 canvas->drawPosText(controller.glyphs(), controller.length() << 1, controller.positions(), strokePaint); 235 235 } 236 236 } … … 244 244 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const 245 245 { 246 ComplexTextController controller(run, 0, this);246 ComplexTextController controller(run, 0, 0, this); 247 247 controller.setWordSpacingAdjustment(wordSpacing()); 248 248 controller.setLetterSpacingAdjustment(letterSpacing()); … … 259 259 for (int glyphIndex = 0; static_cast<unsigned>(glyphIndex) < controller.length(); ++glyphIndex) { 260 260 int advance = truncateFixedPointToInteger(controller.advances()[glyphIndex]); 261 int nextX = static_cast<int>(controller. xPositions()[glyphIndex]) + advance / 2;261 int nextX = static_cast<int>(controller.positions()[glyphIndex].x()) + advance / 2; 262 262 if (std::min(nextX, lastX) <= targetX && targetX <= std::max(nextX, lastX)) 263 263 return glyphIndex; … … 278 278 // (Mac code ignores includePartialGlyphs, and they don't know what it's 279 279 // supposed to do, so we just ignore it as well.) 280 ComplexTextController controller(run, 0, this);280 ComplexTextController controller(run, 0, 0, this); 281 281 controller.setWordSpacingAdjustment(wordSpacing()); 282 282 controller.setLetterSpacingAdjustment(letterSpacing()); … … 329 329 { 330 330 int fromX = -1, toX = -1; 331 ComplexTextController controller(run, 0, this);331 ComplexTextController controller(run, 0, 0, this); 332 332 controller.setWordSpacingAdjustment(wordSpacing()); 333 333 controller.setLetterSpacingAdjustment(letterSpacing()); … … 346 346 // position. 347 347 int glyph = controller.logClusters()[from]; 348 fromX = controller. xPositions()[glyph];348 fromX = controller.positions()[glyph].x(); 349 349 if (controller.rtl()) 350 350 fromX += truncateFixedPointToInteger(controller.advances()[glyph]); … … 354 354 if (toX == -1 && to >= 0 && static_cast<unsigned>(to) < controller.numCodePoints()) { 355 355 int glyph = controller.logClusters()[to]; 356 toX = controller. xPositions()[glyph];356 toX = controller.positions()[glyph].x(); 357 357 if (controller.rtl()) 358 358 toX += truncateFixedPointToInteger(controller.advances()[glyph]);
Note: See TracChangeset
for help on using the changeset viewer.