tkormann    01/10/19 00:44:08

  Modified:    sources/org/apache/batik/bridge UnitProcessor.java
  Log:
  bug fix: coordinates in 'em' and font-size in 'em' not works. (go up to the
  parent element to get its font-size).
  
  Revision  Changes    Path
  1.5       +24 -9     xml-batik/sources/org/apache/batik/bridge/UnitProcessor.java
  
  Index: UnitProcessor.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/UnitProcessor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UnitProcessor.java        2001/10/18 06:28:46     1.4
  +++ UnitProcessor.java        2001/10/19 07:44:08     1.5
  @@ -15,6 +15,8 @@
   import org.apache.batik.parser.ParseException;
   import org.apache.batik.util.CSSConstants;
   
  +import org.apache.batik.css.HiddenChildElementSupport;
  +
   import org.w3c.dom.Element;
   import org.w3c.dom.css.CSSPrimitiveValue;
   import org.w3c.dom.css.CSSValue;
  @@ -26,7 +28,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Thierry Kormann</a>
  - * @version $Id: UnitProcessor.java,v 1.4 2001/10/18 06:28:46 tkormann Exp $
  + * @version $Id: UnitProcessor.java,v 1.5 2001/10/19 07:44:08 tkormann Exp $
    */
   public abstract class UnitProcessor {
   
  @@ -709,9 +711,9 @@
                                             ctx);
               default:
                   return v / cssToUserSpace(fontSize.getFloatValue(type),
  -                                          CSSPrimitiveValue.CSS_NUMBER,
  +                                          type,
                                             d,
  -                                          ctx);
  +                                          ctx.getParentElementContext());
           }
       }
   
  @@ -735,9 +737,9 @@
                                             ctx);
               default:
                   return v * cssToUserSpace(fontSize.getFloatValue(type),
  -                                          CSSPrimitiveValue.CSS_NUMBER,
  +                                          type,
                                             d,
  -                                          ctx);
  +                                          ctx.getParentElementContext());
           }
       }
   
  @@ -763,9 +765,9 @@
                   break;
               default:
                   fontSizeVal = cssToUserSpace(fontSize.getFloatValue(type),
  -                                          CSSPrimitiveValue.CSS_NUMBER,
  +                                          type,
                                                d,
  -                                             ctx);
  +                                             ctx.getParentElementContext());
           }
           float xh = ctx.getXHeight();
           return v / xh / fontSizeVal;
  @@ -793,9 +795,9 @@
                   break;
               default:
                   fontSizeVal = cssToUserSpace(fontSize.getFloatValue(type),
  -                                          CSSPrimitiveValue.CSS_NUMBER,
  +                                          type,
                                                d,
  -                                             ctx);
  +                                             ctx.getParentElementContext());
           }
           float xh = ctx.getXHeight();
           return v * xh * fontSizeVal;
  @@ -934,6 +936,11 @@
            * Returns the viewport height used to compute units.
            */
           float getViewportHeight();
  +
  +     /**
  +      * Returns the context of the parent element of this context.
  +      */
  +     Context getParentElementContext();
       }
   
       /**
  @@ -960,6 +967,14 @@
               return e;
           }
   
  +     /**
  +      * Returns the context of the parent element of this context.
  +      */
  +     public Context getParentElementContext() {
  +         return new DefaultContext
  +             (ctx, HiddenChildElementSupport.getParentElement(e));
  +     }
  +     
           /**
            * Returns the pixel to mm factor.
            */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to