简体   繁体   English

java.awt.font到com.itextpdf.text.fontfactory

[英]java.awt.font to com.itextpdf.text.fontfactory

I'm doing an application that will putting together a pdf with iText library and among other things the source (typography) is selected by jfontchooser (font selector). 我正在做一个将iText库与pdf放在一起的应用程序,除其他事项外,源(字体)由jfontchooser(字体选择器)选择。

The problem is that jfontchooser returns the name of the source. 问题是jfontchooser返回源的名称。 If I select Times New Roman returns exactly "Times New Roman" 如果选择“ Times New Roman”,则返回“ Times New Roman”

But itext needs "Times- Roman" and I cannot find a way how to translate it. 但是itext需要“ Times-Roman”,我找不到翻译方法。

I would like to translate java.awt.font to com.itextpdf.text.fontfactory 我想将java.awt.font转换为com.itextpdf.text.fontfactory

the next attempt so get saved in a txt source (of course I put static data to be understood. ) 下次尝试将其保存在txt源中(当然,我将静态数据理解为。)

String fuenteNombre = "Times New Roman";
int fuenteSize = 14;
int fuenteEstilo = 1;
Color fuenteColor = new Color(0,0,0,255);

this.fuenteTitulo = FontFactory.getFont(fuenteNombre,
                        fuenteSize,
                        fuenteEstilo,
                        fuenteColor);

我使用defaultFontMapper解决了问题。请参见http://www.forosdelweb.com/f45/problema-con-font-itext-1111176/#post4647340

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM