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