| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkFontConfigInterface_DEFINED | 8 #ifndef SkFontConfigInterface_DEFINED |
| 9 #define SkFontConfigInterface_DEFINED | 9 #define SkFontConfigInterface_DEFINED |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 * to be a union of possible storage types to aid the impl. | 42 * to be a union of possible storage types to aid the impl. |
| 43 */ | 43 */ |
| 44 struct FontIdentity { | 44 struct FontIdentity { |
| 45 FontIdentity() : fID(0), fTTCIndex(0) {} | 45 FontIdentity() : fID(0), fTTCIndex(0) {} |
| 46 | 46 |
| 47 bool operator==(const FontIdentity& other) const { | 47 bool operator==(const FontIdentity& other) const { |
| 48 return fID == other.fID && | 48 return fID == other.fID && |
| 49 fTTCIndex == other.fTTCIndex && | 49 fTTCIndex == other.fTTCIndex && |
| 50 fString == other.fString; | 50 fString == other.fString; |
| 51 } | 51 } |
| 52 bool operator!=(const FontIdentity& other) const { |
| 53 return !(*this == other); |
| 54 } |
| 52 | 55 |
| 53 uint32_t fID; | 56 uint32_t fID; |
| 54 int32_t fTTCIndex; | 57 int32_t fTTCIndex; |
| 55 SkString fString; | 58 SkString fString; |
| 56 SkFontStyle fStyle; | 59 SkFontStyle fStyle; |
| 60 |
| 61 // If buffer is NULL, just return the number of bytes that would have |
| 62 // been written. Will pad contents to a multiple of 4. |
| 63 size_t writeToMemory(void* buffer = NULL) const; |
| 64 |
| 65 // Recreate from a flattened buffer, returning the number of bytes read. |
| 66 size_t readFromMemory(const void* buffer, size_t length); |
| 57 }; | 67 }; |
| 58 | 68 |
| 59 /** | 69 /** |
| 60 * Given a familyName and style, find the best match. | 70 * Given a familyName and style, find the best match. |
| 61 * | 71 * |
| 62 * If a match is found, return true and set its outFontIdentifier. | 72 * If a match is found, return true and set its outFontIdentifier. |
| 63 * If outFamilyName is not null, assign the found familyName to it | 73 * If outFamilyName is not null, assign the found familyName to it |
| 64 * (which may differ from the requested familyName). | 74 * (which may differ from the requested familyName). |
| 65 * If outStyle is not null, assign the found style to it | 75 * If outStyle is not null, assign the found style to it |
| 66 * (which may differ from the requested style). | 76 * (which may differ from the requested style). |
| (...skipping 23 matching lines...) Expand all Loading... |
| 90 | 100 |
| 91 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } | 101 virtual SkDataTable* getFamilyNames() { return SkDataTable::NewEmpty(); } |
| 92 virtual bool matchFamilySet(const char inFamilyName[], | 102 virtual bool matchFamilySet(const char inFamilyName[], |
| 93 SkString* outFamilyName, | 103 SkString* outFamilyName, |
| 94 SkTArray<FontIdentity>*) { | 104 SkTArray<FontIdentity>*) { |
| 95 return false; | 105 return false; |
| 96 } | 106 } |
| 97 }; | 107 }; |
| 98 | 108 |
| 99 #endif | 109 #endif |
| OLD | NEW |