jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McGrady <mich...@michaelmcgrady.com>
Subject Re: [Image] New Button Tag and Text Tag with HTML rendering capability
Date Sat, 19 Jun 2004 01:46:08 GMT
Hi, Abey,

I have been under the gun here and will get back to you on this.  For the 
moment, I thought it might be helpful to send along this code that I use to 
put i18n text into buttons.

package com.crackwillow.resource.image.button;

import java.io.*;
import java.util.*;

import com.crackwillow.log.StdOut;

public class UnicodeConverter {
   public static String convert(String unicode) {
                 try {
                         byte [] utf8Bytes = unicode.getBytes("UTF8");
                         unicode = new String(utf8Bytes,"UTF8");
                 } catch (UnsupportedEncodingException uee) {
                         log("log.error",uee.getMessage());
                 }
                 return unicode;
         }

         public static void log(String logFileName,String message) {
                 StdOut.log(logFileName,message);
         }
} ///;-) Michael McGrady

Later,

Michael

At 09:07 PM 6/17/2004, Abey Mullassery wrote:

>"HTML rendering capability" means that the Text tag can be supplied with 
>HTML text/ source and the tag renders it (somewhat like a browser). This 
>allows one to add a lot of formatting to the text input.
>
>For example the tag for the image
>(http://www.mullassery.com/downloads/images/woods-poem.jpg)
>can be similar to..
>
><img:image src="/images/woods.jpg"
>         name="woods-poem.jpg">
>     <img:text   font="Arial"
>                 bold="true"
>                 size="14"
>                 color="0x0000ff"
>         >
>
>         <h3><font color="#8a4f60">Stopping By Woods On A Snowy 
> Evening</font></h3>
>         <font color="#8a4f60">
>                 Whose woods these are I think I know.<br>
>                 His house is in the village though;<br>
>                 He will not see me stopping here<br>
>                 To watch his woods fill up with snow.<br>
>                 <br>
>                 ....
>                 <br>
>                 The woods are lovely, dark and deep.<br>
>                 But I have promises to keep,<br>
>                 And miles to go before I sleep,<br>
>                 And miles to go before I sleep.<br>
>         </font>
>
>      </img:text>
></img:image>
>
>
>Regards,
>
>
>Abey Mullassery
>http://www.mullassery.com
>
>
>Michael McGrady wrote:
>>At 12:12 PM 6/17/2004, Abey Mullassery wrote:
>>
>>>You cannot "steal" open source code. It is for everybody to "take", 
>>>modify and use as they like it. Thats the beauty of it :-)
>>>
>>>You can just subclass Button Tag from Text tag and add a crop based on 
>>>the bounds calculations. I will check in the code in a couple of days.. 
>>>hope to get some opinions/feedback by then.
>>>The combination of the basic tags will not get you well "cropped" button 
>>>unless you do your text bounds calculation separately, which is 
>>>difficult (you need the graphics object to get the correct 
>>>fontRenderContext) and should be inside the tag. That is why I am 
>>>planning to add the Button tag to the lib.
>>>The good thing about HTML rendered Text Tag is that it supports 
>>>multiline and much better formatting.
>>>
>>>Your did not mention your views on my questions!
>>>1. Your opinion about the HTML enabled Text tag feature and the best 
>>>HTML rendering package to use for it.
>>>2. Is the Button tag required in the taglib?
>>>
>>>Thanks,
>>>
>>>Abey Mullassery
>>>http://www.mullassery.com
>>
>>Hi, Abey,
>>I am thinking about your questions.  I have some thoughts at the present 
>>which will be incomplete, depending upon what you have to say.  I am not 
>>sure what you mean by "HTML enabled Text tag feature".  I have some 
>>general thoughts about the image taglib, which I will share below in some 
>>limited detail.
>>I have included the text bounds calculations in my button making code.
>>Since my last email, I have added borders on copies of the buttons so you 
>>can see how this worked out at http://131.191.40.91:14567/testText.jsp.
>>ON YOUR QUESTIONS
>>First "Issue": Administrative HTML
>>I like having both an administrative HTML to make buttons and a 
>>presentation HTML to do buttons on the page with caching.  I think that 
>>making an administrative HTML with an xml or properties login is 
>>definitely something that the image taglib needs.  The interface should 
>>be such that it could be easily moved to MySQL, Oracle, HSQLDB, etc., and 
>>we might even provide alternative uses ot the interfaces for those 
>>options.  The administrative HTML would or could do extra things, which I 
>>would build for myself if it did not have them, such as provide the user 
>>with a list of the fonts on the local machine, a color chart to choose 
>>colors from, etc.  The administrative HTML would help the page designer 
>>choose the colors.
>>Second "Issue": Presentation HTML
>>I am still not well enough acquainted with the tag itself to be of real 
>>help here.  My main concern would be with quality and efficient cache 
>>control.  I will await your note about what HTML redendered means in this 
>>context before adding more thoughts on this.
>>Michael
>>
>>
>>
>>
>>
>>
>>>mike wrote:
>>>
>>>>Hello, Abey,
>>>>
>>>>I was getting a page not available error, but have now seen your work. 
>>>>Very nice.  I think there is too much antialiazing, however.  I have 
>>>>experimented with trying to get a better "look" to the printing, and 
>>>>think I have succeeded.  Assuming my laptop is running, the URL 
>>>>http://131.191.40.91:14567/testText.jsp has a demonstration.  The 
>>>>images named "mable", "submit" and "yahoo" are made with the code 
>>>>changes, and the "myButton2", "myButton3", "myButton4" and "myButton5" 
>>>>are from your classes.  I stole most of the code and am still "fitzing" 
>>>>about with it.  I first read/load any GIF and resize it to the text I 
>>>>am going to use (ButtonFactory.resize()) and make it transparent, 
>>>>writing it with whatever name I want.  Then, I read the new GIF and add 
>>>>the new text.  I think some of the (int) casts may be affecting the 
>>>>quality of the letters in your code.  I admit, however, that my 
>>>>knowledge is really, really, scanty and I may be full of blarney on everything.
>>>>
>>>>If you would like to see the code, how do I get it to the people on the 
>>>>list?
>>>>
>>>>Michael
>>>>
>>>>At 10:50 AM 6/17/2004, Abey Mullassery wrote:
>>>>
>>>>>I thought of writing a tag to create Buttons because a lot of people 
>>>>>require this functionality (to create text buttons in different 
>>>>>languages) and I keep on explaining how to do it with a combination of

>>>>>the basic image tags. I did not add this tag to the Image Taglib 
>>>>>because I thought it was best if the lib just had a set of basic 
>>>>>operations leaving the more complex transformations that are just a 
>>>>>combination of these basic ones to the user (or maybe maintain it 
>>>>>outside separately for those who need it). However since a lot of 
>>>>>people had been asking for it, I am thinking of adding a button tag 
>>>>>too. Later we could remove it if we feel that it does not belong here.
>>>>>
>>>>>The button tag is basically the "text" (text overlay) tag and the crop

>>>>>tag combined. But the boundaries may have to be calculated based on 
>>>>>the width of the text printed. I also thought that it was time to 
>>>>>upgrade the Text tag to support multilined text. The text overlay is 
>>>>>the first operation for the button tag. Ideally it required some more

>>>>>formatting options than just specifying a font and color. Thats why I

>>>>>thought it was best to add HTML rendering capability to the Text and 
>>>>>Button Tags.
>>>>>
>>>>>See an example here 
>>>>>(http://www.mullassery.com/downloads/images/woods-poem.jpg)
>>>>>The HTML (poem) is overlaid on the image. This was rendered on the 
>>>>>image using the classes in the JDK.
>>>>>
>>>>>The text tag with HTML rendering capability can also take a URL and 
>>>>>render a "screenshot" of the page as an image.
>>>>>
>>>>>I wanted to know your opinion about this feature and the best HTML 
>>>>>rendering package to use for it. Also is the button tag required in the
taglib?
>>>>>
>>>>>Thanks.
>>>>>
>>>>>Abey Mullassery
>>>>>http://www.mullassery.com
>>>>>
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
>>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
>
>



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


Mime
View raw message