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 )); }
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)); }
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)); }