aspose file tools*
The moose likes General Computing and the fly likes unicode font Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "unicode font" Watch "unicode font" New topic
Author

unicode font

Karamjeet singh
Ranch Hand

Joined: Feb 24, 2010
Posts: 49

how can i convert string of any font to unicode in java


can any one help me ?


Don't aim for success if you want it; just do what you love and believe in, and it will come naturally.
Ralph Cook
Ranch Hand

Joined: May 29, 2005
Posts: 479
karamjeet singh wrote:how can i convert string of any font to unicode in java

can any one help me ?


Well, your question has taught me something -- I had no idea, until I looked it up, that there was any such thing as a Unicode font; I was familiar with Unicode as a way of encoding characters, not representing them.

A font is a way of displaying characters; an encoding is a way of representing characters in (usually) binary. An "A" has a different value in ASCII, EBCDIC, and Unicode, but all of them still represent an "A".

I'm afraid your question is not specific enough to answer. For one thing, we don't normally think of "strings" as having "fonts"; a font is a visual representation of a string, and can be thought of as independent of the encoding of the string they display. In other words, if you see "abcde" on a computer screen, it is not possible to tell if the internal representation is encoded as Unicode, ASCII, or EBCDIC. Also, given a string of characters in any encoding, we can display that string of characters in any font that has the appropriate glyphs without changing the representation.

So we need to know more about what you want to do before we can help.

And I think the forum is much better at answering specific questions than it is broad, general, "how do I write this program" questions.

rc
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Ralph Cook wrote:Well, your question has taught me something -- I had no idea, until I looked it up, that there was any such thing as a Unicode font...


That's just a generalization of the folk taxonomy used by people who are basically ignorant of what Unicode is -- for many people a "Unicode character" is a character which they don't ever use in their computer. (It's surprising that some of those people come from places with Devanagari scripts all over their streets and yet they still think of Unicode as "everything except ASCII".) Extending that meaning of "Unicode character", a "Unicode font" must therefore be a font which can render lots of non-ASCII characters.
Ralph Cook
Ranch Hand

Joined: May 29, 2005
Posts: 479
Actually, it appears to be a very specific font which does, in fact, have the overall purpose of rendering characters in many different scripts:

http://en.wikipedia.org/wiki/Unicode_font

rc
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38910
    
  23
This question sounds too difficult for “beginning”, so I shall move it. Look for Joel Spolsky’s article called something like what every computer scientist definitely absolutely necessarily is obliged compelled and required to know about character encodings.You might be quicker clicking here That article will probably sort out all your problems about fonts.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Campbell Ritchie wrote:Look for Joel Spolsky’s article called something like what every computer scientist definitely absolutely necessarily is obliged compelled and required to know about character encodings.You might be quicker clicking here

It's good you provided that second link, because the first one doesn't lead anywhere near that article...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38910
    
  23
Tim Moores wrote: . . . second link, because the first one doesn't lead anywhere near that article...
Hence the Google didn’t triumph there, did they?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

Looking in my Windows Fonts folder, I see an "Arial Unicode MS Regular" font is registered. Its size is 22MB, whereas most of the rest of the fonts are all only a couple hundred KB. So I suspect that that one font handles characters outside the usual ASCII range. (I also have numerous Han, Japanese and Korean fonts that are MBs in size; I don't know if they are Unicode based.)


JBoss In Action
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Peter Johnson wrote:Looking in my Windows Fonts folder, I see an "Arial Unicode MS Regular" font is registered. Its size is 22MB

Yep, that's the one. It's not part of stock Windows, though, but is installed with MS Office, and even then it's an optional install. I don't think you can download it from MS.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38910
    
  23
Why a website about the Jesus Army should have a page about fonts, I don’t know, but it has. Try this link, too.
Karamjeet singh
Ranch Hand

Joined: Feb 24, 2010
Posts: 49

hi thanks all for your feedback. I am displaying the unicode format for my website



I coded this and got from some forum but not able to work it
I want to show the language on website so anyone from mobile or from any place who show the website he will be able to view the website with his language selected as his selected font is installed on his machine.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Yeah, that code is an example of exactly the kind of ignorance I was describing. Java doesn't have any concept of "converting characters to Unicode" because its characters are already in Unicode. There isn't any option, Java characters are Unicode characters. That code is total rubbish. Throw it away.

Karamjeet, I think it would be a good idea if you explained your problem more fully. We have been chatting about fonts for the last two days and now you mention that you have a website. Is that website part of the problem?
Karamjeet singh
Ranch Hand

Joined: Feb 24, 2010
Posts: 49

Unicode characters are platform(mobile & Win & mac readable) indepenedent right ?

I want this only for my company's website. when anyone click on one language(add it to session or cookie) like portuguese i make it convert the whole website to selected language.

I want to convert all the language to that font but dont want the user to have this font installed on his machine and not able to read the website

can i able to do this?

Thanks for quick answer.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

karamjeet singh wrote:Unicode characters are platform(mobile & Win & mac readable) indepenedent right ?

Yes, Unicode is a specification which is independent of any platform. (I don't know what you mean by "mobile & Win & mac readable" though.)

I want this only for my company's website. when anyone click on one language(add it to session or cookie) like portuguese i make it convert the whole website to selected language.

Okay... so your website's users can choose what language the pages are displayed in.

I want to convert all the language to that font but dont want the user to have this font installed on his machine and not able to read the website

What do you mean by "convert all the language to that font"? What font? Why don't you just send the text and let the browser figure out what font to use? Browsers are very good at that, they already tend to use those "Unicode fonts" which can render scripts from all over the world.

Karamjeet singh
Ranch Hand

Joined: Feb 24, 2010
Posts: 49

What do you mean by "convert all the language to that font"? What font?


like facebook does http://www.facebook.com/ go to below of the page and you will see different languages
when you click on any of them whole page changes with selected language when you see this in firebug or view>page source
then you will find that exact language is there (no english words are in them)

how is this happening?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

I can't go there, my workplace blocks it.

But it sounds to me like Facebook can display its data in English or Russian or a variety of languages. Is that what you're saying?

If it is, then the answer to "how do they do that?" is "They hired people to translate their user interface to a variety of languages and then coded their application so that users could choose which language to read it in". This has nothing to do with fonts, by the way, or not much.

If you were hoping that you could choose a font and magically have it translate your web pages from English to Portuguese, well, that isn't going to happen.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unicode font