xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d0m3n <domen.ko...@gmail.com>
Subject Arial normal = italic SOLVED!
Date Fri, 22 Apr 2011 09:59:52 GMT

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


Mime
View raw message