• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef SKFONTCONFIGINTERFACE_DIRECT_H_
10 #define SKFONTCONFIGINTERFACE_DIRECT_H_
11 
12 #include "include/ports/SkFontConfigInterface.h"
13 
14 #include <fontconfig/fontconfig.h>
15 
16 class SkFontConfigInterfaceDirect : public SkFontConfigInterface {
17 public:
18     SkFontConfigInterfaceDirect();
19     ~SkFontConfigInterfaceDirect() override;
20 
21     bool matchFamilyName(const char familyName[],
22                          SkFontStyle requested,
23                          FontIdentity* outFontIdentifier,
24                          SkString* outFamilyName,
25                          SkFontStyle* outStyle) override;
26 
27     SkStreamAsset* openStream(const FontIdentity&) override;
28 
29 protected:
30     virtual bool isAccessible(const char* filename);
31 
32 private:
33     bool isValidPattern(FcPattern* pattern);
34     FcPattern* MatchFont(FcFontSet* font_set, const char* post_config_family,
35                          const SkString& family);
36     using INHERITED = SkFontConfigInterface;
37 };
38 
39 #endif
40