special characters

DanielMGC's picture

Hello. I'm trying to use Nuclex Fonts in a XNA project, but I have a problem.  I've been able to draw text, but when I use special characters (with accents), they don't show up. Is there a way to draw special characters with Nuclex Fonts?!?

Thanks in advance. 

Cygon's picture

Only Ascii for Now

Sorry, but the current release only renders ascii characters (in the 0-127 range).

If you desperately need accents or other special characters, you can modify the Nuclex.Fonts.Content.Pipeline.TrueTypeImporter to import accented characters simply by altering this section of code in BitmapFontProcessor.cpp:

...

  // Import all Ascii characters
  for(wchar_t character = 0; character < 128; ++character)
    importGlyph(fontContent, face, character);

  // Example: Import accented 'a' variants
  importGlyph(fontContent, face, L'á');
  importGlyph(fontContent, face, L'à');
  importGlyph(fontContent, face, L'â');

  ...

 

Just FYI, the XNA SpriteFont classes released with XNA Game Studio 1.0 Refresh do allow you to import special characters by placing them in the XML file:

<CharacterRegions>
  <CharacterRegion>
    <Start>á</Start>
    <End>â</End>
  </CharacterRegion>
</CharacterRegions>
DanielMGC's picture

That did the trick! 

That did the trick! 

Thanks!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <br> <a> <em> <strong> <u> <i> <b> <cite> <blockcode> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <pre> <span>
  • You can highlight code with any of the following tags: <blockcode>

More information about formatting options