我使用SpriteFont 2.0.1软件创建了一个基于纹理的字体。如果我使用默认的字符范围(数字,大写/非大写字母等),它的效果很好。但是,现在我想创建一个仅包含0-9和A-Z(仅大写字母)的spritefont。我导出的纹理可以在:
找到https://dl.dropboxusercontent.com/u/55996726/LuckiestGuy.png
XNA中使用的* .spritefont文件是:
<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">
<!--
Spacing is a float value, measured in pixels. Modify this value to change
the amount of spacing in between characters.
-->
<Spacing>0</Spacing>
<!--
UseKerning controls the layout of the font. If this value is true, kerning information
will be used when placing characters.
-->
<UseKerning>true</UseKerning>
<fontMetrics file="LuckiestGuy.png">
<character key="48">
<x>1</x>
<y>1</y>
<width>53</width>
<height>67</height>
</character>
<character key="49">
<x>55</x>
<y>1</y>
<width>39</width>
<height>67</height>
</character>
<character key="50">
<x>95</x>
<y>1</y>
<width>46</width>
<height>67</height>
</character>
<character key="51">
<x>142</x>
<y>1</y>
<width>47</width>
<height>67</height>
</character>
<character key="52">
<x>190</x>
<y>1</y>
<width>48</width>
<height>67</height>
</character>
<character key="53">
<x>239</x>
<y>1</y>
<width>48</width>
<height>67</height>
</character>
<character key="54">
<x>288</x>
<y>1</y>
<width>49</width>
<height>67</height>
</character>
<character key="55">
<x>338</x>
<y>1</y>
<width>46</width>
<height>67</height>
</character>
<character key="56">
<x>385</x>
<y>1</y>
<width>49</width>
<height>67</height>
</character>
<character key="57">
<x>435</x>
<y>1</y>
<width>49</width>
<height>67</height>
</character>
<character key="65">
<x>485</x>
<y>1</y>
<width>56</width>
<height>67</height>
</character>
<character key="66">
<x>542</x>
<y>1</y>
<width>51</width>
<height>67</height>
</character>
<character key="67">
<x>594</x>
<y>1</y>
<width>47</width>
<height>67</height>
</character>
<character key="68">
<x>642</x>
<y>1</y>
<width>50</width>
<height>67</height>
</character>
<character key="69">
<x>693</x>
<y>1</y>
<width>45</width>
<height>67</height>
</character>
<character key="70">
<x>739</x>
<y>1</y>
<width>45</width>
<height>67</height>
</character>
<character key="71">
<x>785</x>
<y>1</y>
<width>53</width>
<height>67</height>
</character>
<character key="72">
<x>839</x>
<y>1</y>
<width>52</width>
<height>67</height>
</character>
<character key="73">
<x>892</x>
<y>1</y>
<width>33</width>
<height>67</height>
</character>
<character key="74">
<x>926</x>
<y>1</y>
<width>47</width>
<height>67</height>
</character>
<character key="75">
<x>974</x>
<y>1</y>
<width>54</width>
<height>67</height>
</character>
<character key="76">
<x>1029</x>
<y>1</y>
<width>43</width>
<height>67</height>
</character>
<character key="77">
<x>1073</x>
<y>1</y>
<width>62</width>
<height>67</height>
</character>
<character key="78">
<x>1136</x>
<y>1</y>
<width>57</width>
<height>67</height>
</character>
<character key="79">
<x>1194</x>
<y>1</y>
<width>54</width>
<height>67</height>
</character>
<character key="80">
<x>1249</x>
<y>1</y>
<width>51</width>
<height>67</height>
</character>
<character key="81">
<x>1301</x>
<y>1</y>
<width>57</width>
<height>67</height>
</character>
<character key="82">
<x>1359</x>
<y>1</y>
<width>51</width>
<height>67</height>
</character>
<character key="83">
<x>1411</x>
<y>1</y>
<width>48</width>
<height>67</height>
</character>
<character key="84">
<x>1460</x>
<y>1</y>
<width>49</width>
<height>67</height>
</character>
<character key="85">
<x>1510</x>
<y>1</y>
<width>52</width>
<height>67</height>
</character>
<character key="86">
<x>1563</x>
<y>1</y>
<width>56</width>
<height>67</height>
</character>
<character key="87">
<x>1620</x>
<y>1</y>
<width>71</width>
<height>67</height>
</character>
<character key="88">
<x>1692</x>
<y>1</y>
<width>55</width>
<height>67</height>
</character>
<character key="89">
<x>1748</x>
<y>1</y>
<width>56</width>
<height>67</height>
</character>
<character key="90">
<x>1805</x>
<y>1</y>
<width>45</width>
<height>67</height>
</character>
</fontMetrics>
</Asset>
</XnaContent>
然而,XNA给我一个错误,说“这个spritefont中没有字符'E'(0x0045)。”当我想渲染以'E'开头的单词时。我做错了什么?