xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Helder Magalhães" <helder.magalh...@gmail.com>
Subject Re: Text entry field?
Date Tue, 21 Oct 2008 14:31:29 GMT
> I'd be happy to contribute such a change if I can get it to work.

Great! :-)

>   What I
> have in mind though may not be what you are thinking of.  I am thinking that
> the text field would still display the text as it does now but when the user
> clicks on it a JTextField is created on the fly in the same position and is
> used for the editing.

Yes, the post I referred to did point somehow in that direction also.
;-) Of course WYSIWYG text input would be great to have, but a text
field is more than sufficient for a start and, also, it will help
creating demand for a more powerful implementation. :-) SVG Mobile 1.2
[1] also states that a modal dialog or similar will be acceptable, so
this simple approach will be, at least, future-proof. ;-)

>  For this to work I would need to be able to query the
> canvas to determine the position of the field in screen coordinates and also
> the size and properties of the scaled font and then use this information to
> create the JTextField with the same properties.
> Is all that information acquirable from querying the canvas?

I'm sure the canvas contains enough information. Nevertheless, it
would be great if more experienced Batik developers (Cameroon?
Thomas?) could give a hand here. The only limitation I can see about
this is when the canvas and/or the text itself are rotated which may
cause a more incoherent effect. I'd suggest a modal dialog (prompt
dialog) for a start, and deal with few things later:
 * Text editing shouldn't interfere with text selection (click+drag
events and other);
 * The ideal approach would be directly manipulating the DOM such as
the script examples pointed out by Andreas
   * Placing a caret (this solely may not be trivial as, for example,
text can be placed over a path [2]);
   * Listening to key events;
   * Consider text selection (though mouse or key events such as Shift
or Ctrl + arrow keys - probably more).

> Agreed, and Batik should implement it to.  I want Batik to be like a
> "reference implementation" of SVG.

Yeah, Batik surely has the potential. ;-)

> Cheers,
> -JCT

Hope this helps,

  Helder Magalhães

[1] http://www.w3.org/TR/SVGMobile12/text.html#text-edit
[2] http://www.w3.org/TR/SVG/text.html#TextPathElement

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

View raw message