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

Side by Side Diff: src/pdf/SkPDFFont.cpp

Issue 2146403005: SkPDF: Always give a default advance for glyphs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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 | « gm/skbug_5321.cpp ('k') | no next file » | 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 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
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
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 }
OLDNEW
« no previous file with comments | « gm/skbug_5321.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698