Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: ui/gfx/test/fontconfig_util_linux.cc

Issue 2104653002: Fix content shell layout test failure related to Fontconfig (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add call to FcConfigBuildFonts Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/test/fontconfig_util_linux.h" 5 #include "ui/gfx/test/fontconfig_util_linux.h"
6 6
7 #include <fontconfig/fontconfig.h> 7 #include <fontconfig/fontconfig.h>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 void SetUpFontconfig() { 66 void SetUpFontconfig() {
67 FcInit(); 67 FcInit();
68 68
69 // A primer on undocumented FcConfig reference-counting: 69 // A primer on undocumented FcConfig reference-counting:
70 // 70 //
71 // - FcConfigCreate() creates a config with a refcount of 1. 71 // - FcConfigCreate() creates a config with a refcount of 1.
72 // - FcConfigReference() increments a config's refcount. 72 // - FcConfigReference() increments a config's refcount.
73 // - FcConfigDestroy() decrements a config's refcount, deallocating the 73 // - FcConfigDestroy() decrements a config's refcount, deallocating the
74 // config when the count reaches 0. 74 // config when the count reaches 0.
75 // - FcConfigSetCurrent() calls FcConfigDestroy() on the old config, but 75 // - FcConfigSetCurrent() calls FcConfigDestroy() on the old config, and
76 // interestingly does not call FcConfigReference() on the new config. 76 // calls FcConfigReference() on the new config.
77 CHECK(FcConfigSetCurrent(FcConfigCreate())); 77 FcConfig* config = FcConfigCreate();
78 FcConfigBuildFonts(config);
79 CHECK(FcConfigSetCurrent(config));
Daniel Erat 2016/06/27 23:40:43 interesting. https://www.freedesktop.org/software/
78 } 80 }
79 81
80 void TearDownFontconfig() { 82 void TearDownFontconfig() {
81 FcFini(); 83 FcFini();
82 } 84 }
83 85
84 bool LoadFontIntoFontconfig(const base::FilePath& path) { 86 bool LoadFontIntoFontconfig(const base::FilePath& path) {
85 if (!base::PathExists(path)) { 87 if (!base::PathExists(path)) {
86 LOG(ERROR) << "You are missing " << path.value() << ". Try re-running " 88 LOG(ERROR) << "You are missing " << path.value() << ". Try re-running "
87 << "build/install-build-deps.sh. Also see " 89 << "build/install-build-deps.sh. Also see "
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 const std::string& preferred_family) { 161 const std::string& preferred_family) {
160 return base::StringPrintf( 162 return base::StringPrintf(
161 " <alias>\n" 163 " <alias>\n"
162 " <family>%s</family>\n" 164 " <family>%s</family>\n"
163 " <prefer><family>%s</family></prefer>\n" 165 " <prefer><family>%s</family></prefer>\n"
164 " </alias>\n", 166 " </alias>\n",
165 original_family.c_str(), preferred_family.c_str()); 167 original_family.c_str(), preferred_family.c_str());
166 } 168 }
167 169
168 } // namespace gfx 170 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698