| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef HarfBuzzFace_h | 31 #ifndef HarfBuzzFace_h |
| 32 #define HarfBuzzFace_h | 32 #define HarfBuzzFace_h |
| 33 | 33 |
| 34 #include "platform/fonts/UnicodeRangeSet.h" | |
| 35 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
| 36 #include "wtf/HashMap.h" | 35 #include "wtf/HashMap.h" |
| 37 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
| 38 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
| 39 #include "wtf/RefCounted.h" | 38 #include "wtf/RefCounted.h" |
| 40 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 41 #include "wtf/text/CharacterNames.h" | 40 #include "wtf/text/CharacterNames.h" |
| 42 | 41 |
| 43 #include <hb.h> | 42 #include <hb.h> |
| 44 | 43 |
| 45 namespace blink { | 44 namespace blink { |
| 46 | 45 |
| 47 class FontPlatformData; | 46 class FontPlatformData; |
| 48 | 47 |
| 49 class HarfBuzzFace : public RefCounted<HarfBuzzFace> { | 48 class HarfBuzzFace : public RefCounted<HarfBuzzFace> { |
| 50 WTF_MAKE_NONCOPYABLE(HarfBuzzFace); | 49 WTF_MAKE_NONCOPYABLE(HarfBuzzFace); |
| 51 public: | 50 public: |
| 52 static const hb_tag_t vertTag; | 51 static const hb_tag_t vertTag; |
| 53 static const hb_tag_t vrt2Tag; | 52 static const hb_tag_t vrt2Tag; |
| 54 | 53 |
| 55 static PassRefPtr<HarfBuzzFace> create(FontPlatformData* platformData, uint6
4_t uniqueID) | 54 static PassRefPtr<HarfBuzzFace> create(FontPlatformData* platformData, uint6
4_t uniqueID) |
| 56 { | 55 { |
| 57 return adoptRef(new HarfBuzzFace(platformData, uniqueID)); | 56 return adoptRef(new HarfBuzzFace(platformData, uniqueID)); |
| 58 } | 57 } |
| 59 ~HarfBuzzFace(); | 58 ~HarfBuzzFace(); |
| 60 | 59 |
| 61 // 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 |
| 62 // 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 |
| 63 // return in the harfBuzzGetGlyph function. | 62 // return in the harfBuzzGetGlyph function. |
| 64 hb_font_t* createFont(PassRefPtr<UnicodeRangeSet> = nullptr) const; | 63 hb_font_t* createFont(unsigned rangeFrom = 0, unsigned rangeTo = kMaxCodepoi
nt) const; |
| 65 hb_face_t* face() const { return m_face; } | 64 hb_face_t* face() const { return m_face; } |
| 66 | 65 |
| 67 private: | 66 private: |
| 68 HarfBuzzFace(FontPlatformData*, uint64_t); | 67 HarfBuzzFace(FontPlatformData*, uint64_t); |
| 69 | 68 |
| 70 hb_face_t* createFace(); | 69 hb_face_t* createFace(); |
| 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_face_t* m_face; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 85 static void deletePtr(hb_font_t* font) | 84 static void deletePtr(hb_font_t* font) |
| 86 { | 85 { |
| 87 if (font) | 86 if (font) |
| 88 hb_font_destroy(font); | 87 hb_font_destroy(font); |
| 89 } | 88 } |
| 90 }; | 89 }; |
| 91 | 90 |
| 92 } // namespace WTF | 91 } // namespace WTF |
| 93 | 92 |
| 94 #endif // HarfBuzzFace_h | 93 #endif // HarfBuzzFace_h |
| OLD | NEW |