Jump to content
  • Advertisement
Sign in to follow this  
Magogan

How can I display Unicode characters like "ä" or "?" in my game?

This topic is 1424 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I want to release my game in different languages and I don't know how to display all the characters of different languages, including English, German, Chinese, Swedish and so on. I have figured out to display ASCII characters by putting them into a texture, but it is too much work to manually add all of the characters I need to one (or more) texture(s).

 

Is there a solution for this problem? Can I do it automatically by rendering the characters SVG files into a texture and loading this texture into the game? But how can I do this? Or is there a simplier solution?

 

Greetings,

Magogan

 

PS: Sorry for my bad english :D

Share this post


Link to post
Share on other sites
Advertisement
There are plenty of tools that can render any arbitrary glyphs supported by FreeType or other font engines into a texture. Or you can just use FreeType directly, if you need to support more characters than is reasonable for a bitmapped font.

AngelCode BMFont is a popular such tool.

Share this post


Link to post
Share on other sites


I want to release my game in different languages and I don't know how to display all the characters of different languages, including English, German, Chinese, Swedish and so on. I have figured out to display ASCII characters by putting them into a texture, but it is too much work to manually add all of the characters I need to one (or more) texture(s).
 
Is there a solution for this problem? Can I do it automatically by rendering the characters SVG files into a texture and loading this texture into the game? But how can I do this? Or is there a simplier solution?

In general you need to specify ranges of characters, use something like FreeType to render their glyphs, use a bin packing algorithm to place the rendered glyphs into a texture, and store the texture along with a map of character codes (in Unicode, of course) to image clip regions. All this can be done programmatically with the exception of range specification. Tools like the one mentioned by Sean do this for you.

 

BTW: Font files and SVG are different things, although both may use paths based on the same (or at least similar) primitives.

Share this post


Link to post
Share on other sites

DirectWrite uses a 2D render target. I don't know if and how I can use this for a 3D game with a 3D render target...

 

SpriteFont uses Windows 8.1 SDK and DirectX 11.1 math. Will it work with Windows Vista, Windows 7 and Windows 8(.1) and on graphic cards that only support DirectX 11?

 

And is there a way to get the size of the text before it is rendered? I need to know the width of each word (or letter) to implement scrolling, so how can I do this with DirectWrite or SpriteFont?

Edited by Magogan

Share this post


Link to post
Share on other sites


DirectWrite uses a 2D render target. I don't know if and how I can use this for a 3D game with a 3D render target...

 

Combining DirectWrite/Direct2D with D3D11 is definitely possible. I used them both for a project a while ago (it used SharpDX, but that doesn't really make a difference). Unfortunately, I don't have access to that project right now.

 


SpriteFont uses Windows 8.1 SDK and DirectX 11.1 math. Will it work with Windows Vista, Windows 7 and Windows 8(.1) and on graphic cards that only support DirectX 11?

DirectXTK should be usable on all platforms that support DX11 (you can still use a lower feature level). According to the Codeplex page, Vista SP2 and higher are supported.

 


And is there a way to get the size of the text before it is rendered? I need to know the width of each word (or letter) to implement scrolling, so how can I do this with DirectWrite or SpriteFont?

SpriteFont provides a MeasureString method that returns the size of a given string in pixels.

DirectWrite allows you to do get all kinds of information on the text to be rendered and implements many formatting options.

Share this post


Link to post
Share on other sites
I found a solution for rendering DirectWrite to a D3D 10.1 texture: http://msdn.microsoft.com/en-us/library/windows/desktop/dd370966(v=vs.85).aspx#example__use_direct2d_content_as_a_texture

But I don't know how to access this texture with D3D 11. Is there a way to convert a D3D 10.1 texture into a D3D 11 texture? I cannot "simply" draw directly to the surface because I want to use text on signs located somewhere in the 3D world.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!