blob: 3ccb390a706c56d87769385abcf6c78a5e216faa [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 */
9
10#include "SkFontConfigInterface.h"
benjaminwagner2211a7b2015-12-01 11:12:05 -080011
12#include <fontconfig/fontconfig.h>
13
14class SkFontConfigInterfaceDirect : public SkFontConfigInterface {
15public:
16 SkFontConfigInterfaceDirect();
17 ~SkFontConfigInterfaceDirect() override;
18
bungeman11a77c62016-04-12 13:45:06 -070019 bool matchFamilyName(const char familyName[],
20 SkFontStyle requested,
21 FontIdentity* outFontIdentifier,
22 SkString* outFamilyName,
23 SkFontStyle* outStyle) override;
24
benjaminwagner2211a7b2015-12-01 11:12:05 -080025 SkStreamAsset* openStream(const FontIdentity&) override;
26
27 // new APIs
28 SkDataTable* getFamilyNames() override;
benjaminwagner2211a7b2015-12-01 11:12:05 -080029
30protected:
31 virtual bool isAccessible(const char* filename);
32
33private:
benjaminwagner2211a7b2015-12-01 11:12:05 -080034 bool isValidPattern(FcPattern* pattern);
35 FcPattern* MatchFont(FcFontSet* font_set, const char* post_config_family,
36 const SkString& family);
37 typedef SkFontConfigInterface INHERITED;
38};