public virtual void UnsupportedCmapTest() { NUnit.Framework.Assert.That(() => { TrueTypeFont ttf = new TrueTypeFont(sourceFolder + "NotoSerif-Regular_v1.7.ttf"); PdfType0Font type0Font = new PdfType0Font(ttf, PdfEncodings.WINANSI); } , NUnit.Framework.Throws.InstanceOf <PdfException>().With.Message.EqualTo(PdfException.OnlyIdentityCMapsSupportsWithTrueType)) ; }
public virtual void TrueTypeFontProgramIdentityHAllowEmbeddingEncodingPreferNotEmbeddedTest() { TrueTypeFont fontProgram = new PdfFontFactoryTest.CustomTrueTypeFontProgram(true); PdfType0Font font = (PdfType0Font)PdfFontFactory.CreateFont(fontProgram, PdfEncodings.IDENTITY_H, PdfFontFactory.EmbeddingStrategy .PREFER_NOT_EMBEDDED); NUnit.Framework.Assert.IsNotNull(font); NUnit.Framework.Assert.IsTrue(font.IsEmbedded()); }
public virtual void DeprecatedEmbeddedFlagFalseWorksAsPreferNotEmbeddedTest() { // simply checks that embedded = false works as prefer not embedded // this test can be safely removed with clean up of deprecated methods in PdfFontFactory TrueTypeFont fontProgram = new PdfFontFactoryTest.CustomTrueTypeFontProgram(true); PdfType0Font font = (PdfType0Font)PdfFontFactory.CreateFont(fontProgram, PdfEncodings.IDENTITY_H, false); NUnit.Framework.Assert.IsNotNull(font); NUnit.Framework.Assert.IsTrue(font.IsEmbedded()); }
public virtual void TrueTypeFontAndCmapConstructorTest() { TrueTypeFont ttf = new TrueTypeFont(sourceFolder + "NotoSerif-Regular_v1.7.ttf"); PdfType0Font type0Font = new PdfType0Font(ttf, PdfEncodings.IDENTITY_H); CMapEncoding cmap = type0Font.GetCmap(); NUnit.Framework.Assert.IsNotNull(cmap); NUnit.Framework.Assert.IsTrue(cmap.IsDirect()); NUnit.Framework.Assert.IsFalse(cmap.HasUniMap()); NUnit.Framework.Assert.IsNull(cmap.GetUniMapName()); NUnit.Framework.Assert.AreEqual("Adobe", cmap.GetRegistry()); NUnit.Framework.Assert.AreEqual("Identity", cmap.GetOrdering()); NUnit.Framework.Assert.AreEqual(0, cmap.GetSupplement()); NUnit.Framework.Assert.AreEqual(PdfEncodings.IDENTITY_H, cmap.GetCmapName()); }
public virtual void DictionaryConstructorTest() { String filePath = sourceFolder + "documentWithType0Noto.pdf"; PdfDocument pdfDocument = new PdfDocument(new PdfReader(filePath)); PdfDictionary fontDict = pdfDocument.GetPage(1).GetResources().GetResource(PdfName.Font).GetAsDictionary(new PdfName("F1")); PdfType0Font type0Font = new PdfType0Font(fontDict); CMapEncoding cmap = type0Font.GetCmap(); NUnit.Framework.Assert.IsNotNull(cmap); NUnit.Framework.Assert.IsTrue(cmap.IsDirect()); NUnit.Framework.Assert.IsFalse(cmap.HasUniMap()); NUnit.Framework.Assert.IsNull(cmap.GetUniMapName()); NUnit.Framework.Assert.AreEqual("Adobe", cmap.GetRegistry()); NUnit.Framework.Assert.AreEqual("Identity", cmap.GetOrdering()); NUnit.Framework.Assert.AreEqual(0, cmap.GetSupplement()); NUnit.Framework.Assert.AreEqual(PdfEncodings.IDENTITY_H, cmap.GetCmapName()); }