1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_GFX_TEST_FONTCONFIG_UTIL_LINUX_H_
6 #define UI_GFX_TEST_FONTCONFIG_UTIL_LINUX_H_
10 #include "base/files/file_path.h"
14 // Array of paths to font files that are expected to exist on machines where
16 extern const char* const kSystemFontsForFontconfig[];
17 extern const size_t kNumSystemFontsForFontconfig;
19 // Strings appearing at the beginning and end of Fontconfig XML files.
20 extern const char kFontconfigFileHeader[];
21 extern const char kFontconfigFileFooter[];
23 // Strings appearing at the beginning and end of Fontconfig <match> stanzas.
24 extern const char kFontconfigMatchHeader[];
25 extern const char kFontconfigMatchFooter[];
27 // Initializes Fontconfig and creates and swaps in a new, empty config.
28 void SetUpFontconfig();
30 // Deinitializes Fontconfig.
31 void TearDownFontconfig();
33 // Loads the font file at |path| into the current config, returning true on
35 bool LoadFontIntoFontconfig(const base::FilePath& path);
37 // Instructs Fontconfig to load |path|, an XML configuration file, into the
38 // current config, returning true on success.
39 bool LoadConfigFileIntoFontconfig(const base::FilePath& path);
41 // Writes |data| to a file in |temp_dir| and passes it to
42 // LoadConfigFileIntoFontconfig().
43 bool LoadConfigDataIntoFontconfig(const base::FilePath& temp_dir,
44 const std::string& data);
46 // Returns a Fontconfig <edit> stanza.
47 std::string CreateFontconfigEditStanza(const std::string& name,
48 const std::string& type,
49 const std::string& value);
51 // Returns a Fontconfig <test> stanza.
52 std::string CreateFontconfigTestStanza(const std::string& name,
53 const std::string& op,
54 const std::string& type,
55 const std::string& value);
57 // Returns a Fontconfig <alias> stanza.
58 std::string CreateFontconfigAliasStanza(const std::string& original_family,
59 const std::string& preferred_family);
63 #endif // UI_GFX_TEST_FONTCONFIG_UTIL_LINUX_H_