OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <fcntl.h> | 5 #include <fcntl.h> |
6 #include <freetype/ftoutln.h> | |
7 #include <ft2build.h> | 6 #include <ft2build.h> |
8 #include FT_FREETYPE_H | 7 #include FT_FREETYPE_H |
| 8 #include FT_OUTLINE_H |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
11 #include <unistd.h> | 11 #include <unistd.h> |
12 | 12 |
13 #include <cstdio> | 13 #include <cstdio> |
14 #include <cstdlib> | 14 #include <cstdlib> |
15 #include <cstring> | 15 #include <cstring> |
16 | 16 |
17 #include "opentype-sanitiser.h" | 17 #include "opentype-sanitiser.h" |
18 #include "ots-memory-stream.h" | 18 #include "ots-memory-stream.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 if (error) { | 260 if (error) { |
261 std::fprintf(stderr, "Failed to open the original font with FT2! %s\n", | 261 std::fprintf(stderr, "Failed to open the original font with FT2! %s\n", |
262 argv[1]); | 262 argv[1]); |
263 return 1; | 263 return 1; |
264 } | 264 } |
265 | 265 |
266 // transcode the original font. | 266 // transcode the original font. |
267 static const size_t kPadLen = 20 * 1024; | 267 static const size_t kPadLen = 20 * 1024; |
268 uint8_t *trans_font = new uint8_t[orig_len + kPadLen]; | 268 uint8_t *trans_font = new uint8_t[orig_len + kPadLen]; |
269 ots::MemoryStream output(trans_font, orig_len + kPadLen); | 269 ots::MemoryStream output(trans_font, orig_len + kPadLen); |
| 270 ots::OTSContext context; |
270 | 271 |
271 bool result = ots::Process(&output, orig_font, orig_len); | 272 bool result = context.Process(&output, orig_font, orig_len); |
272 if (!result) { | 273 if (!result) { |
273 std::fprintf(stderr, "Failed to sanitise file! %s\n", argv[1]); | 274 std::fprintf(stderr, "Failed to sanitise file! %s\n", argv[1]); |
274 return 1; | 275 return 1; |
275 } | 276 } |
276 const size_t trans_len = output.Tell(); | 277 const size_t trans_len = output.Tell(); |
277 | 278 |
278 // perform side-by-side tests. | 279 // perform side-by-side tests. |
279 return SideBySide(library, argv[1], | 280 return SideBySide(library, argv[1], |
280 orig_font, orig_len, | 281 orig_font, orig_len, |
281 trans_font, trans_len); | 282 trans_font, trans_len); |
282 } | 283 } |
OLD | NEW |