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

Side by Side Diff: tools/create_test_font.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « tools/chrome_fuzz.cpp ('k') | tools/debugger/SkDebugCanvas.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 // running create_test_font generates ./tools/test_font_data.cpp 8 // running create_test_font generates ./tools/test_font_data.cpp
9 // which is read by ./tools/sk_tool_utils_font.cpp 9 // which is read by ./tools/sk_tool_utils_font.cpp
10 10
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 fprintf(out, "%c", ','); 248 fprintf(out, "%c", ',');
249 if (outChCount >= kMaxLineLength) { 249 if (outChCount >= kMaxLineLength) {
250 outChCount = 0; 250 outChCount = 0;
251 fprintf(out, "%c", '\n'); 251 fprintf(out, "%c", '\n');
252 } else { 252 } else {
253 fprintf(out, "%c", ' '); 253 fprintf(out, "%c", ' ');
254 } 254 }
255 } 255 }
256 } 256 }
257 fprintf(out, "\n};\n\n"); 257 fprintf(out, "\n};\n\n");
258 258
259 // all fonts are now 0x00, 0x20 - 0xFE 259 // all fonts are now 0x00, 0x20 - 0xFE
260 // don't need to generate or output character codes? 260 // don't need to generate or output character codes?
261 fprintf(out, "const unsigned %sCharCodes[] = {\n", fontname); 261 fprintf(out, "const unsigned %sCharCodes[] = {\n", fontname);
262 int offsetCount = charCodes.count(); 262 int offsetCount = charCodes.count();
263 for (int index = 0; index < offsetCount;) { 263 for (int index = 0; index < offsetCount;) {
264 unsigned offset = charCodes[index]; 264 unsigned offset = charCodes[index];
265 fprintf(out, "%u", offset); 265 fprintf(out, "%u", offset);
266 if (++index < offsetCount) { 266 if (++index < offsetCount) {
267 outChCount += offset_str_len(offset) + 2; 267 outChCount += offset_str_len(offset) + 2;
268 fprintf(out, "%c", ','); 268 fprintf(out, "%c", ',');
269 if (outChCount >= kMaxLineLength) { 269 if (outChCount >= kMaxLineLength) {
270 outChCount = 0; 270 outChCount = 0;
271 fprintf(out, "%c", '\n'); 271 fprintf(out, "%c", '\n');
272 } else { 272 } else {
273 fprintf(out, "%c", ' '); 273 fprintf(out, "%c", ' ');
274 } 274 }
275 } 275 }
276 } 276 }
277 fprintf(out, "\n};\n\n"); 277 fprintf(out, "\n};\n\n");
278 278
279 SkString widthsStr; 279 SkString widthsStr;
280 fprintf(out, "const SkFixed %sWidths[] = {\n", fontname); 280 fprintf(out, "const SkFixed %sWidths[] = {\n", fontname);
281 for (int index = 0; index < offsetCount; ++index) { 281 for (int index = 0; index < offsetCount; ++index) {
282 output_fixed(widths[index], emSize, &widthsStr); 282 output_fixed(widths[index], emSize, &widthsStr);
283 } 283 }
284 widthsStr = strip_final(widthsStr); 284 widthsStr = strip_final(widthsStr);
285 fprintf(out, "%s\n};\n\n", widthsStr.c_str()); 285 fprintf(out, "%s\n};\n\n", widthsStr.c_str());
286 286
287 fprintf(out, "const int %sCharCodesCount = (int) SK_ARRAY_COUNT(%sCharCodes) ;\n\n", 287 fprintf(out, "const int %sCharCodesCount = (int) SK_ARRAY_COUNT(%sCharCodes) ;\n\n",
288 fontname, fontname); 288 fontname, fontname);
289 289
290 SkPaint::FontMetrics metrics; 290 SkPaint::FontMetrics metrics;
291 paint.getFontMetrics(&metrics); 291 paint.getFontMetrics(&metrics);
292 fprintf(out, "const SkPaint::FontMetrics %sMetrics = {\n", fontname); 292 fprintf(out, "const SkPaint::FontMetrics %sMetrics = {\n", fontname);
293 SkString metricsStr; 293 SkString metricsStr;
294 metricsStr.printf("0x%08x, ", metrics.fFlags); 294 metricsStr.printf("0x%08x, ", metrics.fFlags);
295 output_scalar(metrics.fTop, emSize, &metricsStr); 295 output_scalar(metrics.fTop, emSize, &metricsStr);
296 output_scalar(metrics.fAscent, emSize, &metricsStr); 296 output_scalar(metrics.fAscent, emSize, &metricsStr);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 429 }
430 430
431 int main(int , char * const []) { 431 int main(int , char * const []) {
432 #ifndef SK_BUILD_FOR_MAC 432 #ifndef SK_BUILD_FOR_MAC
433 #error "use fonts installed on Mac" 433 #error "use fonts installed on Mac"
434 #endif 434 #endif
435 generate_fonts(); 435 generate_fonts();
436 generate_index(DEFAULT_FONT_NAME); 436 generate_index(DEFAULT_FONT_NAME);
437 return 0; 437 return 0;
438 } 438 }
OLDNEW
« no previous file with comments | « tools/chrome_fuzz.cpp ('k') | tools/debugger/SkDebugCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698