You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by d0m3n <do...@gmail.com> on 2011/04/14 08:12:30 UTC

Arial normal = italic

Hello. I'm using Fop 1.0 to create reports in Java and print
(MimeConstants.MIME_FOP_PRINT) or view (MimeConstants.MIME_FOP_AWT_PREVIEW)
them. 

I've been using Fop 1.0 with Windows XP and 2000 and everything worked
perfecty. Now I upgraded to Windows 7 and Vista and the same configuration
and templates output normal Arial fonts in italic. Other styles like bold
and other fonts like Courier or Times work normally.

My fop.xconf doesn't have a renderer for theese two mime types and as far as
I tried they are ignored (the problem remains). Output to PDF works normally
(normal = normal). I have a renderer in fop.xconf for PDF with
<fonts><auto-detect/></fonts>.

Any clues as to what I can try would be helpful. Thank you.
-- 
View this message in context: http://old.nabble.com/Arial-normal-%3D-italic-tp31394132p31394132.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Arial normal = italic SOLVED!

Posted by d0m3n <do...@gmail.com>.
As I figured out yesterday the problem was in the mapping of Slovenian fonts
by FOP. I found out that 1 FontTriplet can have multiple internal keys and 1
multiple internal key can include more than 1 FontTriplet. In my case
FontTriplet: Arial, normal, 400 had 2 internal keys F42 and F57. F42 had
only 1 FontTriplet as for F57 it had these two: Arial Poševno, normal, 400
(which is actually ariali.ttf) and Arial, normal, 400. FOP used the F57
instead of F42 for unknown reason.

I solved the issue by changing the FontMetrics for F57 from Arial Poševno to
Arial. Here is my code which is limited only to Arial font as we only use
this type.
Fop fop = fopFactory.newFop(MimeConstants.MIME_FOP_PRINT, userAgent);
FontInfo fi = renderer.getFontInfo();
String key = fi.getInternalFontKey(new FontTriplet("Arial", "normal", 400,
0));
FontMetrics fm = fi.getMetricsFor(key);
if (!fm.getFontName().equals("Arial")) {
	Iterator<String> it = fi.getFonts().keySet().iterator();
	while (it.hasNext()) {
		String itKey = it.next();
		SystemFontMetricsMapper sfmm =
(SystemFontMetricsMapper)fi.getFonts().get(itKey);
		if (sfmm.getFontName().equals("Arial")) { // replace font matrix from
Arial posevno to Arial!
			fi.addMetrics(key, fi.getMetricsFor(itKey));
			break;
		}
	}
}
-- 
View this message in context: http://old.nabble.com/Arial-normal-%3D-italic-tp31394132p31455462.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: Arial normal = italic

Posted by d0m3n <do...@gmail.com>.
I figured out that the problem is in my Windows 7 locale setting (Language
for non-Unicode programs). Arial, normal, 400 is mapped to Arial Poševno,
normal, 400 which is Arial Italic, normal, 400. This is done in
PageableRenderer when doing:
Fop fop = fopFactory.newFop(MimeConstants.MIME_FOP_PRINT, userAgent);

I can see the mapping in FontInfo part of the renderer. I will try to change
the OS locale programmaticaly ... the Locale.setDefault doesn't work :(
-- 
View this message in context: http://old.nabble.com/Arial-normal-%3D-italic-tp31394132p31448886.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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