OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 SkTypeface* typeface = hbFontData->m_paint.getTypeface(); | 252 SkTypeface* typeface = hbFontData->m_paint.getTypeface(); |
253 | 253 |
254 const uint16_t glyphs[2] = {static_cast<uint16_t>(leftGlyph), | 254 const uint16_t glyphs[2] = {static_cast<uint16_t>(leftGlyph), |
255 static_cast<uint16_t>(rightGlyph)}; | 255 static_cast<uint16_t>(rightGlyph)}; |
256 int32_t kerningAdjustments[1] = {0}; | 256 int32_t kerningAdjustments[1] = {0}; |
257 | 257 |
258 if (typeface->getKerningPairAdjustments(glyphs, 2, kerningAdjustments)) { | 258 if (typeface->getKerningPairAdjustments(glyphs, 2, kerningAdjustments)) { |
259 SkScalar upm = SkIntToScalar(typeface->getUnitsPerEm()); | 259 SkScalar upm = SkIntToScalar(typeface->getUnitsPerEm()); |
260 SkScalar size = hbFontData->m_paint.getTextSize(); | 260 SkScalar size = hbFontData->m_paint.getTextSize(); |
261 return SkiaScalarToHarfBuzzPosition( | 261 return SkiaScalarToHarfBuzzPosition(SkIntToScalar(kerningAdjustments[0]) * |
262 SkScalarMulDiv(SkIntToScalar(kerningAdjustments[0]), size, upm)); | 262 size / upm); |
263 } | 263 } |
264 | 264 |
265 return 0; | 265 return 0; |
266 } | 266 } |
267 | 267 |
268 static hb_bool_t harfBuzzGetGlyphExtents(hb_font_t* hbFont, | 268 static hb_bool_t harfBuzzGetGlyphExtents(hb_font_t* hbFont, |
269 void* fontData, | 269 void* fontData, |
270 hb_codepoint_t glyph, | 270 hb_codepoint_t glyph, |
271 hb_glyph_extents_t* extents, | 271 hb_glyph_extents_t* extents, |
272 void* userData) { | 272 void* userData) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 389 |
390 // TODO crbug.com/674879 - Connect variation axis parameters to future | 390 // TODO crbug.com/674879 - Connect variation axis parameters to future |
391 // HarfBuzz API here. | 391 // HarfBuzz API here. |
392 ASSERT(m_harfBuzzFontData->m_simpleFontData); | 392 ASSERT(m_harfBuzzFontData->m_simpleFontData); |
393 int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size()); | 393 int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size()); |
394 hb_font_set_scale(m_unscaledFont, scale, scale); | 394 hb_font_set_scale(m_unscaledFont, scale, scale); |
395 return m_unscaledFont; | 395 return m_unscaledFont; |
396 } | 396 } |
397 | 397 |
398 } // namespace blink | 398 } // namespace blink |
OLD | NEW |