Re: [Indic-computing-users] Re: Indic-computing-users digest
Status: Alpha
Brought to you by:
jkoshy
From: Tapan P. <ta...@ya...> - 2004-09-21 20:12:29
|
Does anyone know the current level of Indic support in most Java MIDP 2.0 implementations (input methods, rendering)? I know Symbian versions 6.1 and 7.0 dont support indic languages, but I think with v. 8.0 Hindi support is added. On Sep 17, 2004, at 5:17 AM, Amit Murthy wrote: > Hi Krishnamurthy, > > For what its worth, > > I got this code from a Sun community website > (http://today.java.net/pub/a/today/2004/04/22/images.html) > that allows one to generate images from unicode text. > > I have modified it to generate wbmp images using the Sampige font. > > Please note that for wbmp output, you will need the JAI Image I/O API > from > here - http://java.sun.com/products/java-media/jai/ > > For png and jpeg output you do not need the above package, just JDK > 1.4 will do. > > *********************************************************************** > ************************* > > import java.awt.image.BufferedImage; > import java.awt.font.*; > import java.awt.geom.*; > import java.awt.*; > import java.io.*; > import javax.imageio.*; > import java.util.Arrays; > import java.util.*; > import javax.imageio.stream.*; > > > public class text2img { > public static void main(String [] args) { > try { > System.out.println("Starting..."); > > String text = "\u0c85\u0c86"; > > String font_file = > "/usr/java/j2sdk1.4.2_02/jre/lib/fonts/Sampige.ttf"; > > float size = 20.0f; > > // configure all of the parameters > Color background = Color.white; > Color color = Color.black; > > Font font = Font.createFont(Font.TRUETYPE_FONT, > new FileInputStream(font_file)); > font = font.deriveFont(size); > > BufferedImage buffer = > new BufferedImage(1,1,BufferedImage.TYPE_BYTE_BINARY); > Graphics2D g2 = buffer.createGraphics(); > g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, > RenderingHints.VALUE_ANTIALIAS_ON); > FontRenderContext fc = g2.getFontRenderContext(); > Rectangle2D bounds = font.getStringBounds(text,fc); > > // calculate the size of the text > int width = (int) bounds.getWidth(); > int height = (int) bounds.getHeight() * 2; > > // prepare some output > buffer = new BufferedImage(width, height, > BufferedImage.TYPE_BYTE_BINARY ); > g2 = buffer.createGraphics(); > g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, > RenderingHints.VALUE_ANTIALIAS_ON); > g2.setFont(font); > > // actually do the drawing > g2.setColor(background); > g2.fillRect(0,0,width,height); > g2.setColor(color); > g2.drawString(text,0,(int)-bounds.getY()); > > System.out.println("Image writer understands..." + > Arrays.asList(ImageIO.getWriterFormatNames())); > > // getting an wbmp image writer > Iterator iter = ImageIO.getImageWritersByFormatName > ("wbmp"); > > ImageWriter wbmpwriter = (ImageWriter) iter.next(); > File fp = new File("b20.wbmp"); > FileImageOutputStream fios = new FileImageOutputStream > (fp); > > wbmpwriter.setOutput(fios); > wbmpwriter.write(buffer); > > fios.close(); > > > /*/ output the image as png > File fp = new File("a.png"); > if (!ImageIO.write(buffer, "png", fp)) { > System.out.println("Format not supported..."); > } > /*/ > > System.out.println("Ending..."); > } > catch (Exception e) > { > System.out.println(e); > } > } > } > > *********************************************************************** > ********************** > > Amit > > > On Friday 17 Sep 2004 4:09 pm, Krishnamurthy Nagarajan wrote: >> Hi Amit, >> >> Your suggestion of having a library to convert >> transliterated text to Indian language char image, as >> an interim solution, is very valid. >> >> In fact, my generic transliteration rule framework >> for Indian languages and the library that implements >> it (translib) does that along with a simple rendering >> tool like gozer (which uses imlib) on Linux/freeBSD. >> This is available on indic-computing project as a >> subproject named 'translib'. >> >> I used some of CDAC fonts as sample fonts but they are >> not GPL'd fonts. We can use some GPL'd fonts for that >> purpose. One would need to write up the letterfontmap >> file and may be touch up the rules a bit (using my >> files as reference). >> >> About govt bodies - CDAC, TDIL etc are supposed to be >> doing this standardization, but.... >> >> cheers, >> Nagarajan >> >> --- Amit Murthy <am...@on...> wrote: >>> Dear Pavanaja, >>> >>> >>> >>> Is there any government body we can write to in this >>> regard? >>> >>> Do you see value in developing a library that would >>> convert transliterated >>> text into Indian language character images? This >>> could be a short term >>> measure till proper Unicode and font support becomes >>> available on handsets..... >>> >>> Amit >> >> __________________________________________________ >> Do You Yahoo!? >> Tired of spam? Yahoo! Mail has the best spam protection around >> http://mail.yahoo.com > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > Indic-computing-users mailing list > http://indic-computing.sourceforge.net/ > Ind...@li... > https://lists.sourceforge.net/lists/listinfo/indic-computing-users > [Other Indic-Computing mailing lists: -devel, -standards, -announce] > |