diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-15 20:48:52 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-15 20:48:52 +0000 |
commit | 300790e228751661e1245c774b967b6cc50ffa1b (patch) | |
tree | 5e6b79c93550312c75301d5782110ee7cf9d67f1 /src/core | |
parent | b3b0cfc4d4c72e0b5f0ab2e53c1e2213e0b4ce90 (diff) |
hack to expand 'pad' to account for very wide glyphs
BUG=crbug.com/373785
R=mtklein@google.com, robertphillips@google.com, bungeman@google.com, eae@chromium.org
Author: reed@google.com
Review URL: https://codereview.chromium.org/288923006
git-svn-id: http://skia.googlecode.com/svn/trunk@14755 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBBoxRecord.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/SkBBoxRecord.cpp b/src/core/SkBBoxRecord.cpp index 0dadb5c382..b1c229e68b 100644 --- a/src/core/SkBBoxRecord.cpp +++ b/src/core/SkBBoxRecord.cpp @@ -165,6 +165,18 @@ void SkBBoxRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, } } +// Hack to work-around https://code.google.com/p/chromium/issues/detail?id=373785 +// This logic assums that 'pad' is enough to add to the left and right to account for +// big glyphs. For the font in question (a logo font) the glyphs is much wider than just +// the pointsize (approx 3x wider). +// As a temp work-around, we scale-up pad. +// A more correct fix might be to add fontmetrics.fMaxX, but we don't have that value in hand +// at the moment, and (possibly) the value in the font may not be accurate (but who knows). +// +static SkScalar hack_373785_amend_pad(SkScalar pad) { + return pad * 4; +} + void SkBBoxRecord::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[], const SkPaint& paint) { SkRect bbox; @@ -176,6 +188,7 @@ void SkBBoxRecord::onDrawPosText(const void* text, size_t byteLength, const SkPo // pad on left and right by half of max vertical glyph extents SkScalar pad = (metrics.fTop - metrics.fBottom) / 2; + pad = hack_373785_amend_pad(pad); bbox.fLeft += pad; bbox.fRight -= pad; @@ -212,6 +225,7 @@ void SkBBoxRecord::onDrawPosTextH(const void* text, size_t byteLength, const SkS } // pad horizontally by max glyph height + pad = hack_373785_amend_pad(pad); bbox.fLeft += pad; bbox.fRight -= pad; |