我使用的iText和ColdFusion(Java)来写文本字符串到PDF文档字距。我有我需要使用的trueType和openType字体。 TrueType字体似乎一切正常,但字距不被用于杂项文件结尾的任何字体文件。下面的代码在Airstream的(的OpenType)写道“文本的行1”,但“T”和“e”之间的字距丢失。当其他程序使用相同的字体时,它具有字距。我也下载了更新版本的itext,但字距依然不起作用。有谁知道如何在itext中使用otf字体进行字距调整?OpenType字体与iText的
<cfscript>
pdfContentByte = createObject("java","com.lowagie.text.pdf.PdfContentByte");
BaseFont= createObject("java","com.lowagie.text.pdf.BaseFont");
bf = BaseFont.createFont("c:\windows\fonts\AirstreamITCStd.otf", "" , BaseFont.EMBEDDED);
document = createobject("java","com.lowagie.text.Document").init();
fileOutput = createObject("java","java.io.FileOutputStream").init("c:\inetpub\test.pdf");
writer = createobject("java","com.lowagie.text.pdf.PdfWriter").getInstance(document,fileOutput);
document.open();
cb = writer.getDirectContent();
cb.beginText();
cb.setFontAndSize(bf, 72);
cb.showTextAlignedKerned(PdfContentByte.ALIGN_LEFT,"Line 1 of Text",0,72,0);
cb.endText();
document.close();
bf.hasKernPairs(); //returns NO
bf.getClass().getName(); //returns "com.lowagie.text.pdf.TrueTypeFont"
</cfscript>