Windows Phone 7 - 如何在SpriteFont中使用TTF?

时间:2012-02-25 17:15:57

标签: windows-phone-7 xna true-type-fonts

有没有办法在XNA中使用自定义字体?

1 个答案:

答案 0 :(得分:4)

当然,您需要将字体导入系统。将字体添加到字体系统目录或通过控制面板添加。准备就绪后(重新启动Visual Studio)在Visual Studio中使用SpriteFont的自定义模板,生成XML文件。一个例子:

<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
  <Asset Type="Graphics:FontDescription">

    <!--
    Modify this string to change the font that will be imported.
    -->
    <FontName>Moire</FontName>
...