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

Side by Side Diff: src/ports/SkFontHost_FreeType.cpp

Issue 2246903002: SkPDF: SkPDFFont class changes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-08-15 (Monday) 21:25:47 EDT Created 4 years, 4 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 | « src/pdf/SkPDFFont.cpp ('k') | src/ports/SkFontHost_win.cpp » ('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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #include "SkAdvancedTypefaceMetrics.h" 8 #include "SkAdvancedTypefaceMetrics.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 const uint32_t* glyphIDs, 457 const uint32_t* glyphIDs,
458 uint32_t glyphIDsCount) const { 458 uint32_t glyphIDsCount) const {
459 AutoFTAccess fta(this); 459 AutoFTAccess fta(this);
460 FT_Face face = fta.face(); 460 FT_Face face = fta.face();
461 if (!face) { 461 if (!face) {
462 return nullptr; 462 return nullptr;
463 } 463 }
464 464
465 SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics; 465 SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics;
466 info->fFontName.set(FT_Get_Postscript_Name(face)); 466 info->fFontName.set(FT_Get_Postscript_Name(face));
467 info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag; 467
468 if (FT_HAS_MULTIPLE_MASTERS(face)) { 468 if (FT_HAS_MULTIPLE_MASTERS(face)) {
469 info->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>( 469 info->fFlags |= SkAdvancedTypefaceMetrics::kMultiMaster_FontFlag;
470 info->fFlags, SkAdvancedTypefaceMetrics::kMultiMaster_FontFlag);
471 } 470 }
472 if (!canEmbed(face)) { 471 if (!canEmbed(face)) {
473 info->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>( 472 info->fFlags |= SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag;
474 info->fFlags,
475 SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag);
476 } 473 }
477 if (!canSubset(face)) { 474 if (!canSubset(face)) {
478 info->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>( 475 info->fFlags |= SkAdvancedTypefaceMetrics::kNotSubsettable_FontFlag;
479 info->fFlags,
480 SkAdvancedTypefaceMetrics::kNotSubsettable_FontFlag);
481 } 476 }
482 info->fLastGlyphID = face->num_glyphs - 1; 477 info->fLastGlyphID = face->num_glyphs - 1;
483 info->fEmSize = 1000; 478 info->fEmSize = 1000;
484 479
485 const char* fontType = FT_Get_X11_Font_Format(face); 480 const char* fontType = FT_Get_X11_Font_Format(face);
486 if (strcmp(fontType, "Type 1") == 0) { 481 if (strcmp(fontType, "Type 1") == 0) {
487 info->fType = SkAdvancedTypefaceMetrics::kType1_Font; 482 info->fType = SkAdvancedTypefaceMetrics::kType1_Font;
488 } else if (strcmp(fontType, "CID Type 1") == 0) { 483 } else if (strcmp(fontType, "CID Type 1") == 0) {
489 info->fType = SkAdvancedTypefaceMetrics::kType1CID_Font; 484 info->fType = SkAdvancedTypefaceMetrics::kType1CID_Font;
490 } else if (strcmp(fontType, "CFF") == 0) { 485 } else if (strcmp(fontType, "CFF") == 0) {
491 info->fType = SkAdvancedTypefaceMetrics::kCFF_Font; 486 info->fType = SkAdvancedTypefaceMetrics::kCFF_Font;
492 } else if (strcmp(fontType, "TrueType") == 0) { 487 } else if (strcmp(fontType, "TrueType") == 0) {
493 info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font; 488 info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font;
494 TT_Header* ttHeader; 489 TT_Header* ttHeader;
495 if ((ttHeader = (TT_Header*)FT_Get_Sfnt_Table(face, ft_sfnt_head)) != nu llptr) { 490 if ((ttHeader = (TT_Header*)FT_Get_Sfnt_Table(face, ft_sfnt_head)) != nu llptr) {
496 info->fEmSize = ttHeader->Units_Per_EM; 491 info->fEmSize = ttHeader->Units_Per_EM;
497 } 492 }
498 } else { 493 } else {
499 info->fType = SkAdvancedTypefaceMetrics::kOther_Font; 494 info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
500 } 495 }
501 496
502 info->fStyle = 0; 497 info->fStyle = (SkAdvancedTypefaceMetrics::StyleFlags)0;
503 if (FT_IS_FIXED_WIDTH(face)) { 498 if (FT_IS_FIXED_WIDTH(face)) {
504 info->fStyle |= SkAdvancedTypefaceMetrics::kFixedPitch_Style; 499 info->fStyle |= SkAdvancedTypefaceMetrics::kFixedPitch_Style;
505 } 500 }
506 if (face->style_flags & FT_STYLE_FLAG_ITALIC) { 501 if (face->style_flags & FT_STYLE_FLAG_ITALIC) {
507 info->fStyle |= SkAdvancedTypefaceMetrics::kItalic_Style; 502 info->fStyle |= SkAdvancedTypefaceMetrics::kItalic_Style;
508 } 503 }
509 504
510 PS_FontInfoRec psFontInfo; 505 PS_FontInfoRec psFontInfo;
511 TT_Postscript* postTable; 506 TT_Postscript* postTable;
512 if (FT_Get_PS_Font_Info(face, &psFontInfo) == 0) { 507 if (FT_Get_PS_Font_Info(face, &psFontInfo) == 0) {
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n", 1766 SkDEBUGF(("Requested font axis not found: %s '%c%c%c%c'\n",
1772 name.c_str(), 1767 name.c_str(),
1773 (skTag >> 24) & 0xFF, 1768 (skTag >> 24) & 0xFF,
1774 (skTag >> 16) & 0xFF, 1769 (skTag >> 16) & 0xFF,
1775 (skTag >> 8) & 0xFF, 1770 (skTag >> 8) & 0xFF,
1776 (skTag) & 0xFF)); 1771 (skTag) & 0xFF));
1777 } 1772 }
1778 } 1773 }
1779 ) 1774 )
1780 } 1775 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/ports/SkFontHost_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698