Reland "Don't refcount tracking id -> slot id mapping."
[chromium-blink-merge.git] / ui / gfx / test / fontconfig_util_linux.h
blobc45b85eb7387fa55971a0d882ee012666000586b
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_
8 #include <string>
10 #include "base/files/file_path.h"
12 namespace gfx {
14 // Array of paths to font files that are expected to exist on machines where
15 // tests are run.
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 kFontconfigMatchFontHeader[];
25 extern const char kFontconfigMatchPatternHeader[];
26 extern const char kFontconfigMatchFooter[];
28 // Initializes Fontconfig and creates and swaps in a new, empty config.
29 void SetUpFontconfig();
31 // Deinitializes Fontconfig.
32 void TearDownFontconfig();
34 // Loads the font file at |path| into the current config, returning true on
35 // success.
36 bool LoadFontIntoFontconfig(const base::FilePath& path);
38 // Instructs Fontconfig to load |path|, an XML configuration file, into the
39 // current config, returning true on success.
40 bool LoadConfigFileIntoFontconfig(const base::FilePath& path);
42 // Writes |data| to a file in |temp_dir| and passes it to
43 // LoadConfigFileIntoFontconfig().
44 bool LoadConfigDataIntoFontconfig(const base::FilePath& temp_dir,
45 const std::string& data);
47 // Returns a Fontconfig <edit> stanza.
48 std::string CreateFontconfigEditStanza(const std::string& name,
49 const std::string& type,
50 const std::string& value);
52 // Returns a Fontconfig <test> stanza.
53 std::string CreateFontconfigTestStanza(const std::string& name,
54 const std::string& op,
55 const std::string& type,
56 const std::string& value);
58 // Returns a Fontconfig <alias> stanza.
59 std::string CreateFontconfigAliasStanza(const std::string& original_family,
60 const std::string& preferred_family);
62 } // namespace gfx
64 #endif // UI_GFX_TEST_FONTCONFIG_UTIL_LINUX_H_