| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 static PassRefPtr<HarfBuzzFace> create(FontPlatformData* platformData, uint6
4_t uniqueID) | 54 static PassRefPtr<HarfBuzzFace> create(FontPlatformData* platformData, uint6
4_t uniqueID) |
| 55 { | 55 { |
| 56 return adoptRef(new HarfBuzzFace(platformData, uniqueID)); | 56 return adoptRef(new HarfBuzzFace(platformData, uniqueID)); |
| 57 } | 57 } |
| 58 ~HarfBuzzFace(); | 58 ~HarfBuzzFace(); |
| 59 | 59 |
| 60 // In order to support the restricting effect of unicode-range optionally a | 60 // In order to support the restricting effect of unicode-range optionally a |
| 61 // range restriction can be passed in, which will restrict which glyphs we | 61 // range restriction can be passed in, which will restrict which glyphs we |
| 62 // return in the harfBuzzGetGlyph function. | 62 // return in the harfBuzzGetGlyph function. |
| 63 hb_font_t* getScaledFont(PassRefPtr<UnicodeRangeSet> = nullptr); | 63 hb_font_t* getScaledFont(PassRefPtr<UnicodeRangeSet> = nullptr) const; |
| 64 hb_face_t* face() const { return m_face; } | |
| 65 | 64 |
| 66 private: | 65 private: |
| 67 HarfBuzzFace(FontPlatformData*, uint64_t); | 66 HarfBuzzFace(FontPlatformData*, uint64_t); |
| 68 | 67 |
| 69 hb_face_t* createFace(); | 68 hb_face_t* createFace(); |
| 70 void prepareHarfBuzzFontData(); | 69 void prepareHarfBuzzFontData(); |
| 71 | 70 |
| 72 FontPlatformData* m_platformData; | 71 FontPlatformData* m_platformData; |
| 73 uint64_t m_uniqueID; | 72 uint64_t m_uniqueID; |
| 74 hb_face_t* m_face; | 73 hb_font_t* m_unscaledFont; |
| 75 OwnPtr<hb_font_t> m_unscaledFont; | 74 HarfBuzzFontData* m_harfBuzzFontData; |
| 76 OwnPtr<HarfBuzzFontData> m_harfBuzzFontData; | |
| 77 }; | 75 }; |
| 78 | 76 |
| 79 } // namespace blink | 77 } // namespace blink |
| 80 | 78 |
| 81 namespace WTF { | 79 namespace WTF { |
| 82 | 80 |
| 83 template<typename T> struct OwnedPtrDeleter; | 81 template<typename T> struct OwnedPtrDeleter; |
| 84 template<> struct OwnedPtrDeleter<hb_font_t> { | 82 template<> struct OwnedPtrDeleter<hb_font_t> { |
| 85 STATIC_ONLY(OwnedPtrDeleter); | 83 STATIC_ONLY(OwnedPtrDeleter); |
| 86 static void deletePtr(hb_font_t* font) | 84 static void deletePtr(hb_font_t* font) |
| 87 { | 85 { |
| 88 if (font) | 86 if (font) |
| 89 hb_font_destroy(font); | 87 hb_font_destroy(font); |
| 90 } | 88 } |
| 91 }; | 89 }; |
| 92 | 90 |
| 91 template<typename T> struct OwnedPtrDeleter; |
| 92 template<> struct OwnedPtrDeleter<hb_face_t> { |
| 93 STATIC_ONLY(OwnedPtrDeleter); |
| 94 static void deletePtr(hb_face_t* face) |
| 95 { |
| 96 if (face) |
| 97 hb_face_destroy(face); |
| 98 } |
| 99 }; |
| 100 |
| 93 } // namespace WTF | 101 } // namespace WTF |
| 94 | 102 |
| 95 #endif // HarfBuzzFace_h | 103 #endif // HarfBuzzFace_h |
| OLD | NEW |