| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "SkData.h" | 8 #include "SkData.h" |
| 9 #include "SkGlyphCache.h" | 9 #include "SkGlyphCache.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| 11 #include "SkPDFCanon.h" | 11 #include "SkPDFCanon.h" |
| 12 #include "SkPDFConvertType1FontStream.h" | 12 #include "SkPDFConvertType1FontStream.h" |
| 13 #include "SkPDFDevice.h" | 13 #include "SkPDFDevice.h" |
| 14 #include "SkPDFMakeCIDGlyphWidthsArray.h" | 14 #include "SkPDFMakeCIDGlyphWidthsArray.h" |
| 15 #include "SkPDFMakeToUnicodeCmap.h" | 15 #include "SkPDFMakeToUnicodeCmap.h" |
| 16 #include "SkPDFFont.h" | 16 #include "SkPDFFont.h" |
| 17 #include "SkPDFUtils.h" | 17 #include "SkPDFUtils.h" |
| 18 #include "SkRefCnt.h" | 18 #include "SkRefCnt.h" |
| 19 #include "SkScalar.h" | 19 #include "SkScalar.h" |
| 20 #include "SkStream.h" | 20 #include "SkStream.h" |
| 21 #include "SkTypes.h" | 21 #include "SkTypes.h" |
| 22 #include "SkUtils.h" | 22 #include "SkUtils.h" |
| 23 | 23 |
| 24 // TODO(halcanary): Switch Chrome from SK_SFNTLY_SUBSETTER to SK_PDF_USE_SFNTLY. | |
| 25 #if defined(SK_SFNTLY_SUBSETTER) && !defined(SK_PDF_USE_SFNTLY) | |
| 26 #define SK_PDF_USE_SFNTLY | |
| 27 #endif | |
| 28 | |
| 29 #ifdef SK_PDF_USE_SFNTLY | 24 #ifdef SK_PDF_USE_SFNTLY |
| 30 #include "sample/chromium/font_subsetter.h" | 25 #include "sample/chromium/font_subsetter.h" |
| 31 #endif | 26 #endif |
| 32 | 27 |
| 33 namespace { | 28 namespace { |
| 34 // PDF's notion of symbolic vs non-symbolic is related to the character set, not | 29 // PDF's notion of symbolic vs non-symbolic is related to the character set, not |
| 35 // symbols vs. characters. Rarely is a font the right character set to call it | 30 // symbols vs. characters. Rarely is a font the right character set to call it |
| 36 // non-symbolic, so always call it symbolic. (PDF 1.4 spec, section 5.7.1) | 31 // non-symbolic, so always call it symbolic. (PDF 1.4 spec, section 5.7.1) |
| 37 static const int kPdfSymbolic = 4; | 32 static const int kPdfSymbolic = 4; |
| 38 | 33 |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 716 |
| 722 bool SkPDFFont::CanEmbedTypeface(SkTypeface* typeface, SkPDFCanon* canon) { | 717 bool SkPDFFont::CanEmbedTypeface(SkTypeface* typeface, SkPDFCanon* canon) { |
| 723 const SkAdvancedTypefaceMetrics* metrics = SkPDFFont::GetMetrics(typeface, c
anon); | 718 const SkAdvancedTypefaceMetrics* metrics = SkPDFFont::GetMetrics(typeface, c
anon); |
| 724 return metrics && can_embed(*metrics); | 719 return metrics && can_embed(*metrics); |
| 725 } | 720 } |
| 726 | 721 |
| 727 void SkPDFFont::drop() { | 722 void SkPDFFont::drop() { |
| 728 fTypeface = nullptr; | 723 fTypeface = nullptr; |
| 729 this->SkPDFDict::drop(); | 724 this->SkPDFDict::drop(); |
| 730 } | 725 } |
| OLD | NEW |