diff --git a/src/iTextSharp.LGPLv2.Core.FunctionalTests/TestUtils.cs b/src/iTextSharp.LGPLv2.Core.FunctionalTests/TestUtils.cs index 25b51f2..d1565d0 100644 --- a/src/iTextSharp.LGPLv2.Core.FunctionalTests/TestUtils.cs +++ b/src/iTextSharp.LGPLv2.Core.FunctionalTests/TestUtils.cs @@ -65,6 +65,11 @@ public static string GetSimSunFontPath() return Path.Combine(GetBaseDir(), ITextExamplesFolder, ResourcesFolder, "fonts", "simsun.ttf"); } + public static string GetThaiFontPath() + { + return Path.Combine(GetBaseDir(), ITextExamplesFolder, ResourcesFolder, "fonts", "thsarabunnew.ttf"); + } + public static string GetTxtPath(string fileName) { return Path.Combine(GetBaseDir(), ITextExamplesFolder, ResourcesFolder, "txt", fileName); diff --git a/src/iTextSharp.LGPLv2.Core.FunctionalTests/iTextExamples/Chapter11Tests.cs b/src/iTextSharp.LGPLv2.Core.FunctionalTests/iTextExamples/Chapter11Tests.cs index 87ff916..f51922b 100644 --- a/src/iTextSharp.LGPLv2.Core.FunctionalTests/iTextExamples/Chapter11Tests.cs +++ b/src/iTextSharp.LGPLv2.Core.FunctionalTests/iTextExamples/Chapter11Tests.cs @@ -163,5 +163,28 @@ public void Verify_Chinese_PDF_File_CanBeCreated() TestUtils.VerifyPdfFileIsReadable(pdfFilePath); } + + [TestMethod] + public void Verify_Thai_PDF_File_CanBeCreated() + { + var pdfDoc = new Document(PageSize.A4); + + var pdfFilePath = TestUtils.GetOutputFileName(); + var fileStream = new FileStream(pdfFilePath, FileMode.Create); + PdfWriter.GetInstance(pdfDoc, fileStream); + + pdfDoc.AddAuthor(TestUtils.Author); + pdfDoc.Open(); + + var chinese = "ทดสอบ ภาษาไทย ฝีมือ พึ่ง พ่อ กู รู้ ดู กันต์ ก๋ยวเตี๋ยว"; + + var tahomaFont = TestUtils.GetUnicodeFont("THSarabunNew", TestUtils.GetThaiFontPath(), 20, Font.NORMAL, BaseColor.Black); + pdfDoc.Add(new Paragraph(chinese, tahomaFont)); + + pdfDoc.Close(); + fileStream.Dispose(); + + TestUtils.VerifyPdfFileIsReadable(pdfFilePath); + } } } \ No newline at end of file diff --git a/src/iTextSharp.LGPLv2.Core.FunctionalTests/iTextExamples/resources/fonts/THSarabunNew.ttf b/src/iTextSharp.LGPLv2.Core.FunctionalTests/iTextExamples/resources/fonts/THSarabunNew.ttf new file mode 100644 index 0000000..d659489 Binary files /dev/null and b/src/iTextSharp.LGPLv2.Core.FunctionalTests/iTextExamples/resources/fonts/THSarabunNew.ttf differ