Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Side by Side Diff: test/idempotent.cc

Issue 658573004: Updating to new OTS repo from https://github.com/khaledhosny/ots.git (Closed) Base URL: https://chromium.googlesource.com/external/ots@master
Patch Set: Adding Colored Emoji changes from external/git repo Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #if !defined(_WIN32) 5 #if !defined(_WIN32)
6 #ifdef __linux__ 6 #ifdef __linux__
7 // Linux 7 // Linux
8 #include <freetype/ftoutln.h>
9 #include <ft2build.h> 8 #include <ft2build.h>
10 #include FT_FREETYPE_H 9 #include FT_FREETYPE_H
10 #include FT_OUTLINE_H
11 #else 11 #else
12 // Mac OS X 12 // Mac OS X
13 #include <ApplicationServices/ApplicationServices.h> // g++ -framework Cocoa 13 #include <ApplicationServices/ApplicationServices.h> // g++ -framework Cocoa
14 #endif // __linux__ 14 #endif // __linux__
15 #include <unistd.h> 15 #include <unistd.h>
16 #else 16 #else
17 // Windows 17 // Windows
18 #include <io.h> 18 #include <io.h>
19 #include <Windows.h> 19 #include <Windows.h>
20 #endif // !defiend(_WIN32) 20 #endif // !defiend(_WIN32)
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 // A transcoded font is usually smaller than an original font. 166 // A transcoded font is usually smaller than an original font.
167 // However, it can be slightly bigger than the original one due to 167 // However, it can be slightly bigger than the original one due to
168 // name table replacement and/or padding for glyf table. 168 // name table replacement and/or padding for glyf table.
169 // 169 //
170 // However, a WOFF font gets decompressed and so can be *much* larger than 170 // However, a WOFF font gets decompressed and so can be *much* larger than
171 // the original. 171 // the original.
172 uint8_t *result = new uint8_t[file_size * 8]; 172 uint8_t *result = new uint8_t[file_size * 8];
173 ots::MemoryStream output(result, file_size * 8); 173 ots::MemoryStream output(result, file_size * 8);
174 174
175 bool r = ots::Process(&output, data, file_size); 175 ots::OTSContext context;
176
177 bool r = context.Process(&output, data, file_size);
176 if (!r) { 178 if (!r) {
177 std::fprintf(stderr, "Failed to sanitise file!\n"); 179 std::fprintf(stderr, "Failed to sanitise file!\n");
178 return 1; 180 return 1;
179 } 181 }
180 const size_t result_len = output.Tell(); 182 const size_t result_len = output.Tell();
181 delete[] data; 183 delete[] data;
182 184
183 uint8_t *result2 = new uint8_t[result_len]; 185 uint8_t *result2 = new uint8_t[result_len];
184 ots::MemoryStream output2(result2, result_len); 186 ots::MemoryStream output2(result2, result_len);
185 r = ots::Process(&output2, result, result_len); 187 r = context.Process(&output2, result, result_len);
186 if (!r) { 188 if (!r) {
187 std::fprintf(stderr, "Failed to sanitise previous output!\n"); 189 std::fprintf(stderr, "Failed to sanitise previous output!\n");
188 return 1; 190 return 1;
189 } 191 }
190 const size_t result2_len = output2.Tell(); 192 const size_t result2_len = output2.Tell();
191 193
192 bool dump_results = false; 194 bool dump_results = false;
193 if (result2_len != result_len) { 195 if (result2_len != result_len) {
194 std::fprintf(stderr, "Outputs differ in length\n"); 196 std::fprintf(stderr, "Outputs differ in length\n");
195 dump_results = true; 197 dump_results = true;
(...skipping 12 matching lines...) Expand all
208 210
209 // Verify that the transcoded font can be opened by the font renderer for 211 // Verify that the transcoded font can be opened by the font renderer for
210 // Linux (FreeType2), Mac OS X, or Windows. 212 // Linux (FreeType2), Mac OS X, or Windows.
211 if (!VerifyTranscodedFont(result, result_len)) { 213 if (!VerifyTranscodedFont(result, result_len)) {
212 std::fprintf(stderr, "Failed to verify the transcoded font\n"); 214 std::fprintf(stderr, "Failed to verify the transcoded font\n");
213 return 1; 215 return 1;
214 } 216 }
215 217
216 return 0; 218 return 0;
217 } 219 }
OLDNEW
« .gitmodules ('K') | « test/file-stream.h ('k') | test/ot-sanitise.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698