SkFontConfigInterface_direct.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */
  8. #ifndef SKFONTCONFIGINTERFACE_DIRECT_H_
  9. #define SKFONTCONFIGINTERFACE_DIRECT_H_
  10. #include "include/ports/SkFontConfigInterface.h"
  11. #include <fontconfig/fontconfig.h>
  12. class SkFontConfigInterfaceDirect : public SkFontConfigInterface {
  13. public:
  14. SkFontConfigInterfaceDirect();
  15. ~SkFontConfigInterfaceDirect() override;
  16. bool matchFamilyName(const char familyName[],
  17. SkFontStyle requested,
  18. FontIdentity* outFontIdentifier,
  19. SkString* outFamilyName,
  20. SkFontStyle* outStyle) override;
  21. SkStreamAsset* openStream(const FontIdentity&) override;
  22. protected:
  23. virtual bool isAccessible(const char* filename);
  24. private:
  25. bool isValidPattern(FcPattern* pattern);
  26. FcPattern* MatchFont(FcFontSet* font_set, const char* post_config_family,
  27. const SkString& family);
  28. typedef SkFontConfigInterface INHERITED;
  29. };
  30. #endif