| OLD | NEW |
| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 void TearDownFontconfig() { | 80 void TearDownFontconfig() { |
| 81 FcFini(); | 81 FcFini(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool LoadFontIntoFontconfig(const base::FilePath& path) { | 84 bool LoadFontIntoFontconfig(const base::FilePath& path) { |
| 85 if (!base::PathExists(path)) { | 85 if (!base::PathExists(path)) { |
| 86 LOG(ERROR) << "You are missing " << path.value() << ". Try re-running " | 86 LOG(ERROR) << "You are missing " << path.value() << ". Try re-running " |
| 87 << "build/install-build-deps.sh. Also see " | 87 << "build/install-build-deps.sh. Also see " |
| 88 << "http://code.google.com/p/chromium/wiki/LayoutTestsLinux"; | 88 << "https://chromium.googlesource.com/chromium/src/+/master/docs/
layout_tests_linux.md"; |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 if (!FcConfigAppFontAddFile( | 92 if (!FcConfigAppFontAddFile( |
| 93 NULL, reinterpret_cast<const FcChar8*>(path.value().c_str()))) { | 93 NULL, reinterpret_cast<const FcChar8*>(path.value().c_str()))) { |
| 94 LOG(ERROR) << "Failed to load font " << path.value(); | 94 LOG(ERROR) << "Failed to load font " << path.value(); |
| 95 return false; | 95 return false; |
| 96 } | 96 } |
| 97 | 97 |
| 98 return true; | 98 return true; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 const std::string& preferred_family) { | 159 const std::string& preferred_family) { |
| 160 return base::StringPrintf( | 160 return base::StringPrintf( |
| 161 " <alias>\n" | 161 " <alias>\n" |
| 162 " <family>%s</family>\n" | 162 " <family>%s</family>\n" |
| 163 " <prefer><family>%s</family></prefer>\n" | 163 " <prefer><family>%s</family></prefer>\n" |
| 164 " </alias>\n", | 164 " </alias>\n", |
| 165 original_family.c_str(), preferred_family.c_str()); | 165 original_family.c_str(), preferred_family.c_str()); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace gfx | 168 } // namespace gfx |
| OLD | NEW |