Ejemplo n.º 1
0
        public virtual void GetAscentOfGlyphWithoutBBoxTest()
        {
            PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont();
            font.SetFontProgram(new PdfFontUnitTest.TestFontProgram());
            int expectedValue = (int)(FONT_METRICS_ASCENT * FONT_SIZE / (double)FontProgram.UNITS_NORMALIZATION);

            NUnit.Framework.Assert.AreEqual(expectedValue, font.GetAscent(PdfFontUnitTest.TestFont.SIMPLE_GLYPH_WITHOUT_BBOX
                                                                          , FONT_SIZE));
        }
Ejemplo n.º 2
0
        public virtual void GetAscentOfGlyphTest()
        {
            PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont();
            int expectedAscent            = font.GetGlyph(PdfFontUnitTest.TestFont.SIMPLE_GLYPH).GetBbox()[3];
            int expectedValue             = (int)(expectedAscent * FONT_SIZE / (double)FontProgram.UNITS_NORMALIZATION);

            NUnit.Framework.Assert.AreEqual(expectedValue, font.GetAscent(PdfFontUnitTest.TestFont.SIMPLE_GLYPH, FONT_SIZE
                                                                          ));
        }
Ejemplo n.º 3
0
        public virtual void GetAscentOfTextWithGlyphWithoutBBoxTest()
        {
            PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont();
            font.SetFontProgram(new PdfFontUnitTest.TestFontProgram());
            char[] text              = new char[] { (char)PdfFontUnitTest.TestFont.SIMPLE_GLYPH, (char)PdfFontUnitTest.TestFont.SIMPLE_GLYPH_WITHOUT_BBOX };
            String textAsString      = new String(text);
            int    expectedMaxAscent = Math.Max(font.GetGlyph(PdfFontUnitTest.TestFont.SIMPLE_GLYPH).GetBbox()[3], FONT_METRICS_ASCENT
                                                );
            int expectedValue = (int)(expectedMaxAscent * FONT_SIZE / (double)FontProgram.UNITS_NORMALIZATION);

            NUnit.Framework.Assert.AreEqual(expectedValue, font.GetAscent(textAsString, FONT_SIZE));
        }
Ejemplo n.º 4
0
        public virtual void GetAscentOfTextTest()
        {
            PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont();
            char[] text = new char[] { (char)PdfFontUnitTest.TestFont.SIMPLE_GLYPH, PdfFontUnitTest.TestFont.COMPLEX_GLYPH_AS_CHARS
                                       [0], PdfFontUnitTest.TestFont.COMPLEX_GLYPH_AS_CHARS[1] };
            String textAsString      = new String(text);
            int    expectedMaxAscent = Math.Max(font.GetGlyph(PdfFontUnitTest.TestFont.SIMPLE_GLYPH).GetBbox()[3], font.GetGlyph
                                                    (PdfFontUnitTest.TestFont.COMPLEX_GLYPH).GetBbox()[3]);
            int expectedValue = (int)(expectedMaxAscent * FONT_SIZE / (double)FontProgram.UNITS_NORMALIZATION);

            NUnit.Framework.Assert.AreEqual(expectedValue, font.GetAscent(textAsString, FONT_SIZE));
        }