Browse Source

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
tags/fop-0_92-beta
Jeremias Maerki 18 years ago
parent
commit
3df0079c8b
1 changed files with 16 additions and 7 deletions
  1. 16
    7
      src/java/org/apache/fop/svg/PDFGraphics2D.java

+ 16
- 7
src/java/org/apache/fop/svg/PDFGraphics2D.java View File

@@ -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();


Loading…
Cancel
Save