Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "webkit/tools/test_shell/test_shell.h" | 5 #include "webkit/tools/test_shell/test_shell.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <fontconfig/fontconfig.h> | 9 #include <fontconfig/fontconfig.h> |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 true)) { | 204 true)) { |
| 205 LOG(FATAL) << "Failed to parse fontconfig config file"; | 205 LOG(FATAL) << "Failed to parse fontconfig config file"; |
| 206 } | 206 } |
| 207 // We can delete the temp file after font config has parsed it. | 207 // We can delete the temp file after font config has parsed it. |
| 208 file_util::Delete(fontconfig_path, false); | 208 file_util::Delete(fontconfig_path, false); |
| 209 | 209 |
| 210 // This is the list of fonts that fontconfig will know about. It | 210 // This is the list of fonts that fontconfig will know about. It |
| 211 // will try its best to match based only on the fonts here in. The | 211 // will try its best to match based only on the fonts here in. The |
| 212 // paths are where these fonts are found on our Ubuntu boxes. | 212 // paths are where these fonts are found on our Ubuntu boxes. |
| 213 static const char *const fonts[] = { | 213 static const char *const fonts[] = { |
| 214 "/usr/share/fonts/truetype/kochi/kochi-gothic.ttf", | |
| 215 "/usr/share/fonts/truetype/kochi/kochi-mincho.ttf", | |
| 214 "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf", | 216 "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf", |
| 215 "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf", | 217 "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf", |
| 216 "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf", | 218 "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf", |
| 217 "/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf", | 219 "/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf", |
| 218 "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf", | 220 "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf", |
| 219 "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf", | 221 "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf", |
| 220 "/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf", | 222 "/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf", |
| 221 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf", | 223 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf", |
| 222 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf", | 224 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf", |
| 223 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf", | 225 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf", |
| 224 "/usr/share/fonts/truetype/msttcorefonts/Georgia.ttf", | 226 "/usr/share/fonts/truetype/msttcorefonts/Georgia.ttf", |
| 225 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold.ttf", | 227 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold.ttf", |
| 226 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold_Italic.ttf", | 228 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold_Italic.ttf", |
| 227 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Italic.ttf", | 229 "/usr/share/fonts/truetype/msttcorefonts/Georgia_Italic.ttf", |
| 228 "/usr/share/fonts/truetype/msttcorefonts/Impact.ttf", | 230 "/usr/share/fonts/truetype/msttcorefonts/Impact.ttf", |
| 229 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS.ttf", | 231 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS.ttf", |
| 230 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold.ttf", | 232 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold.ttf", |
| 231 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold_Italic.ttf", | 233 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold_Italic.ttf", |
| 232 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Italic.ttf", | 234 "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Italic.ttf", |
| 233 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf", | 235 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf", |
| 234 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf", | 236 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf", |
| 235 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf", | 237 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf", |
| 236 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf", | 238 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf", |
| 237 "/usr/share/fonts/truetype/msttcorefonts/Verdana.ttf", | 239 "/usr/share/fonts/truetype/msttcorefonts/Verdana.ttf", |
| 238 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf", | 240 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf", |
| 239 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf", | 241 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf", |
| 240 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf", | 242 "/usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf", |
| 243 // The DejaVuSans font is used by the LayoutTests/css2.1 tests | |
| 244 "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", | |
| 241 "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_ta.ttf", | 245 "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_ta.ttf", |
| 242 "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_pa.ttf", | 246 "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_pa.ttf", |
| 243 "/usr/share/fonts/truetype/ttf-indic-fonts-core/MuktiNarrow.ttf", | 247 "/usr/share/fonts/truetype/ttf-indic-fonts-core/MuktiNarrow.ttf", |
| 244 }; | 248 }; |
| 245 for (size_t i = 0; i < arraysize(fonts); ++i) { | 249 for (size_t i = 0; i < arraysize(fonts); ++i) { |
| 246 if (access(fonts[i], R_OK)) { | 250 if (access(fonts[i], R_OK)) { |
| 247 LOG(FATAL) << "You are missing " << fonts[i] << ". " | 251 LOG(FATAL) << "You are missing " << fonts[i] << ". " |
| 248 << "Try installing msttcorefonts. Also see " | 252 << "Try installing msttcorefonts. Also see " |
| 249 << "http://code.google.com/p/chromium/wiki/" | 253 << "http://code.google.com/p/chromium/wiki/" |
| 250 << "LinuxBuildInstructions"; | 254 << "LinuxBuildInstructions"; |
| 251 } | 255 } |
| 252 if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) fonts[i])) | 256 if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) fonts[i])) |
| 253 LOG(FATAL) << "Failed to load font " << fonts[i]; | 257 LOG(FATAL) << "Failed to load font " << fonts[i]; |
| 254 } | 258 } |
| 255 | 259 |
| 256 // We special case these fonts because they're only needed in a | 260 // We special case these fonts because they're only needed in a |
| 257 // few layout tests. | 261 // few layout tests. |
| 258 static const char* const optional_fonts[] = { | 262 static const char* const optional_fonts[] = { |
| 259 "/usr/share/fonts/truetype/ttf-lucida/LucidaSansRegular.ttf", | 263 "/usr/share/fonts/truetype/ttf-lucida/LucidaSansRegular.ttf", |
| 260 "/usr/share/fonts/truetype/kochi/kochi-gothic.ttf", | |
| 261 "/usr/share/fonts/truetype/kochi/kochi-mincho.ttf", | |
| 262 "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", | |
| 263 }; | 264 }; |
| 264 for (size_t i = 0; i < arraysize(optional_fonts); ++i) { | 265 for (size_t i = 0; i < arraysize(optional_fonts); ++i) { |
| 265 const char* font = optional_fonts[i]; | 266 const char* font = optional_fonts[i]; |
| 266 if (access(font, R_OK) < 0) { | 267 if (access(font, R_OK) < 0) { |
| 267 LOG(WARNING) << "You are missing " << font << ". " | 268 LOG(WARNING) << "You are missing " << font << ". " |
| 268 << "Without this, some layout tests will fail. " | 269 << "Without this, some layout tests will fail. " |
| 269 << "It's not a major problem. See the build instructions " | 270 << "To get LucidaSansRegular, install sun-java6-fonts. " |
| 270 << "for more information on where to get all the data."; | 271 << "This will also install a JRE"; |
|
Evan Martin
2010/03/25 23:26:12
Ok, this JRE comment is a bit weird. (Why mention
| |
| 271 } else { | 272 } else { |
| 272 if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) font)) | 273 if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) font)) |
| 273 LOG(FATAL) << "Failed to load font " << font; | 274 LOG(FATAL) << "Failed to load font " << font; |
| 274 } | 275 } |
| 275 } | 276 } |
| 276 | 277 |
| 277 // Also load the layout-test-specific "Ahem" font. | 278 // Also load the layout-test-specific "Ahem" font. |
| 278 base::StringPiece ahem_font; | 279 base::StringPiece ahem_font; |
| 279 g_resource_data_pack->GetStringPiece(IDR_AHEM_FONT, &ahem_font); | 280 g_resource_data_pack->GetStringPiece(IDR_AHEM_FONT, &ahem_font); |
| 280 g_ahem_path = new FilePath; | 281 g_ahem_path = new FilePath; |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 break; | 680 break; |
| 680 } | 681 } |
| 681 return TestShell::NetResourceProvider(resource_id); | 682 return TestShell::NetResourceProvider(resource_id); |
| 682 } | 683 } |
| 683 | 684 |
| 684 void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { | 685 void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { |
| 685 NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); | 686 NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); |
| 686 } | 687 } |
| 687 | 688 |
| 688 } // namespace webkit_glue | 689 } // namespace webkit_glue |
| OLD | NEW |