PDA

View Full Version : Do you know ...?



amhigh
02-22-2002, 09:48 AM
Hi, does anyone out there know how to draw Chinese Font on OpenGL window? Can anyone show me how to do it?

Thanks.

richardve
02-22-2002, 10:21 AM
May I ask why you posted this again (http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/005620.html) ?

(no, I don't know how to draw chinese fonts (http://www.nigels.com/glt/) )

jwatte
02-22-2002, 03:22 PM
OpenGL doesn't really have any real font handling. Instead, what you do is draw your text to an offscreen bitmap, and upload that as a texture, which you then draw on a quad (in alpha test mode, typically). How to do this varies by OS, but it's fairly simple on Windows (with CreateDIBSection()).

harryx
02-22-2002, 04:45 PM
Generally the method described above (textured quads) is the way to go with fonts. However judging from your other post it seems you want the actual 3d geometry of the font outline.

Are you absolutely sure you need this? i.e. do you want to extrude the font to a 3d shape etc?

If so, then I dont have a clue about your chinese font problem, but you could get around it by hunting out an app that generates the necessary vertex data for the font and then load that in instead. This would also have the advantage of not relying on your destination platform having chinese fonts installed.

I think I remember seeing an app that does something like this in the downloads section of NeHe's site, not the bitmapfontbuilder - I think it was a proper 3dfont generator.

amhigh
02-22-2002, 05:00 PM
Originally posted by harryx:
Generally the method described above (textured quads) is the way to go with fonts. However judging from your other post it seems you want the actual 3d geometry of the font outline.

Are you absolutely sure you need this? i.e. do you want to extrude the font to a 3d shape etc?

If so, then I dont have a clue about your chinese font problem, but you could get around it by hunting out an app that generates the necessary vertex data for the font and then load that in instead. This would also have the advantage of not relying on your destination platform having chinese fonts installed.

I think I remember seeing an app that does something like this in the downloads section of NeHe's site, not the bitmapfontbuilder - I think it was a proper 3dfont generator.


Thanks,

You are right, I don't need extrude the font, instead, I would like to obtain the geometric outline of the Chinese Font. Can you please explain a little bit detail of how to do this?

I appreciate, and sorry to post duplicated message in the same group.

Thanks.

harryx
02-22-2002, 05:56 PM
Just think of the font as simple vertex/line geometry.

There are probably many programs out there that will take standard fonts (including I presume your chinese font) and will spit out a geometric approximation. I think stuff like Adobe Illustrator does this, but there will no doubt be a few free/shareware apps that do the job. Like I said previously have a hunt around the NeHe downloads, otherwise do a search on google, there must be something out there.

You would then import this geometric information into your program as you would with standard mesh data.

You could then make a simple class that takes a string and indexes the relevant geometry data from your font mesh.

Really I cant see much use for outline fonts, especially if you arent using them to create 3d objects. So Id make sure you really cant get by with texture mapped fonts before messing with this.

amhigh
02-22-2002, 07:10 PM
Thanks,

If I search with google, what keyword should I type?

I search the download page of NeHe, but did not find anything you mention (the 3dfont generator), Would it be possible to have more detail information about this one?

I really appreciate your kind help.

Thanks,

richardve
02-22-2002, 10:06 PM
Originally posted by amhigh:
If I search with google, what keyword should I type?

Ah, so that's the reason why all the new people post questions on a message board without searching..

Well, let's see.. what are you searching for?

Chinese fonts drawing with OpenGL?

Use Google, and put in the following string: "chinese fonts opengl" and hit the ENTER button.

And in my first post, there was a hidden link..
If you'd looked at that site, than you'd probably noticed this screenshot: china.gif (http://www.nigels.com/glt/china.gif)
Yes, that's a chinese font.

Now, the source of GLT is also available, so that's even better, you can browse the source and see how they are doing it.


[This message has been edited by richardve (edited 02-23-2002).]

richardve
02-22-2002, 10:11 PM
Oh, and as you may also have noticed, you should search for drawing unicode fonts, and that's probably also the reason why you don't see anything on your screen when changing the NeHe tutorial..

amhigh
02-23-2002, 07:06 AM
Originally posted by richardve:
Ah, so that's the reason why all the new people post questions on a message board without searching..

Well, let's see.. what are you searching for?

Chinese fonts drawing with OpenGL?

Use Google, and put in the following string: "chinese fonts opengl" and hit the ENTER button.

And in my first post, there was a hidden link..
If you'd looked at that site, than you'd probably noticed this screenshot: china.gif (http://www.nigels.com/glt/china.gif)
Yes, that's a chinese font.

Now, the source of GLT is also available, so that's even better, you can browse the source and see how they are doing it.


[This message has been edited by richardve (edited 02-23-2002).]

Dear Sir:
Thanks for your answer. I appreciate.
Yes, I am a new people on this site, so when I see your first post, I was scared! But I was also happy to have your hint pointed to GLT library. I also sent you a personal email to say thanks and apoloize for my duplicated post.
I download the GLT files (demo, example and source). I may need spend more time to read the code -- but up to now I still don't know where is the place to put my Chinese Font in the code (say, if you like Draw "A", where can I put "A" in the code). I look at the GLT-Unifont codes, but the input (seems to me) are not the Chinese Font I know of. But again, since there is no documentation of how to use the library, I will need spend more time on this library. Thanks.

I did use google to search after I saw your first post, but what I ask at previous post is what is the key word to seach for finding the "obtaining the geometric outlines of the font" in harryx's post.

Anyway, I appreciate your post and your precious time.

amhigh
02-23-2002, 07:11 AM
Originally posted by richardve:
Oh, and as you may also have noticed, you should search for drawing unicode fonts, and that's probably also the reason why you don't see anything on your screen when changing the NeHe tutorial..

Sorry, Sir, "you should search for drawing unicode fonts" from where?

For the NeHe Lesson, I do the following changes,

a: CreateFont(..., CHINESEBIG5_CHARSET, ..., "Chinese Font");
b: wglUseFontOutlines(hDC, 2049,...);
c: unsigned short snArray[3] = {1, 2, 3}; // add it before next line
d: glCallLists(3, GL_UNSIGNED_SHORT, snArray); // Draws The Display List Text, modify glCallLists as it

It did show something there, but not the Chinese Font I put in the glPrint.

I post this in case you have some clues.

Thanks.

harryx
02-23-2002, 09:00 AM
The program I referred to can be found at - http://pfeweb.multimania.com - Sadly it appears that it cant handle unicode fonts.

Your best bet would be to stick with GLT, as clearly that looks like being the simplest solution.

[This message has been edited by harryx (edited 02-23-2002).]

richardve
02-23-2002, 09:47 AM
Originally posted by amhigh:
Dear Sir:
Thanks for your answer. I appreciate.
Yes, I am a new people on this site, so when I see your first post, I was scared!

Scared of me?
Okay, it was a bit harsh.. but that worse? http://www.opengl.org/discussion_boards/ubb/smile.gif


Anyway, I think there's a better solution than using GLT: FreeType (http://www.freetype.org) !


[This message has been edited by richardve (edited 02-23-2002).]