22 C
New York

xna – Monogame – SpriteFont Exception: Textual content comprises characters that can not be resolved by this SpriteFont


I am making an attempt to place textual content on the display and if I put something however an empty string I get “Textual content comprises characters that can not be resolved by this SpriteFont.nParameter title: textual content”

_spriteBatch.DrawString(screenText, "A", new Vector2(0, 200), Colour.Black);

screenText is the title of my SpriteFont variable.

<?xml model="1.0" encoding="utf-8"?>
<!--
This file comprises an xml description of a font, and might be learn by the XNA
Framework Content material Pipeline. Comply with the feedback to customise the looks
of the font in your sport, and to alter the characters which can be found to attract
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content material.Pipeline.Graphics">
  <Asset Kind="Graphics:LocalizedFontDescription">

    <!--
    Modify this string to alter the font that might be imported.
    -->
    <FontName>Arial</FontName>

    <!--
    Measurement is a float worth, measured in factors. Modify this worth to alter
    the scale of the font.
    -->
    <Measurement>6</Measurement>

    <!--
    Spacing is a float worth, measured in pixels. Modify this worth to alter
    the quantity of spacing in between characters.
    -->
    <Spacing>0</Spacing>

    <!--
    UseKerning controls the structure of the font. If this worth is true, kerning info
    might be used when putting characters.
    -->
    <UseKerning>true</UseKerning>

    <!--
    Model controls the type of the font. Legitimate entries are "Common", "Daring", "Italic",
    and "Daring, Italic", and are case delicate.
    -->
    <Model>Common</Model>

    <!--
    Should you uncomment this line, the default character might be substituted if you happen to draw
    or measure textual content that comprises characters which weren't included within the font.
    -->
    <!-- <DefaultCharacter>*</DefaultCharacter> -->

    <!--
    CharacterRegions management what letters can be found within the font. Each
    character from Begin to Finish might be constructed and made out there for drawing. The
    default vary is from 32, (ASCII house), to 126, ('~'), overlaying the fundamental Latin
    character set. The characters are ordered in response to the Unicode normal.
    See the documentation for extra info.
    For localized fonts you possibly can go away this empty because the character vary might be picked up
    from the Useful resource Information.
    -->
    <CharacterRegions>
      <CharacterRegion>
        <Begin>&#32;</Begin>
        <Finish>&#32;</Finish>
      </CharacterRegion>
    </CharacterRegions>
    <!--
    ResourceFiles management the charaters which might be within the font. It does this
    by scanning the textual content in every of the useful resource recordsdata and including these particular
    characters to the font. 
    -->
    <ResourceFiles>
        <!-- <Resx>Strings.resx</Resx> -->
    </ResourceFiles>
  </Asset>
</XnaContent>

I did construct and rebuild the spritefont file utilizing the Content material Builder.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles