bella       01/07/04 23:34:52

  Modified:    sources/org/apache/batik/gvt/text TextHit.java
                        TextLayoutAdapter.java TextPath.java
                        TextSpanLayout.java
  Log:
  small changes and added some javadoc
  
  Revision  Changes    Path
  1.7       +41 -1     xml-batik/sources/org/apache/batik/gvt/text/TextHit.java
  
  Index: TextHit.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/text/TextHit.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TextHit.java      2001/06/12 23:49:49     1.6
  +++ TextHit.java      2001/07/05 06:34:51     1.7
  @@ -17,7 +17,7 @@
    * @see org.apache.batik.gvt.text.TextSpanLayout.
    *
    * @author <a href="[EMAIL PROTECTED]>Bill Haneman</a>
  - * @version $Id: TextHit.java,v 1.6 2001/06/12 23:49:49 bella Exp $
  + * @version $Id: TextHit.java,v 1.7 2001/07/05 06:34:51 bella Exp $
    */
   public class TextHit {
   
  @@ -26,31 +26,71 @@
       private TextNode textNode;
       private FontRenderContext frc;
   
  +    /**
  +     * Constructs a TextHit with the specified values.
  +     *
  +     * @param charIndex The index of the character that has been hit. In the
  +     * case of bidirectional text this will be the logical character index not
  +     * the visual index. The index is relative to whole text within the selected
  +     * TextNode.
  +     * @param leadingEdge Indicates which side of the character has been hit.
  +     */
       public TextHit(int charIndex, boolean leadingEdge) {
           this.charIndex = charIndex;
           this.leadingEdge = leadingEdge;
       }
   
  +    /**
  +     * Returns the index of the character that has been hit.
  +     *
  +     * @return The character index.
  +     */
       public int getCharIndex() {
           return charIndex;
       }
   
  +    /**
  +     * Returns whether on not the character has been hit on its leading edge.
  +     *
  +     * @return Whether on not the character has been hit on its leading edge.
  +     */
       public boolean isLeadingEdge() {
           return leadingEdge;
       }
   
  +    /**
  +     * Sets the TextNode that is associated with this hit.
  +     *
  +     * @param textNode The textNode that has been hit.
  +     */
       public void setTextNode(TextNode textNode) {
           this.textNode = textNode;
       }
   
  +
  +    /**
  +     * Sets the font render context at the time of the hit.
  +     *
  +     * @param frc The current font render context.
  +     */
       public void setFontRenderContext(FontRenderContext frc) {
           this.frc = frc;
       }
   
  +    /**
  +     * Returns the text node associated with this text hit.
  +     *
  +     * @return The text node that has been hit.
  +     */
       public TextNode getTextNode() {
           return textNode;
       }
   
  +    /**
  +     * Returns the font render context at the time of the text hit.
  +     *
  +     * @return The font render context.
  +     */
       public FontRenderContext getFontRenderContext() {
           return frc;
       }
  
  
  
  1.8       +3 -19     
xml-batik/sources/org/apache/batik/gvt/text/TextLayoutAdapter.java
  
  Index: TextLayoutAdapter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/gvt/text/TextLayoutAdapter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TextLayoutAdapter.java    2001/06/12 23:49:49     1.7
  +++ TextLayoutAdapter.java    2001/07/05 06:34:51     1.8
  @@ -34,7 +34,7 @@
    * @see org.apache.batik.gvt.TextPainter.
    *
    * @author <a href="[EMAIL PROTECTED]>Bill Haneman</a>
  - * @version $Id: TextLayoutAdapter.java,v 1.7 2001/06/12 23:49:49 bella Exp $
  + * @version $Id: TextLayoutAdapter.java,v 1.8 2001/07/05 06:34:51 bella Exp $
    */
   public class TextLayoutAdapter implements TextSpanLayout {
   
  @@ -56,17 +56,6 @@
        * @param g2d the Graphics2D to use
        */
       public void draw(Graphics2D g2d, GraphicsNodeRenderContext ctx) {
  -   /*     AffineTransform t;
  -        if (transform != null) {
  -            t = g2d.getTransform();
  -            g2d.transform(transform);
  -            layout.draw(g2d, 0f, 0f);
  -            g2d.setTransform(t);
  -        } else {
  -            layout.draw(g2d, 0f, 0f);
  -        }
  -
  -     */
   
           Shape outline = getOutline();
   
  @@ -87,9 +76,6 @@
               g2d.setPaint(paint);
               g2d.draw(outline);
           }
  -
  -
  -
       }
   
       /**
  @@ -182,7 +168,7 @@
        * @return The index of the matching glyph in this layout's glyph vector,
        *         or -1 if a matching glyph could not be found.
        */
  -    private int getGlyphIndex(int charIndex) {
  +    public int getGlyphIndex(int charIndex) {
           int currentChar = aci.getBeginIndex();
           int numGlyphs = getGlyphCount();
           for (int i = 0; i < numGlyphs; i++) {
  @@ -204,12 +190,10 @@
        *
        * @param beginCharIndex the index of the first char in the contiguous 
selection.
        * @param endCharIndex the index of the last char in the contiguous selection.
  -     * @param selectionLeftToRight Indicates the selection direction.
        * @return The highlight shape or null if the spacified char range does not
        * overlap with the chars in this layout.
        */
  -    public Shape getHighlightShape(int beginCharIndex, int endCharIndex,
  -                                   boolean selectionLeftToRight) {
  +    public Shape getHighlightShape(int beginCharIndex, int endCharIndex) {
           return transform.createTransformedShape(
               
layout.getLogicalHighlightShape(Math.max(0,getGlyphIndex(beginCharIndex)),
                   Math.max(getGlyphCount()-1, getGlyphIndex(endCharIndex))));
  
  
  
  1.3       +12 -3     xml-batik/sources/org/apache/batik/gvt/text/TextPath.java
  
  Index: TextPath.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/text/TextPath.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TextPath.java     2001/05/14 16:47:18     1.2
  +++ TextPath.java     2001/07/05 06:34:51     1.3
  @@ -16,13 +16,18 @@
    * A text path describes a path along which some text will be rendered.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Bella Robinson</a>
  - * @version $Id: TextPath.java,v 1.2 2001/05/14 16:47:18 tkormann Exp $
  + * @version $Id: TextPath.java,v 1.3 2001/07/05 06:34:51 bella Exp $
    */
   public class TextPath {
   
       private PathLength pathLength;
       private float startOffset;
   
  +    /**
  +     * Constructs a TextPath based on the specified path.
  +     *
  +     * @param path The general path along which text is to be laid.
  +     */
       public TextPath(GeneralPath path) {
           pathLength = new PathLength(path);
           startOffset = 0;
  @@ -39,6 +44,8 @@
   
       /**
        * Returns the start offset of this text path.
  +     *
  +     * @return The start offset of this text path.
        */
       public float getStartOffset() {
           return startOffset;
  @@ -46,13 +53,15 @@
   
       /**
        * Returns the total length of the path.
  +     *
  +     * @return The lenght of the path.
        */
       public float lengthOfPath() {
           return pathLength.lengthOfPath();
       }
   
       /**
  -     * Return the angle at the specified length
  +     * Returns the angle at the specified length
        * along the path.
        *
        * @param length The length along the path.
  @@ -63,7 +72,7 @@
       }
   
       /**
  -     * Return the point that is at the specified length
  +     * Returns the point that is at the specified length
        * along the path.
        *
        * @param length The length along the path.
  
  
  
  1.9       +11 -2     xml-batik/sources/org/apache/batik/gvt/text/TextSpanLayout.java
  
  Index: TextSpanLayout.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/text/TextSpanLayout.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TextSpanLayout.java       2001/06/12 23:49:49     1.8
  +++ TextSpanLayout.java       2001/07/05 06:34:51     1.9
  @@ -26,7 +26,7 @@
    * @see org.apache.batik.gvt.TextPainter.
    *
    * @author <a href="[EMAIL PROTECTED]>Bill Haneman</a>
  - * @version $Id: TextSpanLayout.java,v 1.8 2001/06/12 23:49:49 bella Exp $
  + * @version $Id: TextSpanLayout.java,v 1.9 2001/07/05 06:34:51 bella Exp $
    */
   public interface TextSpanLayout {
   
  @@ -102,7 +102,7 @@
        * @param begin the index of the first glyph in the contiguous selection.
        * @param end the index of the last glyph in the contiguous selection.
        */
  -     public Shape getHighlightShape(int beginCharIndex, int endCharIndex, boolean 
selectionLeftToRight);
  +     public Shape getHighlightShape(int beginCharIndex, int endCharIndex);
   
       /**
        * Perform hit testing for coordinate at x, y.
  @@ -138,6 +138,15 @@
        */
       public int getCharacterCount(int startGlyphIndex, int endGlyphIndex);
   
  +    /**
  +     * Returns the glyph index of the glyph that has the specified char index.
  +     *
  +     * @param charIndex The original index of the character in the text node's
  +     * text string.
  +     * @return The index of the matching glyph in this layout's glyph vector,
  +     *         or -1 if a matching glyph could not be found.
  +     */
  +    public int getGlyphIndex(int charIndex);
   
       /**
        * Returns true if the text direction in this layout is from left to right.
  
  
  

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

Reply via email to