You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2010/01/01 14:57:11 UTC

svn commit: r895012 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java

Author: jeremias
Date: Fri Jan  1 13:57:10 2010
New Revision: 895012

URL: http://svn.apache.org/viewvc?rev=895012&view=rev
Log:
Fixed a multi-threading bugfix, visible for example when opening examples/fo/basic/readme.fo with the AWT Preview. Words could be jumbled and the wrong fonts were sometimes used.

The class still has a performance problem concerning the use of the TextLayout class for determining some font metrics otherwise not available from the Java2D/AWT subsystem.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java?rev=895012&r1=895011&r2=895012&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java Fri Jan  1 13:57:10 2010
@@ -142,7 +142,7 @@
      * @param size font size
      * @return ascent in milliponts
      */
-    public int getMaxAscent(String family, int style, int size) {
+    public synchronized int getMaxAscent(String family, int style, int size) {
         setFont(family, style, size);
         return Math.round(lineMetrics.getAscent() * FONT_FACTOR);
     }
@@ -155,7 +155,7 @@
      * @param size font size
      * @return ascent in milliponts
      */
-    public int getAscender(String family, int style, int size) {
+    public synchronized int getAscender(String family, int style, int size) {
         setFont(family, style, size);
         return ascender * 1000;
 
@@ -193,7 +193,7 @@
      * @param size font size
      * @return capital height in millipoints
      */
-    public int getCapHeight(String family, int style, int size) {
+    public synchronized int getCapHeight(String family, int style, int size) {
         // currently just gets Ascent value but maybe should use
         // getMaxAcent() at some stage
         return getAscender(family, style, size);
@@ -207,7 +207,7 @@
      * @param size font size
      * @return descent in milliponts
      */
-    public int getDescender(String family, int style, int size) {
+    public synchronized int getDescender(String family, int style, int size) {
         setFont(family, style, size);
         return descender * 1000;
     }
@@ -220,7 +220,7 @@
      * @param size font size
      * @return font height in milliponts
      */
-    public int getXHeight(String family, int style, int size) {
+    public synchronized int getXHeight(String family, int style, int size) {
         setFont(family, style, size);
         return xHeight * 1000;
     }
@@ -234,7 +234,7 @@
      * @param size font size
      * @return character width in millipoints
      */
-    public int width(int i, String family, int style, int size) {
+    public synchronized int width(int i, String family, int style, int size) {
         int w;
         setFont(family, style, size);
         w = internalCharWidth(i) * 1000;
@@ -256,7 +256,7 @@
      * @param size font size
      * @return array of character widths in millipoints
      */
-    public int[] getWidths(String family, int style, int size) {
+    public synchronized int[] getWidths(String family, int style, int size) {
         int i;
 
         if (width == null) {
@@ -351,7 +351,7 @@
      * @param size font size
      * @return font with the desired characeristics.
      */
-    public java.awt.Font getFont(String family, int style, int size) {
+    public synchronized java.awt.Font getFont(String family, int style, int size) {
         setFont(family, style, size);
         return f1;
         /*
@@ -372,7 +372,7 @@
      * @param c the glyph to check
      * @return true if the character is supported
      */
-    public boolean hasChar(String family, int style, int size, char c) {
+    public synchronized boolean hasChar(String family, int style, int size, char c) {
         setFont(family, style, size);
         return f1.canDisplay(c);
     }



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