Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Working with Unicode fonts

  1. #1
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    Working with Unicode fonts

    Hi there
    I should render Farsi fonts in an application.I haven't worked with Unicode fonts before. How to render such fonts with OpenGL?Are there any articles to discuss about the unicode fonts in OpenGL? Are there any useful codes that render the Unicode fonts with OpenGL?
    <span style="color: #006600">-Ehsan-</span>

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: Working with Unicode fonts

    Are there any articles to discuss about the unicode fonts in OpenGL?
    No, but it shouldn't be all that different from any tutorial on using FreeType to render fonts. FreeType worked in Unicode Points. Unfortunately, most font rendering tutorials are not written to be fully useful demonstrations, so they tend to do silly things like put each character in display lists and render a string by assuming each character represents a display list name for that character.

    Basically, what you need is the code to use FreeType and extract images into textures. After that, the rendering you'll have to deal with using your Unicode-aware string interpretation classes.

  3. #3
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    Re: Working with Unicode fonts

    Quote Originally Posted by Korval
    Basically, what you need is the code to use FreeType and extract images into textures. After that, the rendering you'll have to deal with using your Unicode-aware string interpretation classes.
    OK, but how?
    <span style="color: #006600">-Ehsan-</span>

  4. #4
    Junior Member Regular Contributor
    Join Date
    Aug 2007
    Location
    USA
    Posts
    244

    Re: Working with Unicode fonts


  5. #5
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: Working with Unicode fonts

    OK, but how?
    How what? How to use FreeType to extract images from a font file? That's a Google search away.

    How to use a Unicode-aware string?

    First, read up on Unicode and Unicode encodings, so that we know what we're talking about.

    Ultimately, any font rendering is going to need to convert the array of some Unicode encoding into an array of Unicode points, because the font only holds the mapping from Unicode points to font glyphs. How you do that is up to you; there are any number of libraries for handling Unicode strings. Probably the least intrusive one is utf-8 cpp; that's what I use at any rate.

    So, once you can extract an image for a particular Unicode point from FreeType, and you can turn your input string into an array of Unicode points, all you need to do is render that image. Normal usage would be to do the extraction process ahead of time, storing the images in a large texture, then pulling out the pieces you need as needed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •