Exemplo n.º 1
0
        internal PdfType0Font(Document document, TrueTypeFont ttf, bool embedSubset, bool closeTTF, bool vertical)
            : base(document, new PdfDictionary())
        {
            if (vertical)
            {
                ttf.EnableVerticalSubstitutions();
            }

            gsubData   = ttf.GsubData;
            cmapLookup = ttf.GetUnicodeCmapLookup();

            embedder = new PdfCIDFontType2Embedder(document, Dictionary, ttf, embedSubset, this, vertical);
            CIDFont  = embedder.GetCIDFont();
            ReadEncoding();
            if (closeTTF)
            {
                if (embedSubset)
                {
                    this.ttf = ttf;
                    //TODO document.registerTrueTypeFontForClosing(ttf);
                }
                else
                {
                    // the TTF is fully loaded and it is safe to close the underlying data source
                    ttf.Dispose();
                }
            }
        }
Exemplo n.º 2
0
        /**
         * Creates a new TrueType font for embedding.
         */
        private PdfTrueTypeFont(Document document, TrueTypeFont ttf, Encoding encoding, bool closeTTF)
            : base(document)
        {
            PDTrueTypeFontEmbedder embedder = new PDTrueTypeFontEmbedder(document, Dictionary, ttf, encoding);

            this.encoding  = encoding;
            this.ttf       = ttf;
            FontDescriptor = embedder.FontDescriptor;
            isEmbedded     = true;
            isDamaged      = false;
            glyphList      = GlyphMapping.Default;
            if (closeTTF)
            {
                // the TTF is fully loaded and it is safe to close the underlying data source
                ttf.Dispose();
            }
        }