Beispiel #1
0
        internal PdfType0Font(PdfDirectObject baseObject) : base(baseObject)
        {
            gsubData   = DefaultGsubData.NO_DATA_FOUND;
            cmapLookup = null;

            var fonts = Dictionary.Resolve(PdfName.DescendantFonts);

            if (!(fonts is PdfArray))
            {
                throw new IOException("Missing descendant font array");
            }
            var descendantFonts = (PdfArray)fonts;

            if (descendantFonts.Count == 0)
            {
                throw new IOException("Descendant font array is empty");
            }
            var descendantFontDictBase = descendantFonts.Resolve(0);

            if (!(descendantFontDictBase is PdfDictionary))
            {
                throw new IOException("Missing descendant font dictionary");
            }
            ReadEncoding();
        }
 public GsubWorkerForBengali(ICmapLookup cmapLookup, GsubData gsubData)
 {
     this.cmapLookup            = cmapLookup;
     this.gsubData              = gsubData;
     beforeHalfGlyphIds         = GetBeforeHalfGlyphIds();
     beforeAndAfterSpanGlyphIds = GetBeforeAndAfterSpanGlyphIds();
 }
Beispiel #3
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();
                }
            }
        }
Beispiel #4
0
        public GsubWorker GetGsubWorker(ICmapLookup cmapLookup, GsubData gsubData)
        {
            switch (gsubData.Language)
            {
            case Language.beng:
            case Language.bng2:
                return(new GsubWorkerForBengali(cmapLookup, gsubData));

            default:
                throw new NotSupportedException(
                          "The language " + gsubData.Language + " is not yet supported");
            }
        }