Index: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp |
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp |
index 48e587be4220550748f7a0c032f79a2c3f11d2e9..39c0c02a6cf1202bdd050460a7382ff40113a4aa 100644 |
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp |
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp |
@@ -45,6 +45,7 @@ |
#include "platform/fonts/SimpleFontData.h" |
#include "platform/fonts/shaping/HarfBuzzShaper.h" |
#include "wtf/HashMap.h" |
+#include "wtf/MathExtras.h" |
namespace blink { |
@@ -138,7 +139,9 @@ public: |
static hb_position_t SkiaScalarToHarfBuzzPosition(SkScalar value) |
{ |
- return SkScalarToFixed(value); |
+ // We treat HarfBuzz hb_position_t as 16.16 fixed-point. |
+ static const int kHbPosition1 = 1 << 16; |
+ return clampTo<int>(value * kHbPosition1); |
} |
static void SkiaGetGlyphWidthAndExtents(SkPaint* paint, hb_codepoint_t codepoint, hb_position_t* width, hb_glyph_extents_t* extents) |