Unicode fonts in java

Greetings. I have two TrueType fonts I'm trying to display in my java application. Both fonts have been "installed" on my Windows machine, one of them works just find (I can see Graphics.drawString("A", ...) and the corresponding A symbol is displayed. However, when using the other font, I get the missing character symbol, unless I use a unicode escape sequence, e.g. "\uf040". Both fonts, incidentally are military-symbol fonts, and they are very similar in nature. Why does one font require I use the escape sequence, while one does not, and is there anyway I can configure the JRE so that I can avoid having to use the escape code?

When I open the font that isn't working directly (using a font viewer), the same letter "A" that is mapped to, say, "Times New Roman" is also mapped to the letter "A" for this font (in other words, it's not using characters outside of my keyboard capability). To put this another way, MS Word displays the characters just fine when I type them in with my keyboard-- Java 2D does not.
The reason I don't want to use the Unicode escapes is because I can't seem to figure out an easy way to display all the characters between, say, 40 and 200 in a loop-- in other words, how would I go about constructing the unicode escape string while in a loop? you can't simply say "/u" + loopVariable because it's not a string literal.

Similar Messages

  • How to use Unicode font in a AWT compoment?

    Dear,
    I am a new on Java.
    I want to use Unicode font in AWT/Swing but I cannot.
    I use JDK 1.4.1 & JBuilder 7.0.
    Please help me.
    Thanks,
    Cuong Ha.

    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=2&t=001235
    http://www.linuxforum.net/chinese/develop/java.html
    Hope its of help to you.

  • How to use unicode font in J2ME

    Hi,
    I want to create some mobile application using Unicode Font in J2ME.
    Please help me about how to use Unicode Font in J2ME and how to configure Unicode Font in J2ME SDK 3.0 Early Access

    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=2&t=001235
    http://www.linuxforum.net/chinese/develop/java.html
    Hope its of help to you.

  • Using TeX's cmex10.pfb and other odd-coded fonts in Java

    I can use Font.createFont on COmputer Modern (maths) fonts like cmmi and cmex postscript type1 files and get a font. But as best I can discern many of the glyphs therein do not get found by the mapping via Unicode and I have been having trouble finding how to access them. Eg cmex10 reports it has 130 glyphs in but only 20 unicode codepoints admit to being populated and most of those do not display anything for me. Can anybody tell me how to select a physical font like that and access the glyphs by the raw unmapped codes that TeX gave them? Sample code would be nice but any pointers to what to do would perhaps help. Thanks! Arthur

    Further investigation: Java up to 1.3 or 1.4 had font property config files but those seen no longer present and do not cover fonts loaded from resources well.
    If I use the t1disasm disassembler on the type1 font and edit the postscript to change the names of some of the postscript procedures used to draw fonts to A, B, C etc I can then see those glyphs. So Java seems to be using the names of the items in the font encoding vector to try to map chars onto Unicode and just discarding glyphs it can not cope with ????
    So maybe I will be able to cope by making a trick version of cmex that names all its glyphs as if they are things in the Unicode space that Java knows about! But that seems pretty gross to me and a better solution that gave me raw access to the fonts by uninterpreted character code would be nicer.

  • Fonts in Windows and Fonts in Java

    Hello,
    Say I have in my app:
    String string = "\\u09A1";
    I want to display this in my app. I can call:
    GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
    I can then iterate through these and find out which ones can display this unicode character using,
    font.canDisplayUpTo(string);
    My question is, are these the fonts that Java can display (from charsets.jar) or the ones installed in Windows?
    I would like to be able to get lists for both of these.
    Any ideas?
    Cheers,
    Jim

    Thank you. I did read that. I was not talking about drawing text in 'Hello World' alike applets/programs.
    I should give an example:
    I would like to print 'H' in Tahoma, 72, Bold (Windows format) at (100, 200).
    Font sizes:
    In Windows font size is 72 pixels.
    In Java this is equal to 96 points (72 px * 96 (scr resolution for Toolkit) / 72 (pixels per point).
    Real height in Windows and Java will be 64 px.
    That's fine. For some fonts this does not work.
    Positioning. See example above.
    According to the article you refer to in java we should use y-coordinate 200 + 72 (font size) = 272.
    In fact we have :
    Java text 14 pixels below than expected.
    Similar things happen to other parameters Weight, Styles, etc.
    I do use AttributedString and TextAttribute classes to render text
    Thanks in advance.
    Alex

  • Fonts for Java

    Hi,
    I am a font developer, and Java developer as well. I have made some OpenType fonts for Windows 2000 that support Arabic Script ranges in Unicode 3.0. Now when I make a Java program on that machine, that uses this font, it works fine. But I can't use this application on other platforms, because my font is for Windows. Is there any why I can ship my font with my program, so that one can see same glyphs and ligatures on platforms other than Windows?

    Hi,
    I used Java to support Indian langauge of Kannada. And it works well in bothe IE and Netscape (and its plain AWT). I'm using a plain TTF for this. Its not a Unicode font. But with this approach, there is a problem.
    Let me take an example to explain what I want to say. When I press the 'k' key I get 'ka' character displayed, which is made up of 2 glyphs. And now if I press BACKSPACE, only one of the 2 glyphs is deleted which is undesirable. Its the same case when you press DELETE key. So is the case for all other characters in all the Indian langauges. Here I'd like to know...
    1. If the font were a opentype, could we bind the 2 glyphs into a group such that if any one of the glyphs is deleted, both the glyphs gets removed from the TextArea or TextField?
    2. If the font were a opentype, can it be that if I press the 'k' key on the keyboard, the unicode value for 'ka' is inserted into the TextArea and the glyphs for 'ka' character is displayed?
    Please reply.
    Regards,
    Harsha P. Ravnikar
    [email protected]

  • Deprecation warning for getFontMetrics(java.awt.Font) in java.awt.Toolkit

    Hi all,
    When I use the following code
    JComponent c;
    FontMetrics metrics = getToolkit().getFontMetrics(c.getFont());
    I get this following warning during compilation:-
    warning: getFontMetrics(java.awt.Font) in java.awt.Toolkit has been deprecated
    JDK suggests to use getLineMetrics() of the Font class.
    But there's an issue with that: if I use getLineMetrics(), there is no API method that I can use to get the width of a string as opposed to FontMetrics which provides stringWidth(String str) method for that purpose. In fact all the methods in FontMetrics are not mapped into LineMetrics.
    Could anyone please help or provide me at least some pointers on how to tackle this issue so that I can get rid of the deprecated method along with the existing methods mapped to equivalent APIs? The bottomline is that I should be able to maintain the existing functinality of my application for those part of code that uses getToolkit().getFontMetrics().
    Thank you for your help in advance.
    -Sanjoy Das

    Use Graphics.getFontMetrics(font) instead.
    After creation your frame and calling frame.show();
    You can access it like that
    frame.show();
    frame.getGraphics().getFontMetrics(new Font("Arial",0,10));
    before showing graphics is null.
    Or just create a BufferedImage and ask it for graphics.
    BufferedImage img=new BufferedImage(...);
    img.getGraphics().getFontMetrics(font);
    regards
    Stas

  • True Type Fonts in Java

    Hi all
    I searched through the forum and found some threads with the same problem but never a solution attached so here is my question:
    I'm currently trying to use a True Type Font in Java. I installed the font under windows and it works fine in e.g. Word, but when I try to use it in Java all I can see are "rectangles". I'm not sure if the problem lies in the font itself or if it is a problem of Java. The fonts are named "Fughetta" and "Toccata" and can be found here: http://www.efn.org/~bch/aboutfonts.html. He is a code snippet I'm using to test the font:
    public void setFonts(Graphics g)
            if (f != null) {
                return;
            f = new Font("Fughetta", Font.TRUETYPE_FONT, 26);
            System.out.println(f);
        public void paintComponent(Graphics g)
            super.paintComponent(g);
            setFonts(g);
            String s1 = "1234567890��!\"�$%&/(()=?`";
            String s2 = "qwertzuiop�+asdfghjkl��#yxcvbnm,.-<";
            String s3 = "QWERTZUIOP�*ASDFGHJKL��'YXCVBNM;:_>";
            String s4 = "1��{[]\\}@�~�|";
            g.setFont(f);
            g.drawString(s1, 10, 30);
            g.drawString(s2, 10, 70);
            g.drawString(s3, 10, 110);
            g.drawString(s4, 10, 150);
        }All help is appreciated ;)
    - marc

    Hy, Thanks for your sollution, but now I can't use this kind of approach.
    I need to show a Bar Code Font inside a JTable cell, so I created my CellRenderer, in which I tried to change the font to my "Code EAN13" True Type font.
    public Component getTableCellRendererComponent(JTable table,
                Object value, boolean isSelected, boolean hasFocus, int row, int column)  {
                 Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                 if (column == CollectInfoTableModel.CODBAREPRODUS_INDEX ) {
                         Font barCodeFont = new Font("Arial", Font.BOLD, 36);
                         c.setFont(barCodeFont);                 
    }This doesn't work, it just prints some strange characters.
    I tried your sollution, but when I make :
    Graphics2D g2D= (Graphics)c.getGraphics();i keep getting g2D = null.
    What can I do ?
    Is there a way to obtai a valid Grapics object on which to draw the glyphVector on ?

  • Need help with Tamil unicode fonts in Macbook OSX 10.6.7

    I am really desperate for some help figuring out my Tamil unicode font problem. With great difficulty I got all these fonts set up on my previous ibook G4. When that computer died in the fall I got this new Macbook, and had all my data brought from the old computer to the new one. Fonts were working great, as before. Well recently I had a hard drive failure on my new Macbook (OSX 10.6.7). I now have a new hard drive, and I brought over all my data from an external hard drive using Time Machine. Everything appeared to be working great....except the Tamil fonts. Previously I was using Murasu Anjal unicode font which allowed me to type in Tamil font and view Tamil on webpages, no problem. I understand that Snow Leopard has Tamil font support (including Anjal), so I am confused as to why they were working before but are not working now-especially because on my husband's Macbook Pro (OSX 10.6.5) you can see Tamil fonts on webpages and he has no special Tamil font installed whatsoever. For me the only thing visible is boxes. I am in the midst of finishing up a dissertation which is really dependent on being able to read and write in Tamil fonts. I am desperate to get this fixed but just cannot seem to figure it out. I would greatly appreciate any help or advice!!! Thanks so much!!!

    I've always used the Anjal keyboard with no problem...at least there was no problem before my MacBook hard drive had to be replaced, with a newer operating system, as I had mentioned previously. When I type in Pages, NeoOffice or TextEdit, the results are the same. Many of the characters show up, but vowel combinations--especially the "o" or "u" vowels--show up incorrectly or are unintelligible. Strangely, typing in Tamil font (using Anjal keyboard) in internet searches works perfectly, but ONLY in Firefox (?) NOT in the Safari browser. Prior to re-installing the InaiMathi font, which had seemingly vanished with the transfer of my data to the new hard drive, I was unable to type Tamil anywhere, not even in Firefox. Now it works only in Firefox. For example, if I were to type in Tamil in this window, it works fine: தமிழ் நாடு. 
    Being able to do Tamil searches in Firefox as I had previously is really a major boon for me, but of course I'd love to be able to produce Tamil text, especially as I am about to embark on a 6 month research jaunt to South Asia.
    Many thanks for all your help thus far, and for any further advice you might have.

  • Can not copy text from pdf with unicode font embedded.

    Hello,
    I have a pdf with unicode font embedded in it. The pdf has no restrictions. When i try to copy some text text fro m pdf and then paste itin word, the text is not the same which i copied from the pdf. it changes.
    I have tried multiple softwares which converts pdf to word or pdf to excel. but none can do my job. what should be the problem? Kindly guide me.
    Thanks & Regards-
    rashmi

    Thanks for your prompt reply.
    As i said i have the font installed on my system. for your reference,
    following is the link to the pdf file. also the second link is the link to
    the fonts used. Kindly help me to sort this issue.
    https://www.yousendit.com/download/T2dkcHBEVEh0QTIwYjhUQw
    https://www.yousendit.com/download/T2dkcHBFQXBrYUJYd3NUQw

  • How to use unicode fonts in Oracle forms 10g?

    Hi I am working in forms 10g for quite a long time, the software that I have developed so far are all in English language. Now I have requirements to use Bengali Fonts in Forms 10g. I am facing difficulties doing that. Please reply with help. Thanks
    Hasan Al Mamun

    Check this forum post (though that is for 6i, it would be of helpful for you)
    How to use unicode fonts in Oracle forms 10g?
    -Arun

  • Fonts in java apps for win and linux

    Hi everyone.
    i need to build an application mult-plataform, to run in windows and linux...
    but i don�t know waht font i must use...the default font that java takes doesn�t exist in linux (dialog)...
    waht font should i use in my app??
    thanx

    For going multi-platform it is easiest to stick to the logical fonts: Fonts named "Serif", "SansSerif", "Monospaced", "Dialog", and "DialogInput".
    These fonts are guaranteed to exist on any platform, although their implementations may be different. If you use others then you'll have to figure out how to deal with cross platform issues.
    Jeff

  • Bengali Unicode fonts in InDesign CS6

    Dear InDesign Gurus,
    How do I type using "Bengali" (Unicode) fonts in InDesign CS6?  I've tried to copy/paste the text from an existing word document on to an InDesign document, but it shows up with square blocks!   I'm using Windows 7 Pro 64Bit OS.
    Is this even possible?  Would someone please provide me some detail steps?
    Many thanks in advance.
    Simon

    Cyndee,
    As I said, I'm fairly new in ID, would you kindly tell me the steps so that I know what to do?
    Ellis,
    I am working with a ID Magazine template.  Obviously the template has blocks and pre-written text inside those blocks.  If I try to delete the text (without deleting the BOX + contents within) and paste the Bengali text from some other document, some of the characters do not stay in place.  Whereas, if I just create a text box and paste the text inside the new box, texts show properly. 
    So my question to you Gurus is... how can keep the template I'm using and just replace the text within text box and save time.   Would someone plz guide me?
    Thanks for your professional help!

  • Unicode Font in a PDF report (iTextSharp)

    I tried to use unicode font  (Arial Unicode MS - arialuni.ttf) in a PDF document generated with iTextSharp.  I am able to create the PDF document with this font.
    In the  iTextSharp documentation, we are suppose to be able to send unicode, but I don't understand how to do this in Labview.
    I read A List of Tips and Tools for using Unicode in LabVIEW but I am stuck.  Any ideas?
    Jean-Marc
    Jean-Marc
    LV2009 and LV2013
    Free PDF Report with iTextSharp

    I don’t have the new version in my actual computer. I will go by memory.
    1)      I found no way to connect a LabVIEW string to an Unicode iTextSharp phrase or paragraph;
    2)      The only way I found is to add a .NET string (mscorlib.system.string --> Unicode Basic Multilingual Plane) to an iTextSharp phrase or paragraph.
    3)      You construct this .NET string with an array of UTF16.
    To construct the U16[ ]:
    1)    I wrote the text in NotePad (Unicode).  
    2)    I copy the string in a LabVIEW string (not Unicode);
    3)    I remove the BOM;
    4)    I swap the bytes (2 bytes by to 2 bytes) and I typecast in U16.
    Jean-Marc
    LV2009 and LV2013
    Free PDF Report with iTextSharp
    Attachments:
    Crude example Unicode Paragraph LV2013.vi ‏14 KB

  • Prs-t1 is not properly rendering indic unicode fonts. Works fine in prs-t2

    Hi
    prs-t1 is not properly rendering indic unicode fonts (Hindi, Telugu etc).  Same epub works fine in prs-t2 and it renders the fonts properly.
    Solved!
    Go to Solution.

     Hi
    “Ind” had emailed me, a file with a font issue.
    On his first post, he wrote: “…prs-t1 is not properly rendering indic unicode fonts (Hindi, Telugu etc).  Same epub works fine in prs-t2 and it renders the fonts properly…”
    Even I had the same results.
    Only ReaderforPC and PRS-T1 had such font issue.
    All other softwares (MS Word, MS Notepad, Adobe Digital Editions, Calibre, Sigil, etc) and PRS-T2 are viewing Indic Unicode fonts correctly.
    I had copied the “defective” text from ReaderforPC and pasted it on MS Word. But surprise! The same text on MS Word had no font issue anymore!!!!
    That means: “the file is without font issue!"
    The issue is on "Reader for PC" software and on PRS-T1’s firmware!
    Probable solutions.
    For Sony Software Developers:
    Correct ReaderforPC software.
    Correct PRS-T1 firmware.
    For all other in order to read ebooks with Indic Unicode fonts (Hindi, Telugu, etc.):
    Use Sony PRS-T2/T3 Reader Device
    On PC use:
    --Adobe Digital Editions http://www.adobe.com/products/digital-editions.html (to read ebooks with Adobe DRM or DRM-free)
    --Calibre http://calibre-ebook.com/ to read DRM-free ebooks
    --Sigil (free epub editor) http://code.google.com/p/sigil/  to modify ebooks (only DRM-free ebooks)
    -- or other software
    Thanks “ind” for the feedback
    Jannis

Maybe you are looking for

  • Adding footer in table

    Hi All, I want to add a footer for table in WDA. I am not using ALV. My footer will give the total of the items in the table. However, i am not able to add a footer. It also doesnt appear if i make footer visible. Please advise. Thanks, Prisford Pere

  • Photoshop LightRoom Serial Number Issue

    I bought Adobe Photoshop Lightroom a couple weeks ago from Best Buy in box format (with a serial number insert).  I tried installing it on my computer and registering and using the serial number and all that, but it says that the serial number is no

  • Document Management System workflow

    Dear Sirs, In document management system while doing document distribution system is creating partial order,inial order but no distribution order.Further to that it saying "Not yet sent to recipient Message no. 25235 Diagnosis No distribution has bee

  • Hi. How do i get my photos And books stored on iCloud?i have lost my pdf files during  my last sync.

    Hi. How can i get Baco my documents from iCloud? I have lost my pdf list Wikipédia sync. I solda lime to get my PDS Back that are suppose to be on iclouds?

  • Photoshop cs6  .psd file extension

    Hello,  if you create an image and it has a .psd file extension.  Do you have to download software to view the .psd file extension.  Or can if easily be converted to a .jpeg.  On my mac I can see the image.  At work a windows machine it's asking me t