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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 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) | 87 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) |
88 { | 88 { |
89 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData)
; | 89 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData)
; |
90 | 90 |
91 WTF::HashMap<uint32_t, uint16_t>::AddResult result = hbFontData->m_glyphCach
eForFaceCacheEntry->add(unicode, 0); | 91 WTF::HashMap<uint32_t, uint16_t>::AddResult result = hbFontData->m_glyphCach
eForFaceCacheEntry->add(unicode, 0); |
92 if (result.isNewEntry) { | 92 if (result.isNewEntry) { |
93 SkPaint* paint = &hbFontData->m_paint; | 93 SkPaint* paint = &hbFontData->m_paint; |
94 paint->setTextEncoding(SkPaint::kUTF32_TextEncoding); | 94 paint->setTextEncoding(SkPaint::kUTF32_TextEncoding); |
95 uint16_t glyph16; | 95 uint16_t glyph16; |
96 paint->textToGlyphs(&unicode, sizeof(hb_codepoint_t), &glyph16); | 96 paint->textToGlyphs(&unicode, sizeof(hb_codepoint_t), &glyph16); |
97 result.iterator->value = glyph16; | 97 result.storedValue->value = glyph16; |
98 *glyph = glyph16; | 98 *glyph = glyph16; |
99 } | 99 } |
100 *glyph = result.iterator->value; | 100 *glyph = result.storedValue->value; |
101 return !!*glyph; | 101 return !!*glyph; |
102 } | 102 } |
103 | 103 |
104 static hb_position_t harfBuzzGetGlyphHorizontalAdvance(hb_font_t* hbFont, void*
fontData, hb_codepoint_t glyph, void* userData) | 104 static hb_position_t harfBuzzGetGlyphHorizontalAdvance(hb_font_t* hbFont, void*
fontData, hb_codepoint_t glyph, void* userData) |
105 { | 105 { |
106 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData)
; | 106 HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData)
; |
107 hb_position_t advance = 0; | 107 hb_position_t advance = 0; |
108 | 108 |
109 SkiaGetGlyphWidthAndExtents(&hbFontData->m_paint, glyph, &advance, 0); | 109 SkiaGetGlyphWidthAndExtents(&hbFontData->m_paint, glyph, &advance, 0); |
110 return advance; | 110 return advance; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 hb_font_make_immutable(font); | 187 hb_font_make_immutable(font); |
188 return font; | 188 return font; |
189 } | 189 } |
190 | 190 |
191 GlyphBufferAdvance HarfBuzzShaper::createGlyphBufferAdvance(float width, float h
eight) | 191 GlyphBufferAdvance HarfBuzzShaper::createGlyphBufferAdvance(float width, float h
eight) |
192 { | 192 { |
193 return GlyphBufferAdvance(width, height); | 193 return GlyphBufferAdvance(width, height); |
194 } | 194 } |
195 | 195 |
196 } // namespace WebCore | 196 } // namespace WebCore |
OLD | NEW |