307 {
312
315 font.insertName(
"Subtype",
"Type1");
317 font.insertName(
"BaseFont",
info->fPostScriptName);
318 }
319
320
321 unsigned glyphCount = 1 + lastGlyphID - firstGlyphID;
322 SkASSERT(glyphCount > 0 && glyphCount <= 255);
323 font.insertInt(
"FirstChar", (
size_t)0);
324 font.insertInt(
"LastChar", (
size_t)glyphCount);
325 {
326 int emSize;
328
329 int glyphRangeSize = lastGlyphID - firstGlyphID + 2;
331 glyphIDs[0] = 0;
332 for (unsigned gId = firstGlyphID; gId <= lastGlyphID; gId++) {
333 glyphIDs[gId - firstGlyphID + 1] = gId;
334 }
337 auto glyphs = metrics.glyphs(
SkSpan(glyphIDs.get(), glyphRangeSize));
338 for (
int i = 0;
i < glyphRangeSize; ++
i) {
340 }
341 font.insertObject(
"Widths", std::move(
widths));
342 }
344 encDiffs->reserve(lastGlyphID - firstGlyphID + 3);
345 encDiffs->appendInt(0);
346
347 SkASSERT(glyphNames.size() > lastGlyphID);
349 encDiffs->appendName(glyphNames[0].isEmpty() ? unknown : glyphNames[0]);
350 for (int gID = firstGlyphID; gID <= lastGlyphID; gID++) {
351 encDiffs->appendName(glyphNames[gID].isEmpty() ? unknown : glyphNames[gID]);
352 }
353
355 encoding->insertObject("Differences", std::move(encDiffs));
356 font.insertObject(
"Encoding", std::move(encoding));
357
359}
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)
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >
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.