Chromium Code Reviews| 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 |
| 11 #include "SkFontStyle.h" | |
| 11 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
| 12 #include "SkTypeface.h" | 13 #include "SkTypeface.h" |
| 13 | 14 |
| 14 /** | 15 /** |
| 15 * \class SkFontConfigInterface | 16 * \class SkFontConfigInterface |
| 16 * | 17 * |
| 17 * Provides SkFontHost clients with access to fontconfig services. They will | 18 * Provides SkFontHost clients with access to fontconfig services. They will |
| 18 * access the global instance found in RefGlobal(). | 19 * access the global instance found in RefGlobal(). |
| 19 */ | 20 */ |
| 20 class SK_API SkFontConfigInterface : public SkRefCnt { | 21 class SK_API SkFontConfigInterface : public SkRefCnt { |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 43 | 44 |
| 44 bool operator==(const FontIdentity& other) const { | 45 bool operator==(const FontIdentity& other) const { |
| 45 return fID == other.fID && | 46 return fID == other.fID && |
| 46 fTTCIndex == other.fTTCIndex && | 47 fTTCIndex == other.fTTCIndex && |
| 47 fString == other.fString; | 48 fString == other.fString; |
| 48 } | 49 } |
| 49 | 50 |
| 50 uint32_t fID; | 51 uint32_t fID; |
| 51 int32_t fTTCIndex; | 52 int32_t fTTCIndex; |
| 52 SkString fString; | 53 SkString fString; |
| 54 SkFontStyle fStyle; | |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 /** | 57 /** |
| 56 * Given a familyName and style, find the best match. | 58 * Given a familyName and style, find the best match. |
| 57 * | 59 * |
| 58 * If a match is found, return true and set its outFontIdentifier. | 60 * If a match is found, return true and set its outFontIdentifier. |
| 59 * If outFamilyName is not null, assign the found familyName to it | 61 * If outFamilyName is not null, assign the found familyName to it |
| 60 * (which may differ from the requested familyName). | 62 * (which may differ from the requested familyName). |
| 61 * If outStyle is not null, assign the found style to it | 63 * If outStyle is not null, assign the found style to it |
| 62 * (which may differ from the requested style). | 64 * (which may differ from the requested style). |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 74 * if the FontRef's data is not available. The caller is responsible for | 76 * if the FontRef's data is not available. The caller is responsible for |
| 75 * calling stream->unref() when it is done accessing the data. | 77 * calling stream->unref() when it is done accessing the data. |
| 76 */ | 78 */ |
| 77 virtual SkStream* openStream(const FontIdentity&) = 0; | 79 virtual SkStream* openStream(const FontIdentity&) = 0; |
| 78 | 80 |
| 79 /** | 81 /** |
| 80 * Return a singleton instance of a direct subclass that calls into | 82 * Return a singleton instance of a direct subclass that calls into |
| 81 * libfontconfig. This does not affect the refcnt of the returned instance. | 83 * libfontconfig. This does not affect the refcnt of the returned instance. |
| 82 */ | 84 */ |
| 83 static SkFontConfigInterface* GetSingletonDirectInterface(); | 85 static SkFontConfigInterface* GetSingletonDirectInterface(); |
| 86 | |
| 87 // New APIS, which have default impls for now (which do nothing) | |
| 88 | |
| 89 virtual int countFamilies(); | |
| 90 virtual int getFamilySet(int index, SkString* outFamilyName, | |
| 91 FontIdentity outIdentities[], int maxCount); | |
| 92 virtual int matchFamilySet(const char familyName[], SkString* outFamilyName, | |
| 93 FontIdentity outIdentities[], int maxCount); | |
| 84 }; | 94 }; |
|
bungeman-skia
2013/03/29 21:13:37
Maybe we also want matchFamilyStyle which does 'sy
| |
| 85 | 95 |
| 86 #endif | 96 #endif |
| OLD | NEW |