| Index: ui/gfx/harfbuzz_font_skia.cc
|
| diff --git a/ui/gfx/harfbuzz_font_skia.cc b/ui/gfx/harfbuzz_font_skia.cc
|
| index 723b68aedc9277d6947111b00cbe9b11750d1e13..e2adeaff4d91f5e3186626491fca4709855ccfd9 100644
|
| --- a/ui/gfx/harfbuzz_font_skia.cc
|
| +++ b/ui/gfx/harfbuzz_font_skia.cc
|
| @@ -16,6 +16,7 @@
|
| #include "third_party/skia/include/core/SkPaint.h"
|
| #include "third_party/skia/include/core/SkTypeface.h"
|
| #include "ui/gfx/render_text.h"
|
| +#include "ui/gfx/skia_util.h"
|
|
|
| namespace gfx {
|
|
|
| @@ -65,14 +66,14 @@ void GetGlyphWidthAndExtents(SkPaint* paint,
|
|
|
| paint->getTextWidths(&glyph, sizeof(glyph), &sk_width, &sk_bounds);
|
| if (width)
|
| - *width = SkScalarToFixed(sk_width);
|
| + *width = SkiaScalarToHarfBuzzUnits(sk_width);
|
| if (extents) {
|
| // Invert y-axis because Skia is y-grows-down but we set up HarfBuzz to be
|
| // y-grows-up.
|
| - extents->x_bearing = SkScalarToFixed(sk_bounds.fLeft);
|
| - extents->y_bearing = SkScalarToFixed(-sk_bounds.fTop);
|
| - extents->width = SkScalarToFixed(sk_bounds.width());
|
| - extents->height = SkScalarToFixed(-sk_bounds.height());
|
| + extents->x_bearing = SkiaScalarToHarfBuzzUnits(sk_bounds.fLeft);
|
| + extents->y_bearing = SkiaScalarToHarfBuzzUnits(-sk_bounds.fTop);
|
| + extents->width = SkiaScalarToHarfBuzzUnits(sk_bounds.width());
|
| + extents->height = SkiaScalarToHarfBuzzUnits(-sk_bounds.height());
|
| }
|
| }
|
|
|
| @@ -132,7 +133,7 @@ hb_position_t GetGlyphKerning(FontData* font_data,
|
|
|
| SkScalar upm = SkIntToScalar(typeface->getUnitsPerEm());
|
| SkScalar size = font_data->paint_.getTextSize();
|
| - return SkScalarToFixed(
|
| + return SkiaScalarToHarfBuzzUnits(
|
| SkScalarMulDiv(SkIntToScalar(kerning_adjustments[0]), size, upm));
|
| }
|
|
|
| @@ -271,7 +272,7 @@ hb_font_t* CreateHarfBuzzFont(SkTypeface* skia_face,
|
| face_cache->first.Init(skia_face);
|
|
|
| hb_font_t* harfbuzz_font = hb_font_create(face_cache->first.get());
|
| - const int scale = SkScalarToFixed(text_size);
|
| + const int scale = SkiaScalarToHarfBuzzUnits(text_size);
|
| hb_font_set_scale(harfbuzz_font, scale, scale);
|
| FontData* hb_font_data = new FontData(&face_cache->second);
|
| hb_font_data->paint_.setTypeface(skia_face);
|
|
|