benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2009-2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ |
| 9 | |
| 10 | #include "SkFontConfigInterface.h" |
benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 11 | |
| 12 | #include <fontconfig/fontconfig.h> |
| 13 | |
| 14 | class SkFontConfigInterfaceDirect : public SkFontConfigInterface { |
| 15 | public: |
| 16 | SkFontConfigInterfaceDirect(); |
| 17 | ~SkFontConfigInterfaceDirect() override; |
| 18 | |
bungeman | 11a77c6 | 2016-04-12 13:45:06 -0700 | [diff] [blame] | 19 | bool matchFamilyName(const char familyName[], |
| 20 | SkFontStyle requested, |
| 21 | FontIdentity* outFontIdentifier, |
| 22 | SkString* outFamilyName, |
| 23 | SkFontStyle* outStyle) override; |
| 24 | |
benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 25 | SkStreamAsset* openStream(const FontIdentity&) override; |
| 26 | |
| 27 | // new APIs |
| 28 | SkDataTable* getFamilyNames() override; |
benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 29 | |
| 30 | protected: |
| 31 | virtual bool isAccessible(const char* filename); |
| 32 | |
| 33 | private: |
benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 34 | bool isValidPattern(FcPattern* pattern); |
| 35 | FcPattern* MatchFont(FcFontSet* font_set, const char* post_config_family, |
| 36 | const SkString& family); |
| 37 | typedef SkFontConfigInterface INHERITED; |
| 38 | }; |