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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 extents->width = SkiaScalarToHarfBuzzPosition(skBounds.width()); | 155 extents->width = SkiaScalarToHarfBuzzPosition(skBounds.width()); |
156 extents->height = SkiaScalarToHarfBuzzPosition(-skBounds.height()); | 156 extents->height = SkiaScalarToHarfBuzzPosition(-skBounds.height()); |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 static hb_bool_t harfBuzzGetGlyph(hb_font_t* hbFont, void* fontData, hb_codepoin
t_t unicode, hb_codepoint_t variationSelector, hb_codepoint_t* glyph, void* user
Data) | 160 static hb_bool_t harfBuzzGetGlyph(hb_font_t* hbFont, void* fontData, hb_codepoin
t_t unicode, hb_codepoint_t variationSelector, hb_codepoint_t* glyph, void* user
Data) |
161 { | 161 { |
162 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData)
; | 162 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData)
; |
163 | 163 |
164 if (variationSelector) { | 164 if (variationSelector) { |
165 #if OS(LINUX) | 165 #if OS(LINUX) && !defined(OFFICIAL_BUILD) |
166 // TODO(kojii): Linux non-official builds cannot use new HB APIs | 166 // TODO(kojii): Linux non-official builds cannot use hb_ot_font_set_func
s() |
167 // until crbug.com/462689 resolved or pangoft2 updates its HB. | 167 // until we find a way to bundle HB in non-official builds, or pangoft2 |
| 168 // updates its HB. See crbug.com/462689. |
168 return false; | 169 return false; |
169 #else | 170 #else |
170 // Skia does not support variation selectors, but hb does. | 171 // Skia does not support variation selectors, but hb does. |
171 // We're not fully ready to switch to hb-ot-font yet, | 172 // We're not fully ready to switch to hb-ot-font yet, |
172 // but are good enough to get glyph IDs for OpenType fonts. | 173 // but are good enough to get glyph IDs for OpenType fonts. |
173 if (!hbFontData->m_hbOpenTypeFont) { | 174 if (!hbFontData->m_hbOpenTypeFont) { |
174 hbFontData->m_hbOpenTypeFont = hb_font_create(hbFontData->m_face); | 175 hbFontData->m_hbOpenTypeFont = hb_font_create(hbFontData->m_face); |
175 hb_ot_font_set_funcs(hbFontData->m_hbOpenTypeFont); | 176 hb_ot_font_set_funcs(hbFontData->m_hbOpenTypeFont); |
176 } | 177 } |
177 return hb_font_get_glyph(hbFontData->m_hbOpenTypeFont, unicode, variatio
nSelector, glyph); | 178 return hb_font_get_glyph(hbFontData->m_hbOpenTypeFont, unicode, variatio
nSelector, glyph); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 hb_font_t* font = hb_font_create(m_face); | 336 hb_font_t* font = hb_font_create(m_face); |
336 hb_font_set_funcs(font, harfBuzzSkiaGetFontFuncs(), hbFontData, destroyHarfB
uzzFontData); | 337 hb_font_set_funcs(font, harfBuzzSkiaGetFontFuncs(), hbFontData, destroyHarfB
uzzFontData); |
337 float size = m_platformData->size(); | 338 float size = m_platformData->size(); |
338 int scale = SkiaScalarToHarfBuzzPosition(size); | 339 int scale = SkiaScalarToHarfBuzzPosition(size); |
339 hb_font_set_scale(font, scale, scale); | 340 hb_font_set_scale(font, scale, scale); |
340 hb_font_make_immutable(font); | 341 hb_font_make_immutable(font); |
341 return font; | 342 return font; |
342 } | 343 } |
343 | 344 |
344 } // namespace blink | 345 } // namespace blink |
OLD | NEW |