How to use ALT symbols ♫

I am trying to use a ♫ character in my game, but am getting this error (using Arial font) anyone have any experience in this?

Text contains characters that cannot be resolved by this SpriteFont. (Parameter ‘text’)’

1 Like

Hi, @Jack_Carlson welcome to the forums.

The SpriteFont file that is created has a section at the bottom that defines which character regions to import. Looks like this

That character you’re trying to use it outside of the default start-end range. Youll need to adjust the <End> value to include the alt symbols you want.

Here are all the Arial ones
https://www.aivosto.com/fontitin/help/sample-all.html

1 Like

Hi @Jack_Carlson Another Welcome to the Community!

As mentioned above, I think you would put:

According to the link provided by Aris, 266B is the character for the ♫ character…

<End>&#266B</End>

But strangely you press ALT + 14 on the numpad… confusing…

If this works, please do write back here… I am yet to try this myself.

Happy Coding!

I don’t believe you can use hex character ranges (if you can, it’d probably need to be in this format &#x266B;). Either way, &#9835; will work (the decimal index). Provided of course, that your source font has a glyph for that index.

2 Likes

The ASCII control codes 0-31, had representations in the console font, 14 being ♫.

XML does not allow any of the control characters, so the alternative form must be used.

The encoding process only allows the Unicode Basic plane(BMP), single char representations, that restriction excludes the higher Unicode values like emojis.

To use hex values place an x before the number.

It would be better to use 2 CharacterRegion nodes rather than encoding an extra ~8000 unused characters Depending on the font, for Arial it is ~1000 extra.

 <CharacterRegions>
      <CharacterRegion>
        <Start>&#32;</Start>
        <End>&#126;</End>
      </CharacterRegion>
	  <CharacterRegion>
		<Start>&#x266B;</Start>
		<End>&#x266B;</End>
	  </CharacterRegion>
    </CharacterRegions>
1 Like

This answers a half decade question of mine, thanks!