xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gad...@apache.org
Subject svn commit: r1293736 [21/38] - in /xmlgraphics/fop/trunk: ./ src/codegen/java/org/apache/fop/tools/ src/codegen/unicode/java/org/apache/fop/complexscripts/ src/codegen/unicode/java/org/apache/fop/complexscripts/bidi/ src/documentation/content/xdocs/tru...
Date Sun, 26 Feb 2012 02:29:29 GMT
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DPainter.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DPainter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DPainter.java Sun Feb
26 02:29:01 2012
@@ -42,6 +42,7 @@ import org.apache.fop.render.intermediat
 import org.apache.fop.render.intermediate.IFException;
 import org.apache.fop.render.intermediate.IFPainter;
 import org.apache.fop.render.intermediate.IFState;
+import org.apache.fop.render.intermediate.IFUtil;
 import org.apache.fop.traits.BorderProps;
 import org.apache.fop.traits.RuleStyle;
 import org.apache.fop.util.CharUtilities;
@@ -184,11 +185,11 @@ public class Java2DPainter extends Abstr
     }
 
     /** {@inheritDoc} */
-    public void drawBorderRect(Rectangle rect, BorderProps before, BorderProps after,
-            BorderProps start, BorderProps end) throws IFException {
-        if (before != null || after != null || start != null || end != null) {
+    public void drawBorderRect(Rectangle rect, BorderProps top, BorderProps bottom,
+            BorderProps left, BorderProps right) throws IFException {
+        if (top != null || bottom != null || left != null || right != null) {
             try {
-                this.borderPainter.drawBorders(rect, before, after, start, end);
+                this.borderPainter.drawBorders(rect, top, bottom, left, right);
             } catch (IOException e) {
                 //Won't happen with Java2D
                 throw new IllegalStateException("Unexpected I/O error");
@@ -203,7 +204,7 @@ public class Java2DPainter extends Abstr
     }
 
     /** {@inheritDoc} */
-    public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx, String
text)
+    public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[][] dp, String
text)
             throws IFException {
         g2dState.updateColor(state.getTextColor());
         FontTriplet triplet = new FontTriplet(
@@ -220,6 +221,7 @@ public class Java2DPainter extends Abstr
         Point2D cursor = new Point2D.Float(0, 0);
 
         int l = text.length();
+        int[] dx = IFUtil.convertDPToDX ( dp );
         int dxl = (dx != null ? dx.length : 0);
 
         if (dx != null && dxl > 0 && dx[0] != 0) {

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DRenderer.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DRenderer.java Sun Feb
26 02:29:01 2012
@@ -178,7 +178,8 @@ public abstract class Java2DRenderer ext
         FontCollection[] fontCollections = new FontCollection[] {
                 new Base14FontCollection(java2DFontMetrics),
                 new InstalledFontCollection(java2DFontMetrics),
-                new ConfiguredFontCollection(getFontResolver(), getFontList())
+                new ConfiguredFontCollection(getFontResolver(), getFontList(),
+                                             userAgent.isComplexScriptFeaturesEnabled())
         };
         userAgent.getFactory().getFontManager().setup(
                 getFontInfo(), fontCollections);
@@ -715,7 +716,7 @@ public abstract class Java2DRenderer ext
         renderInlineAreaBackAndBorders(text);
 
         int rx = currentIPPosition + text.getBorderAndPaddingWidthStart();
-        int bl = currentBPPosition + text.getOffset() + text.getBaselineOffset();
+        int bl = currentBPPosition + text.getBlockProgressionOffset() + text.getBaselineOffset();
         int saveIP = currentIPPosition;
 
         Font font = getFontFromArea(text);
@@ -827,7 +828,7 @@ public abstract class Java2DRenderer ext
         // TODO Colors do not work on Leaders yet
 
         float startx = (currentIPPosition + area.getBorderAndPaddingWidthStart()) / 1000f;
-        float starty = ((currentBPPosition + area.getOffset()) / 1000f);
+        float starty = ((currentBPPosition + area.getBlockProgressionOffset()) / 1000f);
         float endx = (currentIPPosition + area.getBorderAndPaddingWidthStart()
                 + area.getIPD()) / 1000f;
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLPainter.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLPainter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLPainter.java Sun Feb 26 02:29:01
2012
@@ -51,6 +51,7 @@ import org.apache.fop.render.intermediat
 import org.apache.fop.render.intermediate.IFException;
 import org.apache.fop.render.intermediate.IFPainter;
 import org.apache.fop.render.intermediate.IFState;
+import org.apache.fop.render.intermediate.IFUtil;
 import org.apache.fop.render.java2d.FontMetricsMapper;
 import org.apache.fop.render.java2d.Java2DPainter;
 import org.apache.fop.traits.BorderProps;
@@ -206,13 +207,13 @@ public class PCLPainter extends Abstract
 
     /** {@inheritDoc} */
     public void drawBorderRect(final Rectangle rect,
-            final BorderProps before, final BorderProps after,
-            final BorderProps start, final BorderProps end) throws IFException {
+            final BorderProps top, final BorderProps bottom,
+            final BorderProps left, final BorderProps right) throws IFException {
         if (isSpeedOptimized()) {
-            super.drawBorderRect(rect, before, after, start, end);
+            super.drawBorderRect(rect, top, bottom, left, right);
             return;
         }
-        if (before != null || after != null || start != null || end != null) {
+        if (top != null || bottom != null || left != null || right != null) {
             final Rectangle boundingBox = rect;
             final Dimension dim = boundingBox.getSize();
 
@@ -224,7 +225,7 @@ public class PCLPainter extends Abstract
                     Java2DPainter painter = new Java2DPainter(g2d,
                             getContext(), parent.getFontInfo(), state);
                     try {
-                        painter.drawBorderRect(rect, before, after, start, end);
+                        painter.drawBorderRect(rect, top, bottom, left, right);
                     } catch (IFException e) {
                         //This should never happen with the Java2DPainter
                         throw new RuntimeException("Unexpected error while painting borders",
e);
@@ -307,7 +308,7 @@ public class PCLPainter extends Abstract
     }
 
     /** {@inheritDoc} */
-    public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx, String
text)
+    public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[][] dp, String
text)
                 throws IFException {
         try {
             FontTriplet triplet = new FontTriplet(
@@ -319,13 +320,13 @@ public class PCLPainter extends Abstract
                         ? false
                         : HardcodedFonts.setFont(gen, fontKey, state.getFontSize(), text);
             if (pclFont) {
-                drawTextNative(x, y, letterSpacing, wordSpacing, dx, text, triplet);
+                drawTextNative(x, y, letterSpacing, wordSpacing, dp, text, triplet);
             } else {
-                drawTextAsBitmap(x, y, letterSpacing, wordSpacing, dx, text, triplet);
+                drawTextAsBitmap(x, y, letterSpacing, wordSpacing, dp, text, triplet);
                 if (DEBUG) {
                     state.setTextColor(Color.GRAY);
                     HardcodedFonts.setFont(gen, "F1", state.getFontSize(), text);
-                    drawTextNative(x, y, letterSpacing, wordSpacing, dx, text, triplet);
+                    drawTextNative(x, y, letterSpacing, wordSpacing, dp, text, triplet);
                 }
             }
         } catch (IOException ioe) {
@@ -333,7 +334,7 @@ public class PCLPainter extends Abstract
         }
     }
 
-    private void drawTextNative(int x, int y, int letterSpacing, int wordSpacing, int[] dx,
+    private void drawTextNative(int x, int y, int letterSpacing, int wordSpacing, int[][]
dp,
             String text, FontTriplet triplet) throws IOException {
         Color textColor = state.getTextColor();
         if (textColor != null) {
@@ -347,6 +348,7 @@ public class PCLPainter extends Abstract
         float fontSize = state.getFontSize() / 1000f;
         Font font = parent.getFontInfo().getFontInstance(triplet, state.getFontSize());
         int l = text.length();
+        int[] dx = IFUtil.convertDPToDX ( dp );
         int dxl = (dx != null ? dx.length : 0);
 
         StringBuffer sb = new StringBuffer(Math.max(16, l));
@@ -392,7 +394,7 @@ public class PCLPainter extends Abstract
 
     private Rectangle getTextBoundingBox(                        // CSOK: ParameterNumber
             int x, int y,
-            int letterSpacing, int wordSpacing, int[] dx,
+            int letterSpacing, int wordSpacing, int[][] dp,
             String text,
             Font font, FontMetricsMapper metrics) {
         int maxAscent = metrics.getMaxAscent(font.getFontSize()) / 1000;
@@ -403,6 +405,7 @@ public class PCLPainter extends Abstract
                 0, maxAscent - descent + 2 * safetyMargin);
 
         int l = text.length();
+        int[] dx = IFUtil.convertDPToDX ( dp );
         int dxl = (dx != null ? dx.length : 0);
 
         if (dx != null && dxl > 0 && dx[0] != 0) {
@@ -432,7 +435,7 @@ public class PCLPainter extends Abstract
     }
 
     private void drawTextAsBitmap(final int x, final int y,
-            final int letterSpacing, final int wordSpacing, final int[] dx,
+            final int letterSpacing, final int wordSpacing, final int[][] dp,
             final String text, FontTriplet triplet) throws IFException {
         //Use Java2D to paint different fonts via bitmap
         final Font font = parent.getFontInfo().getFontInstance(triplet, state.getFontSize());
@@ -447,7 +450,7 @@ public class PCLPainter extends Abstract
         final int baselineOffset = maxAscent + safetyMargin;
 
         final Rectangle boundingBox = getTextBoundingBox(x, y,
-                letterSpacing, wordSpacing, dx, text, font, mapper);
+                letterSpacing, wordSpacing, dp, text, font, mapper);
         final Dimension dim = boundingBox.getSize();
 
         Graphics2DImagePainter painter = new Graphics2DImagePainter() {
@@ -470,7 +473,7 @@ public class PCLPainter extends Abstract
                 Java2DPainter painter = new Java2DPainter(g2d,
                         getContext(), parent.getFontInfo(), state);
                 try {
-                    painter.drawText(x, y, letterSpacing, wordSpacing, dx, text);
+                    painter.drawText(x, y, letterSpacing, wordSpacing, dp, text);
                 } catch (IFException e) {
                     //This should never happen with the Java2DPainter
                     throw new RuntimeException("Unexpected error while painting text", e);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java
Sun Feb 26 02:29:01 2012
@@ -119,7 +119,8 @@ public class PCLRendererConfigurator ext
             FontEventListener listener = new FontEventAdapter(
                     userAgent.getEventBroadcaster());
             List fontList = buildFontList(cfg, fontResolver, listener);
-            fontCollections.add(new ConfiguredFontCollection(fontResolver, fontList));
+            fontCollections.add(new ConfiguredFontCollection(fontResolver, fontList,
+                                userAgent.isComplexScriptFeaturesEnabled()));
         }
 
         fontManager.setup(fontInfo,

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFPainter.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFPainter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFPainter.java Sun Feb 26 02:29:01
2012
@@ -45,8 +45,10 @@ import org.apache.fop.render.intermediat
 import org.apache.fop.render.intermediate.IFContext;
 import org.apache.fop.render.intermediate.IFException;
 import org.apache.fop.render.intermediate.IFState;
+import org.apache.fop.render.intermediate.IFUtil;
 import org.apache.fop.render.pdf.PDFLogicalStructureHandler.MarkedContentInfo;
 import org.apache.fop.traits.BorderProps;
+import org.apache.fop.traits.Direction;
 import org.apache.fop.traits.RuleStyle;
 import org.apache.fop.util.CharUtilities;
 
@@ -259,12 +261,12 @@ public class PDFPainter extends Abstract
 
     /** {@inheritDoc} */
     @Override
-    public void drawBorderRect(Rectangle rect, BorderProps before, BorderProps after,
-            BorderProps start, BorderProps end) throws IFException {
-        if (before != null || after != null || start != null || end != null) {
+    public void drawBorderRect(Rectangle rect, BorderProps top, BorderProps bottom,
+            BorderProps left, BorderProps right) throws IFException {
+        if (top != null || bottom != null || left != null || right != null) {
             generator.endTextObject();
             try {
-                this.borderPainter.drawBorders(rect, before, after, start, end);
+                this.borderPainter.drawBorders(rect, top, bottom, left, right);
             } catch (IOException ioe) {
                 throw new IFException("I/O error while drawing borders", ioe);
             }
@@ -291,7 +293,7 @@ public class PDFPainter extends Abstract
     }
 
     /** {@inheritDoc} */
-    public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[] dx,
+    public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[][] dp,
             String text)
             throws IFException {
         if (accessEnabled) {
@@ -309,6 +311,19 @@ public class PDFPainter extends Abstract
 
         FontTriplet triplet = new FontTriplet(
                 state.getFontFamily(), state.getFontStyle(), state.getFontWeight());
+
+        if ( ( dp == null ) || IFUtil.isDPOnlyDX ( dp ) ) {
+            drawTextWithDX ( x, y, text, triplet, letterSpacing,
+                             wordSpacing, IFUtil.convertDPToDX ( dp ) );
+        } else {
+            drawTextWithDP ( x, y, text, triplet, letterSpacing,
+                             wordSpacing, dp );
+        }
+    }
+
+    private void drawTextWithDX ( int x, int y, String text, FontTriplet triplet,
+                                  int letterSpacing, int wordSpacing, int[] dx ) {
+
         //TODO Ignored: state.getFontVariant()
         //TODO Opportunity for font caching if font state is more heavily used
         String fontKey = getFontInfo().getInternalFontKey(triplet);
@@ -375,6 +390,70 @@ public class PDFPainter extends Abstract
         textutil.writeTJ();
     }
 
+    private static int[] paZero = new int[4];
+
+    private void drawTextWithDP ( int x, int y, String text, FontTriplet triplet,
+                                  int letterSpacing, int wordSpacing, int[][] dp ) {
+        assert text != null;
+        assert triplet != null;
+        assert dp != null;
+        String          fk              = getFontInfo().getInternalFontKey(triplet);
+        Typeface        tf              = getTypeface(fk);
+        if ( tf.isMultiByte() ) {
+            int         fs              = state.getFontSize();
+            float       fsPoints        = fs / 1000f;
+            Font        f               = getFontInfo().getFontInstance(triplet, fs);
+            // String      fn              = f.getFontName();
+            PDFTextUtil tu              = generator.getTextUtil();
+            double      xc              = 0f;
+            double      yc              = 0f;
+            double      xoLast          = 0f;
+            double      yoLast          = 0f;
+            double      wox             = wordSpacing;
+            tu.writeTextMatrix ( new AffineTransform ( 1, 0, 0, -1, x / 1000f, y / 1000f
) );
+            tu.updateTf ( fk, fsPoints, true );
+            generator.updateCharacterSpacing ( letterSpacing / 1000f );
+            for ( int i = 0, n = text.length(); i < n; i++ ) {
+                char    ch              = text.charAt ( i );
+                int[]   pa              = ( i < dp.length ) ? dp [ i ] : paZero;
+                double  xo              = xc + pa[0];
+                double  yo              = yc + pa[1];
+                double  xa              = f.getCharWidth(ch) + maybeWordOffsetX ( wox, ch,
null );
+                double  ya              = 0;
+                double  xd              = ( xo - xoLast ) / 1000f;
+                double  yd              = ( yo - yoLast ) / 1000f;
+                tu.writeTd ( xd, yd );
+                tu.writeTj ( f.mapChar ( ch ) );
+                xc += xa + pa[2];
+                yc += ya + pa[3];
+                xoLast = xo;
+                yoLast = yo;
+            }
+        }
+    }
+
+    private double maybeWordOffsetX ( double wox, char ch, Direction dir ) {
+        if ( ( wox != 0 )
+             && CharUtilities.isAdjustableSpace ( ch )
+             && ( ( dir == null ) || dir.isHorizontal() ) ) {
+            return wox;
+        } else {
+            return 0;
+        }
+    }
+
+    /*
+    private double maybeWordOffsetY ( double woy, char ch, Direction dir ) {
+        if ( ( woy != 0 )
+             && CharUtilities.isAdjustableSpace ( ch ) && dir.isVertical()
+             && ( ( dir != null ) && dir.isVertical() ) ) {
+            return woy;
+        } else {
+            return 0;
+        }
+    }
+    */
+
     private char selectAndMapSingleByteFont(SingleByteFont singleByteFont, String fontName,
             float fontSize, PDFTextUtil textutil, char ch) {
         if (singleByteFont != null && singleByteFont.hasAdditionalEncodings()) {

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java Sun
Feb 26 02:29:01 2012
@@ -112,8 +112,9 @@ public abstract class AbstractPSTranscod
         graphics = createDocumentGraphics2D();
         if (!isTextStroked()) {
             try {
+                boolean useComplexScriptFeatures = false; //TODO - FIX ME
                 this.fontInfo = PDFDocumentGraphics2DConfigurator.createFontInfo(
-                        getEffectiveConfiguration());
+                        getEffectiveConfiguration(), useComplexScriptFeatures);
                 graphics.setCustomTextHandler(new NativeTextHandler(graphics, fontInfo));
             } catch (FOPException fe) {
                 throw new TranscoderException(fe);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java Sun Feb
26 02:29:01 2012
@@ -73,7 +73,8 @@ public class NativeTextHandler implement
     private void setupFontInfo() {
         //Sets up a FontInfo with default fonts
         fontInfo = new FontInfo();
-        FontSetup.setup(fontInfo);
+        boolean base14Kerning = false;
+        FontSetup.setup(fontInfo, base14Kerning);
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSPainter.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSPainter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSPainter.java Sun Feb 26 02:29:01
2012
@@ -51,6 +51,7 @@ import org.apache.fop.render.intermediat
 import org.apache.fop.render.intermediate.IFContext;
 import org.apache.fop.render.intermediate.IFException;
 import org.apache.fop.render.intermediate.IFState;
+import org.apache.fop.render.intermediate.IFUtil;
 import org.apache.fop.traits.BorderProps;
 import org.apache.fop.traits.RuleStyle;
 import org.apache.fop.util.CharUtilities;
@@ -234,16 +235,16 @@ public class PSPainter extends AbstractI
     }
 
     /** {@inheritDoc} */
-    public void drawBorderRect(Rectangle rect, BorderProps before, BorderProps after,
-            BorderProps start, BorderProps end) throws IFException {
-        if (before != null || after != null || start != null || end != null) {
+    public void drawBorderRect(Rectangle rect, BorderProps top, BorderProps bottom,
+            BorderProps left, BorderProps right) throws IFException {
+        if (top != null || bottom != null || left != null || right != null) {
             try {
                 endTextObject();
                 if (getPSUtil().getRenderingMode() == PSRenderingMode.SIZE
-                    && hasOnlySolidBorders(before, after, start, end)) {
-                    super.drawBorderRect(rect, before, after, start, end);
+                    && hasOnlySolidBorders(top, bottom, left, right)) {
+                    super.drawBorderRect(rect, top, bottom, left, right);
                 } else {
-                    this.borderPainter.drawBorders(rect, before, after, start, end);
+                    this.borderPainter.drawBorders(rect, top, bottom, left, right);
                 }
             } catch (IOException ioe) {
                 throw new IFException("I/O error in drawBorderRect()", ioe);
@@ -343,9 +344,8 @@ public class PSPainter extends AbstractI
 
     /** {@inheritDoc} */
     public void drawText(int x, int y, int letterSpacing, int wordSpacing,
-            int[] dx, String text) throws IFException {
+            int[][] dp, String text) throws IFException {
         try {
-            //Note: dy is currently ignored
             PSGenerator generator = getGenerator();
             generator.useColor(state.getTextColor());
             beginTextObject();
@@ -383,8 +383,8 @@ public class PSPainter extends AbstractI
                     int encoding = mapped / 256;
                     if (currentEncoding != encoding) {
                         if (i > 0) {
-                            writeText(text, start, i - start, letterSpacing, wordSpacing,
dx,
-                                    font, tf);
+                            writeText(text, start, i - start,
+                                    letterSpacing, wordSpacing, dp, font, tf);
                         }
                         if (encoding == 0) {
                             useFont(fontKey, sizeMillipoints);
@@ -399,7 +399,7 @@ public class PSPainter extends AbstractI
                 //Simple single-font painting
                 useFont(fontKey, sizeMillipoints);
             }
-            writeText(text, start, textLen - start, letterSpacing, wordSpacing, dx, font,
tf);
+            writeText(text, start, textLen - start, letterSpacing, wordSpacing, dp, font,
tf);
         } catch (IOException ioe) {
             throw new IFException("I/O error in drawText()", ioe);
         }
@@ -407,7 +407,7 @@ public class PSPainter extends AbstractI
 
     private void writeText(                                      // CSOK: ParameterNumber
             String text, int start, int len,
-            int letterSpacing, int wordSpacing, int[] dx,
+            int letterSpacing, int wordSpacing, int[][] dp,
             Font font, Typeface tf) throws IOException {
         PSGenerator generator = getGenerator();
         int end = start + len;
@@ -420,6 +420,7 @@ public class PSPainter extends AbstractI
         int lineStart = 0;
         StringBuffer accText = new StringBuffer(initialSize);
         StringBuffer sb = new StringBuffer(initialSize);
+        int[] dx = IFUtil.convertDPToDX ( dp );
         int dxl = (dx != null ? dx.length : 0);
         for (int i = start; i < end; i++) {
             char orgChar = text.charAt(i);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/RTFHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/RTFHandler.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/RTFHandler.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/RTFHandler.java Sun Feb 26 02:29:01
2012
@@ -167,7 +167,8 @@ public class RTFHandler extends FOEventH
         this.os = os;
         bDefer = true;
 
-        FontSetup.setup(fontInfo, null, new DefaultFontResolver(userAgent));
+        boolean base14Kerning = false;
+        FontSetup.setup(fontInfo, null, new DefaultFontResolver(userAgent), base14Kerning);
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java Sun Feb 26 02:29:01
2012
@@ -86,6 +86,7 @@ import org.apache.fop.render.Renderer;
 import org.apache.fop.render.RendererContext;
 import org.apache.fop.render.XMLHandler;
 import org.apache.fop.util.ColorUtil;
+import org.apache.fop.util.XMLUtil;
 
 /**
  * Renderer that renders areas to XML for debugging purposes.
@@ -157,6 +158,7 @@ public class XMLRenderer extends Abstrac
     protected void addAreaAttributes(Area area) {
         addAttribute("ipd", area.getIPD());
         addAttribute("bpd", area.getBPD());
+        maybeAddLevelAttribute(area);
         if (isDetailedFormat()) {
             if (area.getIPD() != 0) {
                 addAttribute("ipda", area.getAllocIPD());
@@ -708,7 +710,7 @@ public class XMLRenderer extends Abstrac
         atts.clear();
         addAreaAttributes(viewport);
         addTraitAttributes(viewport);
-        addAttribute("offset", viewport.getOffset());
+        addAttribute("offset", viewport.getBlockProgressionOffset());
         addAttribute("pos", viewport.getContentPosition());
         if (viewport.hasClip()) {
             addAttribute("clip", "true");
@@ -770,7 +772,7 @@ public class XMLRenderer extends Abstrac
         atts.clear();
         addAreaAttributes(space);
         addTraitAttributes(space);
-        addAttribute("offset", space.getOffset());
+        addAttribute("offset", space.getBlockProgressionOffset());
         startElement("space", atts);
         endElement("space");
     }
@@ -787,7 +789,7 @@ public class XMLRenderer extends Abstrac
         if (text.getTextLetterSpaceAdjust() != 0) {
             addAttribute("tlsadjust", text.getTextLetterSpaceAdjust());
         }
-        addAttribute("offset", text.getOffset());
+        addAttribute("offset", text.getBlockProgressionOffset());
         addAttribute("baseline", text.getBaselineOffset());
         addAreaAttributes(text);
         addTraitAttributes(text);
@@ -802,7 +804,10 @@ public class XMLRenderer extends Abstrac
     @Override
     protected void renderWord(WordArea word) {
         atts.clear();
-        addAttribute("offset", word.getOffset());
+        int offset = word.getBlockProgressionOffset();
+        if ( offset != 0 ) {
+            addAttribute("offset", offset);
+        }
         int[] letterAdjust = word.getLetterAdjustArray();
         if (letterAdjust != null) {
             StringBuffer sb = new StringBuffer(64);
@@ -818,6 +823,11 @@ public class XMLRenderer extends Abstrac
                 addAttribute("letter-adjust", sb.toString());
             }
         }
+        maybeAddLevelAttribute(word);
+        maybeAddPositionAdjustAttribute(word);
+        if ( word.isReversed() ) {
+            addAttribute("reversed", "true");
+        }
         startElement("word", atts);
         characters(word.getWord());
         endElement("word");
@@ -830,7 +840,11 @@ public class XMLRenderer extends Abstrac
     @Override
     protected void renderSpace(SpaceArea space) {
         atts.clear();
-        addAttribute("offset", space.getOffset());
+        int offset = space.getBlockProgressionOffset();
+        if ( offset != 0 ) {
+            addAttribute("offset", offset);
+        }
+        maybeAddLevelAttribute(space);
         if (!space.isAdjustable()) {
             addAttribute("adj", "false"); //default is true
         }
@@ -848,7 +862,7 @@ public class XMLRenderer extends Abstrac
         atts.clear();
         addAreaAttributes(ip);
         addTraitAttributes(ip);
-        addAttribute("offset", ip.getOffset());
+        addAttribute("offset", ip.getBlockProgressionOffset());
         startElement("inlineparent", atts);
         super.renderInlineParent(ip);
         endElement("inlineparent");
@@ -862,7 +876,7 @@ public class XMLRenderer extends Abstrac
         atts.clear();
         addAreaAttributes(ibp);
         addTraitAttributes(ibp);
-        addAttribute("offset", ibp.getOffset());
+        addAttribute("offset", ibp.getBlockProgressionOffset());
         startElement("inlineblockparent", atts);
         super.renderInlineBlockParent(ibp);
         endElement("inlineblockparent");
@@ -876,7 +890,7 @@ public class XMLRenderer extends Abstrac
         atts.clear();
         addAreaAttributes(area);
         addTraitAttributes(area);
-        addAttribute("offset", area.getOffset());
+        addAttribute("offset", area.getBlockProgressionOffset());
         addAttribute("ruleStyle", area.getRuleStyleAsString());
         addAttribute("ruleThickness", area.getRuleThickness());
         startElement("leader", atts);
@@ -889,5 +903,19 @@ public class XMLRenderer extends Abstrac
         return XML_MIME_TYPE;
     }
 
-}
+    private void maybeAddLevelAttribute ( Area a ) {
+        int level = a.getBidiLevel();
+        if ( level >= 0 ) {
+            addAttribute ( "level", level );
+        }
+    }
 
+    private void maybeAddPositionAdjustAttribute ( WordArea w ) {
+        int[][] adjustments = w.getGlyphPositionAdjustments();
+        if ( adjustments != null ) {
+            addAttribute ( "position-adjust", XMLUtil.encodePositionAdjustments ( adjustments
) );
+        }
+    }
+
+
+}

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java Sun Feb 26
02:29:01 2012
@@ -159,7 +159,8 @@ public class PDFDocumentGraphics2D exten
         if (fontInfo == null) {
             //Default minimal fonts
             FontInfo fontInfo = new FontInfo();
-            FontSetup.setup(fontInfo);
+            boolean base14Kerning = false;
+            FontSetup.setup(fontInfo, base14Kerning);
             setFontInfo(fontInfo);
         }
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java
Sun Feb 26 02:29:01 2012
@@ -46,9 +46,11 @@ public class PDFDocumentGraphics2DConfig
      * Configures a PDFDocumentGraphics2D instance using an Avalon Configuration object.
      * @param graphics the PDFDocumentGraphics2D instance
      * @param cfg the configuration
+     * @param useComplexScriptFeatures true if complex script features enabled
      * @throws ConfigurationException if an error occurs while configuring the object
      */
-    public void configure(PDFDocumentGraphics2D graphics, Configuration cfg)
+    public void configure(PDFDocumentGraphics2D graphics, Configuration cfg,
+                          boolean useComplexScriptFeatures )
             throws ConfigurationException {
         PDFDocument pdfDoc = graphics.getPDFDocument();
 
@@ -58,7 +60,7 @@ public class PDFDocumentGraphics2DConfig
 
         //Fonts
         try {
-            FontInfo fontInfo = createFontInfo(cfg);
+            FontInfo fontInfo = createFontInfo(cfg, useComplexScriptFeatures);
             graphics.setFontInfo(fontInfo);
         } catch (FOPException e) {
             throw new ConfigurationException("Error while setting up fonts", e);
@@ -68,13 +70,15 @@ public class PDFDocumentGraphics2DConfig
     /**
      * Creates the {@link FontInfo} instance for the given configuration.
      * @param cfg the configuration
+     * @param useComplexScriptFeatures true if complex script features enabled
      * @return the font collection
      * @throws FOPException if an error occurs while setting up the fonts
      */
-    public static FontInfo createFontInfo(Configuration cfg) throws FOPException {
+    public static FontInfo createFontInfo(Configuration cfg, boolean useComplexScriptFeatures)
+        throws FOPException {
         FontInfo fontInfo = new FontInfo();
         final boolean strict = false;
-        FontResolver fontResolver = FontManager.createMinimalFontResolver();
+        FontResolver fontResolver = FontManager.createMinimalFontResolver(useComplexScriptFeatures);
         //TODO The following could be optimized by retaining the FontManager somewhere
         FontManager fontManager = new FontManager();
         if (cfg != null) {
@@ -92,7 +96,8 @@ public class PDFDocumentGraphics2DConfig
                 = new FontInfoConfigurator(cfg, fontManager, fontResolver, listener, strict);
             List/*<EmbedFontInfo>*/ fontInfoList = new java.util.ArrayList/*<EmbedFontInfo>*/();
             fontInfoConfigurator.configure(fontInfoList);
-            fontCollections.add(new CustomFontCollection(fontResolver, fontInfoList));
+            fontCollections.add(new CustomFontCollection(fontResolver, fontInfoList,
+                                fontResolver.isComplexScriptFeaturesEnabled()));
         }
         fontManager.setup(fontInfo,
                 (FontCollection[])fontCollections.toArray(

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java Sun Feb 26 02:29:01
2012
@@ -965,7 +965,8 @@ public class PDFGraphics2D extends Abstr
         preparePainting();
 
         FontInfo specialFontInfo = new FontInfo();
-        FontSetup.setup(specialFontInfo);
+        boolean base14Kerning = false;
+        FontSetup.setup(specialFontInfo, base14Kerning);
 
         PDFResources res = pdfDoc.getFactory().makeResources();
         PDFResourceContext context = new PDFResourceContext(res);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java?rev=1293736&r1=1293735&r2=1293736&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java Sun Feb 26 02:29:01
2012
@@ -126,7 +126,8 @@ public class PDFTranscoder extends Abstr
             if (effCfg != null) {
                 PDFDocumentGraphics2DConfigurator configurator
                         = new PDFDocumentGraphics2DConfigurator();
-                configurator.configure(graphics, effCfg);
+                boolean useComplexScriptFeatures = false; //TODO - FIX ME
+                configurator.configure(graphics, effCfg, useComplexScriptFeatures);
             } else {
                 graphics.setupDefaultFontInfo();
             }



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


Mime
View raw message