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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 *x = SkiaScalarToHarfBuzzPosition(-result[0]); | 246 *x = SkiaScalarToHarfBuzzPosition(-result[0]); |
247 *y = SkiaScalarToHarfBuzzPosition(-result[1]); | 247 *y = SkiaScalarToHarfBuzzPosition(-result[1]); |
248 return true; | 248 return true; |
249 } | 249 } |
250 | 250 |
251 static hb_position_t harfBuzzGetGlyphVerticalAdvance(hb_font_t* hbFont, void* fo
ntData, hb_codepoint_t glyph, void* userData) | 251 static hb_position_t harfBuzzGetGlyphVerticalAdvance(hb_font_t* hbFont, void* fo
ntData, hb_codepoint_t glyph, void* userData) |
252 { | 252 { |
253 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData)
; | 253 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData)
; |
254 const OpenTypeVerticalData* verticalData = hbFontData->m_simpleFontData->ver
ticalData(); | 254 const OpenTypeVerticalData* verticalData = hbFontData->m_simpleFontData->ver
ticalData(); |
255 if (!verticalData) | 255 if (!verticalData) |
256 return SkiaScalarToHarfBuzzPosition(hbFontData->m_simpleFontData->fontMe
trics().height()); | 256 return SkiaScalarToHarfBuzzPosition(hbFontData->m_simpleFontData->getFon
tMetrics().height()); |
257 | 257 |
258 Glyph theGlyph = glyph; | 258 Glyph theGlyph = glyph; |
259 float advanceHeight = -verticalData->advanceHeight(hbFontData->m_simpleFontD
ata.get(), theGlyph); | 259 float advanceHeight = -verticalData->advanceHeight(hbFontData->m_simpleFontD
ata.get(), theGlyph); |
260 return SkiaScalarToHarfBuzzPosition(SkFloatToScalar(advanceHeight)); | 260 return SkiaScalarToHarfBuzzPosition(SkFloatToScalar(advanceHeight)); |
261 } | 261 } |
262 | 262 |
263 static hb_position_t harfBuzzGetGlyphHorizontalKerning(hb_font_t*, void* fontDat
a, hb_codepoint_t leftGlyph, hb_codepoint_t rightGlyph, void*) | 263 static hb_position_t harfBuzzGetGlyphHorizontalKerning(hb_font_t*, void* fontDat
a, hb_codepoint_t leftGlyph, hb_codepoint_t rightGlyph, void*) |
264 { | 264 { |
265 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData)
; | 265 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData)
; |
266 if (hbFontData->m_paint.isVerticalText()) { | 266 if (hbFontData->m_paint.isVerticalText()) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 hb_font_t* font = hb_font_create(m_face); | 359 hb_font_t* font = hb_font_create(m_face); |
360 hb_font_set_funcs(font, harfBuzzSkiaGetFontFuncs(), hbFontData, destroyHarfB
uzzFontData); | 360 hb_font_set_funcs(font, harfBuzzSkiaGetFontFuncs(), hbFontData, destroyHarfB
uzzFontData); |
361 float size = m_platformData->size(); | 361 float size = m_platformData->size(); |
362 int scale = SkiaScalarToHarfBuzzPosition(size); | 362 int scale = SkiaScalarToHarfBuzzPosition(size); |
363 hb_font_set_scale(font, scale, scale); | 363 hb_font_set_scale(font, scale, scale); |
364 hb_font_make_immutable(font); | 364 hb_font_make_immutable(font); |
365 return font; | 365 return font; |
366 } | 366 } |
367 | 367 |
368 } // namespace blink | 368 } // namespace blink |
OLD | NEW |