blob: 8293bfd99b20365e42b5be1dcd7f027efdeeca82 [file] [log] [blame]
benjaminwagner2211a7b2015-12-01 11:12:05 -08001/*
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 Wagner1700baf2017-10-10 13:12:33 -04009#ifndef SKFONTCONFIGINTERFACE_DIRECT_H_
10#define SKFONTCONFIGINTERFACE_DIRECT_H_
benjaminwagner2211a7b2015-12-01 11:12:05 -080011
Mike Kleinc0bd9f92019-04-23 12:05:21 -050012#include "include/ports/SkFontConfigInterface.h"
benjaminwagner2211a7b2015-12-01 11:12:05 -080013
14#include <fontconfig/fontconfig.h>
15
16class SkFontConfigInterfaceDirect : public SkFontConfigInterface {
17public:
18 SkFontConfigInterfaceDirect();
19 ~SkFontConfigInterfaceDirect() override;
20
bungeman11a77c62016-04-12 13:45:06 -070021 bool matchFamilyName(const char familyName[],
22 SkFontStyle requested,
23 FontIdentity* outFontIdentifier,
24 SkString* outFamilyName,
25 SkFontStyle* outStyle) override;
26
benjaminwagner2211a7b2015-12-01 11:12:05 -080027 SkStreamAsset* openStream(const FontIdentity&) override;
28
benjaminwagner2211a7b2015-12-01 11:12:05 -080029protected:
30 virtual bool isAccessible(const char* filename);
31
32private:
benjaminwagner2211a7b2015-12-01 11:12:05 -080033 bool isValidPattern(FcPattern* pattern);
34 FcPattern* MatchFont(FcFontSet* font_set, const char* post_config_family,
35 const SkString& family);
John Stiles7571f9e2020-09-02 22:42:33 -040036 using INHERITED = SkFontConfigInterface;
benjaminwagner2211a7b2015-12-01 11:12:05 -080037};
Ben Wagner1700baf2017-10-10 13:12:33 -040038
39#endif