You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by vh...@apache.org on 2002/08/28 10:06:48 UTC

cvs commit: xml-batik/test-references/samples/tests/spec/fonts fontAltGlyph2.png

vhardy      2002/08/28 01:06:48

  Modified:    sources/org/apache/batik/bridge
                        SVGAltGlyphElementBridge.java
               sources/org/apache/batik/gvt/renderer
                        StrokingTextPainter.java
               test-resources/org/apache/batik/test samplesRendering.xml
  Added:       test-references/samples/tests/spec/fonts fontAltGlyph2.png
  Log:
  Implemented RFE #4834 (making last visited files persistent.
  
  The most recent visited files are now persistent and kept in the preferences.xml
  file. There are two entries:
  
  - preference.key.visited.uri.list.length which defines the maximum number of uris which
    will be stored in the preference file.
  
  - preference.key.visited.uri.list which is the list of uris, separated by spaces
    after encoding with URLEncoder (note that the methods used are deprecated in 1.4,
    but their replacement is not available in 1.3).
  
  The history in each of the viewer frame ('Go' menu) is initialized with the current 
  list of last visited uris which is kept current (i.e., it is updated each time a
  new uri is visited) throughout the life of the Squiggle browser. Then new URIs
  are appended as before in the local history.
  
  
  Revision  Changes    Path
  1.10      +34 -11    xml-batik/sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
  
  Index: SVGAltGlyphElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SVGAltGlyphElementBridge.java	13 Jun 2002 11:19:37 -0000	1.9
  +++ SVGAltGlyphElementBridge.java	28 Aug 2002 08:06:47 -0000	1.10
  @@ -165,15 +165,27 @@
   		    (SVG_NAMESPACE_URI, SVG_ALT_GLYPH_ITEM_TAG);
                   int numAltGlyphItemNodes = altGlyphItemNodes.getLength();
                   if (numAltGlyphItemNodes > 0) {
  -                    Glyph[] glyphArray = new Glyph[numAltGlyphItemNodes];
  -                    for (int i = 0; i < numAltGlyphItemNodes; i++) {
  +                    boolean foundMatchingGlyph = false;
  +                    Glyph[] glyphArray = null;
  +
  +                    //look through all altGlyphItem to find the one
  +                    //that have all its glyphs available
  +
  +                    for (int i = 0; i < numAltGlyphItemNodes && !foundMatchingGlyph ; i++) {
  +
                           // try to find a resolvable glyphRef
                           Element altGlyphItemElement = (Element)altGlyphItemNodes.item(i);
                           NodeList altGlyphRefNodes
                               = altGlyphItemElement.getElementsByTagNameNS
   			    (SVG_NAMESPACE_URI, SVG_GLYPH_REF_TAG);
                           int numAltGlyphRefNodes = altGlyphRefNodes.getLength();
  -                        boolean foundMatchingGlyph = false;
  +
  +                        glyphArray = new Glyph[numAltGlyphRefNodes];
  +
  +                        // consider that all glyphs are available
  +                        // and check if they can be found
  +                        foundMatchingGlyph = true;
  +
                           for (int j = 0; j < numAltGlyphRefNodes; j++) {
                               // get the referenced glyph element
                               Element glyphRefElement = (Element)altGlyphRefNodes.item(j);
  @@ -182,25 +194,36 @@
                               Glyph glyph = getGlyph(ctx, glyphUri, glyphRefElement, fontSize, aci);
                               if (glyph != null) {
                                   // found a matching glyph for this altGlyphItem
  -                                glyphArray[i] = glyph;
  -                                foundMatchingGlyph = true;
  +                                glyphArray[j] = glyph;
  +                            }
  +                            else{
  +                                //this altGlyphItem is not good
  +                                //seek for the next one
  +                                foundMatchingGlyph = false;
                                   break;
                               }
                           }
  -                        if (!foundMatchingGlyph) {
  -                            // couldn't find a matching glyph for this alGlyphItem
  -                            // so stop and return null
  -                            return null;
  -                        }
                       }
  +                    if (!foundMatchingGlyph) {
  +                        // couldn't find a  alGlyphItem
  +                        // with all its glyphs available
  +                        // so stop and return null
  +                        return null;
  +                    }
  +                    
                       return glyphArray;
                   }
               }
           }
   
  +
  +        /*
           // reference is not to a valid element type, throw an exception
           throw new BridgeException(altGlyphElement, ERR_URI_BAD_TARGET,
                                     new Object[] {uri});
  +        */
  +        //reference not valid, no altGlyph created
  +        return null;
       }
   
   
  
  
  
  1.39      +12 -2     xml-batik/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
  
  Index: StrokingTextPainter.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- StrokingTextPainter.java	13 Aug 2002 21:33:16 -0000	1.38
  +++ StrokingTextPainter.java	28 Aug 2002 08:06:47 -0000	1.39
  @@ -119,6 +119,8 @@
           GVTAttributedCharacterIterator.TextAttribute.ADJUST_SPACING;
       public static final Integer ADJUST_ALL =
           GVTAttributedCharacterIterator.TextAttribute.ADJUST_ALL;
  +    public static final GVTAttributedCharacterIterator.TextAttribute ALT_GLYPH_HANDLER =
  +        GVTAttributedCharacterIterator.TextAttribute.ALT_GLYPH_HANDLER;
   
       static Set extendedAtts = new HashSet();
   
  @@ -418,7 +420,8 @@
   
               Vector fontFamilies;
               fontFamilies = (Vector)aci.getAttributes().get(GVT_FONT_FAMILIES);
  -            if (fontFamilies == null) {
  +
  +            if (fontFamilies == null ) {
                   // no font families set this chunk so just increment...
                   asOff += aciLength;
                   moreChunks = (aci.setIndex(end) != aci.DONE);
  @@ -477,6 +480,13 @@
                   while (currentIndex < end) {
                       int displayUpToIndex = font.canDisplayUpTo
                           (aci, currentIndex, end);
  +
  +                    Object altGlyphElement = aci.getAttributes().get(ALT_GLYPH_HANDLER);
  +                    if ( altGlyphElement != null ){
  +                        //found all the glyph to be displayed
  +                        //consider the font matching done
  +                        displayUpToIndex = -1;
  +                    }
   
                       if (displayUpToIndex == -1) {
                           // Can handle the whole thing...
  
  
  
  1.82      +2 -1      xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml
  
  Index: samplesRendering.xml
  ===================================================================
  RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- samplesRendering.xml	14 Aug 2002 12:59:47 -0000	1.81
  +++ samplesRendering.xml	28 Aug 2002 08:06:47 -0000	1.82
  @@ -112,6 +112,7 @@
       <testGroup id="tests.spec.fonts">    
           <test id="samples/tests/spec/fonts/batikFont.svg" />
           <test id="samples/tests/spec/fonts/fontAltGlyph.svg" />
  +        <test id="samples/tests/spec/fonts/fontAltGlyph2.svg" />
           <test id="samples/tests/spec/fonts/fontArabic.svg" />
           <test id="samples/tests/spec/fonts/fontBounds.svg" />
           <test id="samples/tests/spec/fonts/fontChoice.svg" />
  
  
  
  1.1                  xml-batik/test-references/samples/tests/spec/fonts/fontAltGlyph2.png
  
  	<<Binary file>>
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Re: cvs commit: xml-batik/test-references/samples/tests/spec/fonts fontAltGlyph2.png

Posted by Vincent Hardy <vi...@sun.com>.
There was an error in the commit message that came out with this commit.
It should have been:

Commit of Nicolas' patch (nicolas.socheleau@bitflash.com):

Fixed bug in the altGlyphItem handling.

When the altGlyphItem were traversed, the first valid glyph of the item 
was pick, and an array of glyph, one from each item was return to build 
up the GlyphVector.
The specifications say to return all the glyphs coming from the first
altGlyphItem were all glyphs are defined and available.

The second issue was the font matching done by the StrokingTextPainter 
which results in displaying more glyphs than necessary. If a altGlyph is 
found, it will be become valid if the glyphs it represents are 
available. Then, no font matching is necessary since the altGlyph 
already has all the glyphs it needs.

New test: samples/tests/spec/fonts/fontAltGlyph2.svg



vhardy@apache.org wrote:
> vhardy      2002/08/28 01:06:48
> 
>   Modified:    sources/org/apache/batik/bridge
>                         SVGAltGlyphElementBridge.java
>                sources/org/apache/batik/gvt/renderer
>                         StrokingTextPainter.java
>                test-resources/org/apache/batik/test samplesRendering.xml
>   Added:       test-references/samples/tests/spec/fonts fontAltGlyph2.png
>   Log:
>   Implemented RFE #4834 (making last visited files persistent.
>   
>  [...]


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org