OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
3 * Copyright (c) 2014 BlackBerry Limited. All rights reserved. | 3 * Copyright (c) 2014 BlackBerry Limited. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "SkRect.h" | 38 #include "SkRect.h" |
39 #include "SkTypeface.h" | 39 #include "SkTypeface.h" |
40 #include "SkUtils.h" | 40 #include "SkUtils.h" |
41 #include "platform/fonts/FontPlatformData.h" | 41 #include "platform/fonts/FontPlatformData.h" |
42 #include "platform/fonts/SimpleFontData.h" | 42 #include "platform/fonts/SimpleFontData.h" |
43 #include "platform/fonts/harfbuzz/HarfBuzzShaper.h" | 43 #include "platform/fonts/harfbuzz/HarfBuzzShaper.h" |
44 | 44 |
45 #include "hb.h" | 45 #include "hb.h" |
46 #include "wtf/HashMap.h" | 46 #include "wtf/HashMap.h" |
47 | 47 |
48 namespace WebCore { | 48 namespace blink { |
49 | 49 |
50 // Our implementation of the callbacks which HarfBuzz requires by using Skia | 50 // Our implementation of the callbacks which HarfBuzz requires by using Skia |
51 // calls. See the HarfBuzz source for references about what these callbacks do. | 51 // calls. See the HarfBuzz source for references about what these callbacks do. |
52 | 52 |
53 struct HarfBuzzFontData { | 53 struct HarfBuzzFontData { |
54 HarfBuzzFontData(WTF::HashMap<uint32_t, uint16_t>* glyphCacheForFaceCacheEnt
ry) | 54 HarfBuzzFontData(WTF::HashMap<uint32_t, uint16_t>* glyphCacheForFaceCacheEnt
ry) |
55 : m_glyphCacheForFaceCacheEntry(glyphCacheForFaceCacheEntry) | 55 : m_glyphCacheForFaceCacheEntry(glyphCacheForFaceCacheEntry) |
56 { } | 56 { } |
57 SkPaint m_paint; | 57 SkPaint m_paint; |
58 WTF::HashMap<uint32_t, uint16_t>* m_glyphCacheForFaceCacheEntry; | 58 WTF::HashMap<uint32_t, uint16_t>* m_glyphCacheForFaceCacheEntry; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 m_platformData->setupPaint(&hbFontData->m_paint); | 227 m_platformData->setupPaint(&hbFontData->m_paint); |
228 hb_font_t* font = hb_font_create(m_face); | 228 hb_font_t* font = hb_font_create(m_face); |
229 hb_font_set_funcs(font, harfBuzzSkiaGetFontFuncs(), hbFontData, destroyHarfB
uzzFontData); | 229 hb_font_set_funcs(font, harfBuzzSkiaGetFontFuncs(), hbFontData, destroyHarfB
uzzFontData); |
230 float size = m_platformData->size(); | 230 float size = m_platformData->size(); |
231 int scale = SkiaScalarToHarfBuzzPosition(size); | 231 int scale = SkiaScalarToHarfBuzzPosition(size); |
232 hb_font_set_scale(font, scale, scale); | 232 hb_font_set_scale(font, scale, scale); |
233 hb_font_make_immutable(font); | 233 hb_font_make_immutable(font); |
234 return font; | 234 return font; |
235 } | 235 } |
236 | 236 |
237 } // namespace WebCore | 237 } // namespace blink |
OLD | NEW |