public virtual void ZeroGlyphIsAllowedOnlyIfFontIsSymbolicTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); NUnit.Framework.Assert.IsFalse(font.ContainsGlyph(PdfFontUnitTest.TestFont.ZERO_CODE_GLYPH)); font.SetFontProgram(new PdfFontUnitTest.TestFontProgram()); NUnit.Framework.Assert.IsTrue(font.ContainsGlyph(PdfFontUnitTest.TestFont.ZERO_CODE_GLYPH)); }
public virtual void GetFontProgramTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); PdfFontUnitTest.TestFontProgram program = new PdfFontUnitTest.TestFontProgram(); NUnit.Framework.Assert.IsNull(font.GetFontProgram()); font.SetFontProgram(program); NUnit.Framework.Assert.AreEqual(program, font.GetFontProgram()); }
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)); }
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)); }