[Android WebView] Put AndroidStreamReaderURLRequestJob into a namespace
[chromium-blink-merge.git] / ui / gfx / test / fontconfig_util_linux.h
blob688c780b501271596e3b115ba29780c07eccc592
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 // Loads the first system font in kSystemFontsForFontconfig with a base filename
39 // of |basename|. Case is ignored. FcFontMatch() requires there to be at least
40 // one font present.
41 bool LoadSystemFontIntoFontconfig(const std::string& basename);
43 // Instructs Fontconfig to load |path|, an XML configuration file, into the
44 // current config, returning true on success.
45 bool LoadConfigFileIntoFontconfig(const base::FilePath& path);
47 // Writes |data| to a file in |temp_dir| and passes it to
48 // LoadConfigFileIntoFontconfig().
49 bool LoadConfigDataIntoFontconfig(const base::FilePath& temp_dir,
50 const std::string& data);
52 // Returns a Fontconfig <edit> stanza.
53 std::string CreateFontconfigEditStanza(const std::string& name,
54 const std::string& type,
55 const std::string& value);
57 // Returns a Fontconfig <test> stanza.
58 std::string CreateFontconfigTestStanza(const std::string& name,
59 const std::string& op,
60 const std::string& type,
61 const std::string& value);
63 // Returns a Fontconfig <alias> stanza.
64 std::string CreateFontconfigAliasStanza(const std::string& original_family,
65 const std::string& preferred_family);
67 } // namespace gfx
69 #endif // UI_GFX_TEST_FONTCONFIG_UTIL_LINUX_H_