blob: ac81cfff1e0989261e20da05cd91f92b6907c32b [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
12#include "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);
36 typedef SkFontConfigInterface INHERITED;
37};
Ben Wagner1700baf2017-10-10 13:12:33 -040038
39#endif