aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-03-19 11:12:44 +0000
committerJeremias Maerki <jeremias@apache.org>2006-03-19 11:12:44 +0000
commit3df0079c8b2caceeb750ebadc32422a39642a328 (patch)
treeb80500ec7abcf88cf8fa117b733d007ac0c18d24
parentb5e92d63fede78c3119295825d15d6c51729353f (diff)
downloadxmlgraphics-fop-3df0079c8b2caceeb750ebadc32422a39642a328.tar.gz
xmlgraphics-fop-3df0079c8b2caceeb750ebadc32422a39642a328.zip
Bugzilla #38731:
More accurate font size selection. Outer transformation matrix is no longer ignored when painting text. Improvement for transparent bitmaps (effect can be seen on filters-composite-01-b and render-groups-03-t in SVG 1.1 test suite) Submitted by: Michal Sevcenko <sevcenko.at.vc.cvut.cz> git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@386954 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/svg/PDFGraphics2D.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java
index 9a8ef1d7a..59cb6612d 100644
--- a/src/java/org/apache/fop/svg/PDFGraphics2D.java
+++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java
@@ -578,7 +578,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
BitmapImage fopimg = new BitmapImage("TempImage:"
+ img.toString(), buf.getWidth(),
buf.getHeight(), result, ref);
- fopimg.setTransparent(new PDFColor(255, 255, 255));
imageInfo = pdfDoc.addImage(resourceContext, fopimg);
//int xObjectNum = imageInfo.getXNumber();
@@ -1385,17 +1384,19 @@ public class PDFGraphics2D extends AbstractGraphics2D {
preparePainting();
Font fontState;
+ AffineTransform fontTransform = null;
if (ovFontState == null) {
java.awt.Font gFont = getFont();
+ fontTransform = gFont.getTransform();
String n = gFont.getFamily();
if (n.equals("sanserif")) {
n = "sans-serif";
}
- int siz = gFont.getSize();
+ float siz = gFont.getSize2D();
String style = gFont.isItalic() ? "italic" : "normal";
int weight = gFont.isBold() ? Font.BOLD : Font.NORMAL;
FontTriplet triplet = fontInfo.fontLookup(n, style, weight);
- fontState = fontInfo.getFontInstance(triplet, siz * 1000);
+ fontState = fontInfo.getFontInstance(triplet, (int)(siz * 1000 + 0.5));
} else {
fontState = fontInfo.getFontInstance(
ovFontState.getFontTriplet(), ovFontState.getFontSize());
@@ -1465,10 +1466,18 @@ public class PDFGraphics2D extends AbstractGraphics2D {
currentStream.write("BT\n");
- //currentStream.write("1 0 0 -1 0 0 Tm [" + startText);
- currentStream.write("1 0 0 -1 "
- + PDFNumber.doubleOut(x) + " " + PDFNumber.doubleOut(y)
- + " Tm [" + startText);
+ AffineTransform localTransform = new AffineTransform();
+ localTransform.translate(x, y);
+ if (fontTransform != null) {
+ localTransform.concatenate(fontTransform);
+ }
+ localTransform.scale(1, -1);
+ double[] lt = new double[6];
+ localTransform.getMatrix(lt);
+ currentStream.write(PDFNumber.doubleOut(lt[0]) + " "
+ + PDFNumber.doubleOut(lt[1]) + " " + PDFNumber.doubleOut(lt[2]) + " "
+ + PDFNumber.doubleOut(lt[3]) + " " + PDFNumber.doubleOut(lt[4]) + " "
+ + PDFNumber.doubleOut(lt[5]) + " Tm [" + startText);
int l = s.length();