287 {
292
295 font.insertName(
"Subtype",
"Type1");
297 font.insertName(
"BaseFont",
info->fPostScriptName);
298 }
299
300
301 unsigned glyphCount = 1 + lastGlyphID - firstGlyphID;
302 SkASSERT(glyphCount > 0 && glyphCount <= 255);
303 font.insertInt(
"FirstChar", (
size_t)0);
304 font.insertInt(
"LastChar", (
size_t)glyphCount);
305 {
306 int emSize;
308
309 int glyphRangeSize = lastGlyphID - firstGlyphID + 2;
311 glyphIDs[0] = 0;
312 for (unsigned gId = firstGlyphID; gId <= lastGlyphID; gId++) {
313 glyphIDs[gId - firstGlyphID + 1] = gId;
314 }
317 auto glyphs = metrics.glyphs(
SkSpan(glyphIDs.get(), glyphRangeSize));
318 for (int i = 0; i < glyphRangeSize; ++i) {
320 }
321 font.insertObject(
"Widths", std::move(
widths));
322 }
324 encDiffs->reserve(lastGlyphID - firstGlyphID + 3);
325 encDiffs->appendInt(0);
326
327 SkASSERT(glyphNames.size() > lastGlyphID);
329 encDiffs->appendName(glyphNames[0].isEmpty() ? unknown : glyphNames[0]);
330 for (int gID = firstGlyphID; gID <= lastGlyphID; gID++) {
331 encDiffs->appendName(glyphNames[gID].isEmpty() ? unknown : glyphNames[gID]);
332 }
333
335 encoding->insertObject("Differences", std::move(encDiffs));
336 font.insertObject(
"Encoding", std::move(encoding));
337
339}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static const std::vector< SkString > & type_1_glyphnames(SkPDFDocument *canon, const SkTypeface *typeface)
static SkScalar from_font_units(SkScalar scaled, uint16_t emSize)
static SkPDFIndirectReference type1_font_descriptor(SkPDFDocument *doc, const SkTypeface *typeface)
static std::unique_ptr< SkPDFDict > SkPDFMakeDict(const char *type=nullptr)
static std::unique_ptr< SkPDFArray > SkPDFMakeArray(Args... args)
constexpr uint16_t SkToU16(S x)
SkPDFIndirectReference emit(const SkPDFObject &, SkPDFIndirectReference)
static const SkAdvancedTypefaceMetrics * GetMetrics(const SkTypeface *typeface, SkPDFDocument *canon)
SkPDFIndirectReference indirectReference() const
SkGlyphID lastGlyphID() const
SkGlyphID firstGlyphID() const
SkTypeface * typeface() const
static SkStrikeSpec MakePDFVector(const SkTypeface &typeface, int *size)
font
Font Metadata and Metrics.