> f.getWordWidth("aaaaa") and f.getWordWidth("kkkkk") give the same result (15) 
> although the k's take more space (7 k's = 8 a's). 

And the reason is:

org.apache.fop.fonts.Font.getWidth(int charnum) {
        return (metric.getWidth(charnum, fontSize) / 1000);
}
metric.getWidth gives a quite fine value (for Helvetica): 3000 for k, 3336 for 
a. And then this method kills the interesting last three digits and returns 3 
in any case. Is this really necessary? And is this still the correct mailing 
list? And why is Outlook killing the line breaks? I'd not bother to read this 
stuff if it were not my own.

Regards,
 
Georg Datterl
 
------ Kontakt ------
 
Georg Datterl
 
Geneon media solutions gmbh
Gutenstetter Straße 8a
90449 Nürnberg
 
HRB Nürnberg: 17193
Geschäftsführer: Yong-Harry Steiert 

Tel.: 0911/36 78 88 - 26
Fax: 0911/36 78 88 - 20
 
www.geneon.de
 
Weitere Mitglieder der Willmy MediaGroup:
 
IRS Integrated Realization Services GmbH:    www.irs-nbg.de 
Willmy PrintMedia GmbH:                            www.willmy.de
Willmy Consult & Content GmbH:                 www.willmycc.de 
-----Ursprüngliche Nachricht-----
Von: Georg Datterl [mailto:georg.datt...@geneon.de] 
Gesendet: Donnerstag, 18. Dezember 2008 13:22
An: fop-users@xmlgraphics.apache.org
Betreff: AW: AW: Usage of Font.getWordWidth()

Hi Jeremias,

I now have this code: 

FopFactory fopFactory = FopFactory.newInstance(); fopFactory.setUserConfig(new 
File("fonts/fop.xconf")); FOUserAgent foUserAgent = 
fopFactory.newFOUserAgent(); RendererFactory rf = new RendererFactory(); 
Renderer r = rf.createRenderer(foUserAgent, "application/pdf"); PDFRenderer pr 
= (PDFRenderer)r; PDFRendererConfigurator prc = new 
PDFRendererConfigurator(foUserAgent);
prc.configure(r);
pr.setupFontInfo(new FontInfo());
FontInfo info = pr.getFontInfo();
FontSetup.setup(info);
//// object before this line can be cached, I assume /////////////// 
FontTriplet fontTriplet = info.createFontKey(fontName, 
org.apache.fop.fonts.Font.STYLE_NORMAL, org.apache.fop.fonts.Font.WEIGHT_NORMAL 
); org.apache.fop.fonts.Font f = info.getFontInstance(fontTriplet, fontSize); 
f.getWordWidth("myText");

But: 
f.getWordWidth("aaaaa") and f.getWordWidth("kkkkk") give the same result (15) 
although the k's take more space (7 k's = 8 a's).

Regards,
 
Georg Datterl
 
------ Kontakt ------
 
Georg Datterl
 
Geneon media solutions gmbh
Gutenstetter Straße 8a
90449 Nürnberg
 
HRB Nürnberg: 17193
Geschäftsführer: Yong-Harry Steiert 

Tel.: 0911/36 78 88 - 26
Fax: 0911/36 78 88 - 20
 
www.geneon.de
 
Weitere Mitglieder der Willmy MediaGroup:
 
IRS Integrated Realization Services GmbH:    www.irs-nbg.de 
Willmy PrintMedia GmbH:                            www.willmy.de
Willmy Consult & Content GmbH:                 www.willmycc.de 

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to