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 */ |
Ben Wagner | 1700baf | 2017-10-10 13:12:33 -0400 | [diff] [blame] | 9 | #ifndef SKFONTCONFIGINTERFACE_DIRECT_H_ |
| 10 | #define SKFONTCONFIGINTERFACE_DIRECT_H_ |
benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 11 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "include/ports/SkFontConfigInterface.h" |
benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 13 | |
| 14 | #include <fontconfig/fontconfig.h> |
| 15 | |
| 16 | class SkFontConfigInterfaceDirect : public SkFontConfigInterface { |
| 17 | public: |
| 18 | SkFontConfigInterfaceDirect(); |
| 19 | ~SkFontConfigInterfaceDirect() override; |
| 20 | |
bungeman | 11a77c6 | 2016-04-12 13:45:06 -0700 | [diff] [blame] | 21 | bool matchFamilyName(const char familyName[], |
| 22 | SkFontStyle requested, |
| 23 | FontIdentity* outFontIdentifier, |
| 24 | SkString* outFamilyName, |
| 25 | SkFontStyle* outStyle) override; |
| 26 | |
benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 27 | SkStreamAsset* openStream(const FontIdentity&) override; |
| 28 | |
benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 29 | protected: |
| 30 | virtual bool isAccessible(const char* filename); |
| 31 | |
| 32 | private: |
benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 33 | bool isValidPattern(FcPattern* pattern); |
| 34 | FcPattern* MatchFont(FcFontSet* font_set, const char* post_config_family, |
| 35 | const SkString& family); |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 36 | using INHERITED = SkFontConfigInterface; |
benjaminwagner | 2211a7b | 2015-12-01 11:12:05 -0800 | [diff] [blame] | 37 | }; |
Ben Wagner | 1700baf | 2017-10-10 13:12:33 -0400 | [diff] [blame] | 38 | |
| 39 | #endif |