/* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file.
*/ #ifndef SkPDFFont_DEFINED #define SkPDFFont_DEFINED
class SkPDFStrike : public SkRefCnt { public: /** Make or return an existing SkPDFStrike, canonicalizing for resource de-duplication. * The SkPDFStrike is owned by the SkPDFDocument.
*/ static sk_sp<SkPDFStrike> Make(SkPDFDocument* doc, const SkFont&, const SkPaint&);
/** Get the font resource for the glyph. * The returned SkPDFFont is owned by the SkPDFStrike. * @param glyph The glyph of interest
*/
SkPDFFont* getFontResource(const SkGlyph* glyph);
/** \class SkPDFFont A PDF Object class representing a PDF Font. SkPDFFont are owned by an SkPDFStrike.
*/ class SkPDFFont { public:
~SkPDFFont();
SkPDFFont(SkPDFFont&&);
SkPDFFont& operator=(SkPDFFont&&) = delete;
/** Returns the font type represented in this font. For Type0 fonts, * returns the type of the descendant font.
*/
SkAdvancedTypefaceMetrics::FontType getType() const { return fFontType; }
staticbool IsMultiByte(SkAdvancedTypefaceMetrics::FontType type) { return type == SkAdvancedTypefaceMetrics::kType1CID_Font ||
type == SkAdvancedTypefaceMetrics::kTrueType_Font ||
type == SkAdvancedTypefaceMetrics::kCFF_Font;
}
/** Returns true if this font encoding supports glyph IDs above 255.
*/ bool multiByteGlyphs() const { return SkPDFFont::IsMultiByte(this->getType()); }
/** Return true if this font has an encoding for the passed glyph id.
*/ bool hasGlyph(SkGlyphID gid) { return (gid >= this->firstGlyphID() && gid <= this->lastGlyphID()) || gid == 0;
}
/** Convert the input glyph ID into the font encoding. */
SkGlyphID glyphToPDFFontEncoding(SkGlyphID gid) const { if (this->multiByteGlyphs() || gid == 0) { return gid;
}
SkASSERT(gid >= this->firstGlyphID() && gid <= this->lastGlyphID());
SkASSERT(this->firstGlyphID() > 0); return gid - this->firstGlyphID() + 1;
}
/** Gets SkAdvancedTypefaceMetrics, and caches the result. * @param typeface can not be nullptr. * @return nullptr only when typeface is bad.
*/ staticconst SkAdvancedTypefaceMetrics* GetMetrics(const SkTypeface& typeface,
SkPDFDocument* canon);
SkPDFFont(const SkPDFStrike*,
SkGlyphID firstGlyphID,
SkGlyphID lastGlyphID,
SkAdvancedTypefaceMetrics::FontType fontType,
SkPDFIndirectReference indirectReference); // The glyph IDs accessible with this font. For Type1 (non CID) fonts, // this will be a subset if the font has more than 255 glyphs.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.