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 <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 sysInfo->insertString("Registry", "Adobe"); | 1130 sysInfo->insertString("Registry", "Adobe"); |
1131 sysInfo->insertString("Ordering", "Identity"); | 1131 sysInfo->insertString("Ordering", "Identity"); |
1132 sysInfo->insertInt("Supplement", 0); | 1132 sysInfo->insertInt("Supplement", 0); |
1133 this->insertObject("CIDSystemInfo", std::move(sysInfo)); | 1133 this->insertObject("CIDSystemInfo", std::move(sysInfo)); |
1134 | 1134 |
1135 if (!fontInfo()->fGlyphWidths.empty()) { | 1135 if (!fontInfo()->fGlyphWidths.empty()) { |
1136 int16_t defaultWidth = 0; | 1136 int16_t defaultWidth = 0; |
1137 sk_sp<SkPDFArray> widths(composeAdvanceData( | 1137 sk_sp<SkPDFArray> widths(composeAdvanceData( |
1138 fontInfo()->fGlyphWidths, fontInfo()->fEmSize, &appendWidth, | 1138 fontInfo()->fGlyphWidths, fontInfo()->fEmSize, &appendWidth, |
1139 &defaultWidth)); | 1139 &defaultWidth)); |
1140 if (widths->size()) | 1140 if (widths->size()) { |
1141 this->insertObject("W", std::move(widths)); | 1141 this->insertObject("W", std::move(widths)); |
1142 if (defaultWidth != 0) { | |
1143 this->insertScalar( | |
1144 "DW", | |
1145 scaleFromFontUnits(defaultWidth, fontInfo()->fEmSize)); | |
1146 } | 1142 } |
| 1143 this->insertScalar( |
| 1144 "DW", scaleFromFontUnits(defaultWidth, fontInfo()->fEmSize)); |
1147 } | 1145 } |
1148 if (!fontInfo()->fVerticalMetrics.empty()) { | 1146 if (!fontInfo()->fVerticalMetrics.empty()) { |
1149 struct SkAdvancedTypefaceMetrics::VerticalMetric defaultAdvance; | 1147 struct SkAdvancedTypefaceMetrics::VerticalMetric defaultAdvance; |
1150 defaultAdvance.fVerticalAdvance = 0; | 1148 defaultAdvance.fVerticalAdvance = 0; |
1151 defaultAdvance.fOriginXDisp = 0; | 1149 defaultAdvance.fOriginXDisp = 0; |
1152 defaultAdvance.fOriginYDisp = 0; | 1150 defaultAdvance.fOriginYDisp = 0; |
1153 sk_sp<SkPDFArray> advances(composeAdvanceData( | 1151 sk_sp<SkPDFArray> advances(composeAdvanceData( |
1154 fontInfo()->fVerticalMetrics, fontInfo()->fEmSize, | 1152 fontInfo()->fVerticalMetrics, fontInfo()->fEmSize, |
1155 &appendVerticalAdvance, &defaultAdvance)); | 1153 &appendVerticalAdvance, &defaultAdvance)); |
1156 if (advances->size()) | 1154 if (advances->size()) |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 } | 1417 } |
1420 return *canon->fCanEmbedTypeface.set(id, canEmbed); | 1418 return *canon->fCanEmbedTypeface.set(id, canEmbed); |
1421 } | 1419 } |
1422 | 1420 |
1423 void SkPDFFont::drop() { | 1421 void SkPDFFont::drop() { |
1424 fTypeface = nullptr; | 1422 fTypeface = nullptr; |
1425 fFontInfo = nullptr; | 1423 fFontInfo = nullptr; |
1426 fDescriptor = nullptr; | 1424 fDescriptor = nullptr; |
1427 this->SkPDFDict::drop(); | 1425 this->SkPDFDict::drop(); |
1428 } | 1426 } |
OLD | NEW |