Font has glyphs but cant display through drawString

I want to use this font (originally a mac font but edited and saved to use on PC) to display a String though Graphics.drawString().

I checked if the font contains any glyphs. It does: 221 in all checked through Font.getNumGlyphs().

Font font =new Font("FontA",Font.PLAIN,12);

String dispstr =new String(newchar[]{(char)0x21});

g.setFont(font);

g.drawString(dispstr,0,0);

I only saw an empty box. So I tried Font.canDisplay((char)0x21) and it returned false! I'm pretty sure there that character 0x21 does exist in that font by checking it in my os's charmap.

Any other means to check if this font can be displayed in my java application is of course greatly appreciated.

[966 byte] By [nodaloa] at [2007-10-3 10:30:24]
# 1
Do you mean 0x21 hex or 0x21 dec?Java supports decimal, hexidecimal,octal, and binary through designations of d, h, o, and b.0x21h = hex, base-160x21 = 21 decimal, base-100x21o = 21 octal, base-80x21b = binary, base-2
watertownjordana at 2007-7-15 5:53:04 > top of Java-index,Java Essentials,Java Programming...
# 2
A good clue about glyphs is when it does not match the charactor table that your number is wrong.
watertownjordana at 2007-7-15 5:53:04 > top of Java-index,Java Essentials,Java Programming...
# 3
Is that a true type font ?can u use it with other app?
AmitavaDeya at 2007-7-15 5:53:04 > top of Java-index,Java Essentials,Java Programming...
# 4
it's 0x21 hex. i've also tried 0x33 dec with same results. still an empty box.
nodaloa at 2007-7-15 5:53:04 > top of Java-index,Java Essentials,Java Programming...
# 5
> Is that a true type font ?can u use it with other app?yes, it is a true type font. i've tried it on wordpad and illustrator and the font shows.
nodaloa at 2007-7-15 5:53:04 > top of Java-index,Java Essentials,Java Programming...
# 6
if u can't use the font with with other app then it's not installed so you need to use createFont method to create font from inputstream.not applied becoz i didn't see ur last mesageMessage was edited by: AmitavaDey
AmitavaDeya at 2007-7-15 5:53:04 > top of Java-index,Java Essentials,Java Programming...
# 7

:-) Yes, yes, the font is already installed in my system.

Do you think it has something to do on how the font was saved? When I view the font's mapping through Window's charmap and have Advanced View toggled, all the input fields are disabled unlike other true type fonts that I can display in my java application.

I checked the font's properties its encoding type is Symbol. Could character encoding be the issue? Then, if simple Graphics.drawString() wouldn't work for this, what would be the workaround? ?:/

nodaloa at 2007-7-15 5:53:04 > top of Java-index,Java Essentials,Java Programming...
# 8

> Do you think it has something to do on how the font

> was saved? ...

> I checked the font's properties its encoding type is

> Symbol. Could character encoding be the issue?

Indeed, it was on how the font was saved!

The Font Properties Ext Tool at microsoft.com/typography/ shows more informative details on my font. Checking the font's properties, under the Charset/Unicode tab, the font's encoding type was 'Symbol', which I don't think Java supports. So I just resaved the font to ISO Latin1 encoding and installed that new ttf file to my systems font and the fonts finally appear!

nodaloa at 2007-7-15 5:53:04 > top of Java-index,Java Essentials,Java Programming...