| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 | 16 |
| 17 const char* const kSystemFontsForFontconfig[] = { | 17 const char* const kSystemFontsForFontconfig[] = { |
| 18 "/usr/share/fonts/truetype/kochi/kochi-gothic.ttf", | 18 "/usr/share/fonts/opentype/ipafont-gothic/ipag.ttf", |
| 19 "/usr/share/fonts/truetype/kochi/kochi-mincho.ttf", | 19 "/usr/share/fonts/opentype/ipafont-gothic/ipagp.ttf", |
| 20 "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf", | 20 "/usr/share/fonts/opentype/ipafont-mincho/ipam.ttf", |
| 21 "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf", | 21 "/usr/share/fonts/opentype/ipafont-mincho/ipamp.ttf", |
| 22 "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf", | 22 "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf", |
| 23 "/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf", | 23 "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf", |
| 24 "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf", | 24 "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf", |
| 25 "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf", | 25 "/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf", |
| 26 "/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf", | 26 "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf", |
| 27 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf", | 27 "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf", |
| 28 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf", | 28 "/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf", |
| 29 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf", | 29 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf", |
| 30 "/usr/share/fonts/truetype/msttcorefonts/Georgia.ttf", | 30 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf", |
| 31 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold.ttf", | 31 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf", |
| 32 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold_Italic.ttf", | 32 "/usr/share/fonts/truetype/msttcorefonts/Georgia.ttf", |
| 33 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Italic.ttf", | 33 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold.ttf", |
| 34 "/usr/share/fonts/truetype/msttcorefonts/Impact.ttf", | 34 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold_Italic.ttf", |
| 35 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS.ttf", | 35 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Italic.ttf", |
| 36 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold.ttf", | 36 "/usr/share/fonts/truetype/msttcorefonts/Impact.ttf", |
| 37 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold_Italic.ttf", | 37 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS.ttf", |
| 38 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Italic.ttf", | 38 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold.ttf", |
| 39 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf", | 39 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold_Italic.ttf", |
| 40 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf", | 40 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Italic.ttf", |
| 41 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf", | 41 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf", |
| 42 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf", | 42 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf", |
| 43 "/usr/share/fonts/truetype/msttcorefonts/Verdana.ttf", | 43 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf", |
| 44 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf", | 44 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf", |
| 45 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf", | 45 "/usr/share/fonts/truetype/msttcorefonts/Verdana.ttf", |
| 46 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf", | 46 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf", |
| 47 // The DejaVuSans font is used by the css2.1 tests. | 47 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf", |
| 48 "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", | 48 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf", |
| 49 "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_hi.ttf", | 49 // The DejaVuSans font is used by the css2.1 tests. |
| 50 "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_ta.ttf", | 50 "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", |
| 51 "/usr/share/fonts/truetype/ttf-indic-fonts-core/MuktiNarrow.ttf", | 51 //"/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_hi.ttf", |
| 52 //"/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_ta.ttf", |
| 53 //"/usr/share/fonts/truetype/ttf-indic-fonts-core/MuktiNarrow.ttf", |
| 52 }; | 54 }; |
| 53 | 55 |
| 54 const size_t kNumSystemFontsForFontconfig = | 56 const size_t kNumSystemFontsForFontconfig = |
| 55 arraysize(kSystemFontsForFontconfig); | 57 arraysize(kSystemFontsForFontconfig); |
| 56 | 58 |
| 57 const char kFontconfigFileHeader[] = | 59 const char kFontconfigFileHeader[] = |
| 58 "<?xml version=\"1.0\"?>\n" | 60 "<?xml version=\"1.0\"?>\n" |
| 59 "<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n" | 61 "<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n" |
| 60 "<fontconfig>\n"; | 62 "<fontconfig>\n"; |
| 61 const char kFontconfigFileFooter[] = "</fontconfig>"; | 63 const char kFontconfigFileFooter[] = "</fontconfig>"; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 const std::string& preferred_family) { | 163 const std::string& preferred_family) { |
| 162 return base::StringPrintf( | 164 return base::StringPrintf( |
| 163 " <alias>\n" | 165 " <alias>\n" |
| 164 " <family>%s</family>\n" | 166 " <family>%s</family>\n" |
| 165 " <prefer><family>%s</family></prefer>\n" | 167 " <prefer><family>%s</family></prefer>\n" |
| 166 " </alias>\n", | 168 " </alias>\n", |
| 167 original_family.c_str(), preferred_family.c_str()); | 169 original_family.c_str(), preferred_family.c_str()); |
| 168 } | 170 } |
| 169 | 171 |
| 170 } // namespace gfx | 172 } // namespace gfx |
| OLD | NEW |