Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 299313009: Revert of Merge HarfBuzz kerning support from Blink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_harfbuzz.cc
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc
index 959b06c9a658d5abe409a541748e8c2a0a2f8a33..10e7a1a5276931a44ad6e8ff6643d5a03bba9ed9 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -126,50 +126,6 @@
return true;
}
-hb_position_t GetGlyphKerning(FontData* font_data,
- hb_codepoint_t first_glyph,
- hb_codepoint_t second_glyph) {
- SkTypeface* typeface = font_data->paint_.getTypeface();
- const uint16_t glyphs[2] = { first_glyph, second_glyph };
- int32_t kerning_adjustments[1] = { 0 };
-
- if (!typeface->getKerningPairAdjustments(glyphs, 2, kerning_adjustments))
- return 0;
-
- SkScalar upm = SkIntToScalar(typeface->getUnitsPerEm());
- SkScalar size = font_data->paint_.getTextSize();
- return SkiaScalarToHarfBuzzPosition(
- SkScalarMulDiv(SkIntToScalar(kerning_adjustments[0]), size, upm));
-}
-
-hb_position_t GetGlyphHorizontalKerning(hb_font_t* font,
- void* data,
- hb_codepoint_t left_glyph,
- hb_codepoint_t right_glyph,
- void* user_data) {
- FontData* font_data = reinterpret_cast<FontData*>(data);
- if (font_data->paint_.isVerticalText()) {
- // We don't support cross-stream kerning.
- return 0;
- }
-
- return GetGlyphKerning(font_data, left_glyph, right_glyph);
-}
-
-hb_position_t GetGlyphVerticalKerning(hb_font_t* font,
- void* data,
- hb_codepoint_t top_glyph,
- hb_codepoint_t bottom_glyph,
- void* user_data) {
- FontData* font_data = reinterpret_cast<FontData*>(data);
- if (!font_data->paint_.isVerticalText()) {
- // We don't support cross-stream kerning.
- return 0;
- }
-
- return GetGlyphKerning(font_data, top_glyph, bottom_glyph);
-}
-
// Writes the |extents| of |glyph|.
hb_bool_t GetGlyphExtents(hb_font_t* font,
void* data,
@@ -188,6 +144,7 @@
// We don't set callback functions which we can't support.
// HarfBuzz will use the fallback implementation if they aren't set.
+ // TODO(ckocagil): Merge Blink's kerning funcs.
if (!font_funcs) {
// The object created by |hb_font_funcs_create()| below lives indefinitely
// and is intentionally leaked.
@@ -195,12 +152,8 @@
hb_font_funcs_set_glyph_func(font_funcs, GetGlyph, 0, 0);
hb_font_funcs_set_glyph_h_advance_func(
font_funcs, GetGlyphHorizontalAdvance, 0, 0);
- hb_font_funcs_set_glyph_h_kerning_func(
- font_funcs, GetGlyphHorizontalKerning, 0, 0);
hb_font_funcs_set_glyph_h_origin_func(
font_funcs, GetGlyphHorizontalOrigin, 0, 0);
- hb_font_funcs_set_glyph_v_kerning_func(
- font_funcs, GetGlyphVerticalKerning, 0, 0);
hb_font_funcs_set_glyph_extents_func(
font_funcs, GetGlyphExtents, 0, 0);
hb_font_funcs_make_immutable(font_funcs);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698