简体   繁体   中英

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).

The problem is that jfontchooser returns the name of the source. If I select Times New Roman returns exactly "Times New Roman"

But itext needs "Times- Roman" and I cannot find a way how to translate it.

I would like to translate java.awt.font to com.itextpdf.text.fontfactory

the next attempt so get saved in a txt source (of course I put static data to be understood. )

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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