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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf", | 54 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf", |
55 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf", | 55 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf", |
56 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf", | 56 "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf", |
57 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf", | 57 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf", |
58 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf", | 58 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf", |
59 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf", | 59 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf", |
60 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf", | 60 "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf", |
61 NULL | 61 NULL |
62 }; | 62 }; |
63 | 63 |
| 64 // We have fontconfig parse a config file from our resources directory. This |
| 65 // sets a number of aliases ("sans"->"Arial" etc), but doesn't include any |
| 66 // font directories. |
| 67 FilePath path; |
| 68 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 69 path.Append("webkti/tools/test_shell/resources/linux-fontconfig-config"); |
| 70 |
64 FcInit(); | 71 FcInit(); |
| 72 |
65 FcConfig* fontcfg = FcConfigCreate(); | 73 FcConfig* fontcfg = FcConfigCreate(); |
| 74 if (!FcConfigParseAndLoad(fontcfg, (const FcChar8*) path.value().c_str(), |
| 75 true)) { |
| 76 LOG(FATAL) << "Failed to parse fontconfig config file"; |
| 77 } |
| 78 |
66 for (unsigned i = 0; fonts[i]; ++i) { | 79 for (unsigned i = 0; fonts[i]; ++i) { |
67 if (access(fonts[i], R_OK)) { | 80 if (access(fonts[i], R_OK)) { |
68 LOG(FATAL) << "You are missing " << fonts[i] << ". " | 81 LOG(FATAL) << "You are missing " << fonts[i] << ". " |
69 << "Try installing msttcorefonts. Also see " | 82 << "Try installing msttcorefonts. Also see " |
70 << "http://code.google.com/p/chromium/wiki/" | 83 << "http://code.google.com/p/chromium/wiki/" |
71 << "LinuxBuildInstructions"; | 84 << "LinuxBuildInstructions"; |
72 } | 85 } |
73 if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) fonts[i])) | 86 if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) fonts[i])) |
74 LOG(FATAL) << "Failed to load font " << fonts[i]; | 87 LOG(FATAL) << "Failed to load font " << fonts[i]; |
75 } | 88 } |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 // of NOTIMPLEMENTED into our layout test diffs. | 544 // of NOTIMPLEMENTED into our layout test diffs. |
532 // NOTIMPLEMENTED(); | 545 // NOTIMPLEMENTED(); |
533 return false; | 546 return false; |
534 } | 547 } |
535 | 548 |
536 ScreenInfo GetScreenInfo(gfx::ViewHandle window) { | 549 ScreenInfo GetScreenInfo(gfx::ViewHandle window) { |
537 return GetScreenInfoHelper(window); | 550 return GetScreenInfoHelper(window); |
538 } | 551 } |
539 | 552 |
540 } // namespace webkit_glue | 553 } // namespace webkit_glue |
OLD | NEW |