Exemplo n.º 1
0
        public virtual void AddAlreadyExistingGlyphTest()
        {
            PdfDictionary dictionary = new PdfDictionary();

            dictionary.Put(PdfName.FontMatrix, new PdfArray());
            PdfDictionary charProcs = new PdfDictionary();

            charProcs.Put(new PdfName("A"), new PdfStream());
            dictionary.Put(PdfName.CharProcs, charProcs);
            dictionary.Put(PdfName.Widths, new PdfArray());
            PdfType3Font type3Font  = new _PdfType3Font_90(dictionary);
            Type3Glyph   type3Glyph = type3Font.AddGlyph('A', 1, 2, 3, 5, 8);

            NUnit.Framework.Assert.AreEqual(0, type3Glyph.GetWx(), EPS);
            NUnit.Framework.Assert.AreEqual(0, type3Glyph.GetLlx(), EPS);
            NUnit.Framework.Assert.AreEqual(0, type3Glyph.GetLly(), EPS);
            NUnit.Framework.Assert.AreEqual(0, type3Glyph.GetUrx(), EPS);
            NUnit.Framework.Assert.AreEqual(0, type3Glyph.GetUry(), EPS);
        }
Exemplo n.º 2
0
        public override void Flush()
        {
            if (((Type3FontProgram)GetFontProgram()).GetGlyphsCount() < 1)
            {
                throw new PdfException("no.glyphs.defined.fo r.type3.font");
            }
            PdfDictionary charProcs = new PdfDictionary();

            for (int i = 0; i < 256; i++)
            {
                if (fontEncoding.CanDecode(i))
                {
                    Type3Glyph glyph = GetType3Glyph(fontEncoding.GetUnicode(i));
                    charProcs.Put(new PdfName(fontEncoding.GetDifference(i)), glyph.GetContentStream());
                }
            }
            GetPdfObject().Put(PdfName.CharProcs, charProcs);
            GetPdfObject().Put(PdfName.FontMatrix, new PdfArray(GetFontMatrix()));
            GetPdfObject().Put(PdfName.FontBBox, new PdfArray(fontProgram.GetFontMetrics().GetBbox()));
            base.FlushFontData(null, PdfName.Type3);
            base.Flush();
        }