<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx</link><description>As mentioned in a previous post , there is a clear need for a bitmap font generator that provides proper Unicode support. To address this need, I created BMFontGen.exe. This program can generate a bitmap font from any of the fonts currently installed</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>XNA Diaries : One Codepage to rule them all : Unicode, C#, XNA &amp;amp; Fonts</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#732765</link><pubDate>Thu, 31 Aug 2006 06:02:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:732765</guid><dc:creator>XNA Diaries : One Codepage to rule them all : Unicode, C#, XNA &amp; Fonts</dc:creator><description>PingBack from &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/garykac/archive/2006/08/29/726222.aspx"&gt;http://blogs.msdn.com/garykac/archive/2006/08/29/726222.aspx&lt;/a&gt;</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#733226</link><pubDate>Thu, 31 Aug 2006 12:31:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:733226</guid><dc:creator>Ashley Allen</dc:creator><description>Thanks dude. You rule!</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#737672</link><pubDate>Sun, 03 Sep 2006 11:31:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:737672</guid><dc:creator>Peter K</dc:creator><description>Works great, thanks for sharing.</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#737819</link><pubDate>Sun, 03 Sep 2006 13:19:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:737819</guid><dc:creator>SePPiE X</dc:creator><description>Awesome class! This is gonna save me SO much time.. Thank you very much!</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#738697</link><pubDate>Mon, 04 Sep 2006 04:10:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:738697</guid><dc:creator>Jim Welch</dc:creator><description>This is great. I only have 1 recommendation. Can you add a readonly property of FontFilename to the BitmapFont class? I've done so for my project, but I think I'll be checking in and updating the class with your new improvements. I'm using that prop to check to see if the font has already been loaded by looping through a List&amp;lt;BitmapFont&amp;gt;, etc. </description></item><item><title>XNA Links - 09/05/2006</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#740431</link><pubDate>Tue, 05 Sep 2006 05:48:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:740431</guid><dc:creator>Mickey Gousset</dc:creator><description>Gary has several informative links in his XNA Framework Content Pipeline post. &amp;nbsp;He also gives us a couple...</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#740599</link><pubDate>Tue, 05 Sep 2006 08:47:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:740599</guid><dc:creator>MadJack McMad</dc:creator><description>You're a hero, thank you for this.</description></item><item><title>mind for war  &amp;raquo; Blog Archive   &amp;raquo; Not quite later today&amp;#8230;</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#740603</link><pubDate>Tue, 05 Sep 2006 08:48:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:740603</guid><dc:creator>mind for war  » Blog Archive   » Not quite later today…</dc:creator><description>PingBack from &lt;a rel="nofollow" target="_new" href="http://mindforwar.com/2006/09/05/not-quite-later-today/"&gt;http://mindforwar.com/2006/09/05/not-quite-later-today/&lt;/a&gt;</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#742068</link><pubDate>Wed, 06 Sep 2006 05:17:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:742068</guid><dc:creator>David</dc:creator><description>The biggest missing feature is that there aren't any "button graphics" included with XNA. I would think pretty much every game developed would want them. (I'm saying, a bitmap for A, B, X, Y, right shoulder, and so forth). &lt;BR&gt;&lt;BR&gt;In any event, you are correct in your premise about this issue: this kind of functionality needs to be rolled into XNA proper.</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#746306</link><pubDate>Fri, 08 Sep 2006 16:46:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:746306</guid><dc:creator>PeteB</dc:creator><description>Great work cheers. David's comment is a good suggestion other than that, great job helped me a lot :D
&lt;br&gt;
&lt;br&gt;Pete </description></item><item><title>Don't mix ClearType with your game fonts</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#747503</link><pubDate>Sat, 09 Sep 2006 09:14:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:747503</guid><dc:creator>XNA Diaries</dc:creator><description>The ClearType&amp;amp;amp;nbsp;text rendering hint (option: -trh ct-grid) tells&amp;amp;amp;nbsp;BMFontGen&amp;amp;amp;nbsp;to apply&amp;amp;amp;nbsp;ClearType...</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#750238</link><pubDate>Tue, 12 Sep 2006 09:23:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:750238</guid><dc:creator>Matt Moore</dc:creator><description>&lt;P&gt;How does one properly dispose of this prior to a GraphicsDevice.Reset? &lt;BR&gt;&lt;BR&gt;I am getting errors on my device.Reset while changing resolutions. &lt;BR&gt;&lt;BR&gt;I've created a Dispose() to your class that disposes of the m_sb (the only instance to be in the default pool) but that has not worked. &lt;BR&gt;&lt;BR&gt;MyFont.Dispose(); &lt;BR&gt;device.Reset(MyPP); &lt;BR&gt;&lt;BR&gt;It throws exception at that line prior to getting to my device.Rest and device.Lost handlers. &lt;BR&gt;&lt;BR&gt;[3408] Direct3D9: (ERROR) :The following D3DPOOL_DEFAULT surfaces/buffers/textures still exist &lt;BR&gt;&lt;BR&gt;[3408] Direct3D9: (ERROR) : &amp;nbsp;D3DRTYPE_SURFACE &lt;BR&gt;&lt;BR&gt;I know this is coming from the BitmapFont instance because if i remove "MyFont.drawString(....)" from my draw routine, I can switch (reset) from fullscreen to windowed without the exception firing. &lt;BR&gt;&lt;BR&gt;Any help would be greatly appreciated, &lt;BR&gt;&lt;BR&gt;Matt Moore&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;[In addition to the SpriteBatch, there are also the font textures that need to be disposed of:&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;Dictionary&amp;lt;int, Texture2D&amp;gt; m_dictBitmapID2Texture;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;I'll fix this for the next release (by adding a Dispose method), but in the meantime you can add the following to your BitmapFont.Dispose:&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;m_sb.Dispose();&lt;BR&gt;m_sb = null;&lt;BR&gt;foreach (KeyValuePair&amp;lt;int,Texture2D&amp;gt; kv in m_dictBitmapID2Texture)&lt;BR&gt;&amp;nbsp;&amp;nbsp; kv.Value.Dispose();&lt;BR&gt;m_dictBitmapID2Texture = null;&lt;/FONT&gt;&lt;/EM&gt;&lt;EM&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/EM&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;After that, you should be ready to Reset. Let me know if you have any further problems and t&lt;/FONT&gt;&lt;/EM&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;hanks for pointing it out!&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;-GaryKac]&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#750473</link><pubDate>Tue, 12 Sep 2006 16:05:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:750473</guid><dc:creator>Stuart</dc:creator><description>regarding bitmap fonts, before finding this post I actually wrote a a very basic windows tool and XNA game object which allows one to drop/set and forget text onto a window, if anyone is interested it can be found on &lt;a rel="nofollow" target="_new" href="http://www.stuangel.com"&gt;http://www.stuangel.com&lt;/a&gt; under the XNA link, I have also included a full tutorial on setting it up and a 4 line modification to a standard application to display text.
&lt;br&gt;
&lt;br&gt;Best regards
&lt;br&gt;
&lt;br&gt;Stu</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#751349</link><pubDate>Wed, 13 Sep 2006 03:22:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:751349</guid><dc:creator>Matt Moore</dc:creator><description>&lt;P&gt;Still getting the surface error. I'm not sure what else needs disposing. &lt;BR&gt;&lt;BR&gt;Just to make sure i have: &lt;BR&gt;&lt;BR&gt;//handlers for device events &lt;BR&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;device.DeviceLost += delegate { this.UnloadResources(); }; &lt;BR&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;device.DeviceReset += delegate { this.LoadResources(device); }; &lt;BR&gt;&lt;BR&gt;Then: &lt;BR&gt;&lt;BR&gt;private void LoadResources(GraphicsDevice device) &lt;BR&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{ &lt;BR&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//set anisotropic filter &lt;BR&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;InitAnisotropy(); &lt;BR&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;debugFont.Reset(device); &lt;BR&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} &lt;BR&gt;&lt;BR&gt;private void UnloadResources() &lt;BR&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{ &lt;BR&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;debugFont.Dispose(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;BR&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} &lt;BR&gt;&lt;BR&gt;Is this correct?&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;[I don't see any problems with what you've posted.&amp;nbsp; Can you create a small example project that exhibits the problem and send it to me? I suspect something else is going on but I can't tell from the snippets.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;-GaryKac]&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#763579</link><pubDate>Wed, 20 Sep 2006 14:30:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:763579</guid><dc:creator>Johan Hiemstra</dc:creator><description>&lt;P&gt;Hi, &lt;BR&gt;&lt;BR&gt;Thanks for sharing this! I really like the custom glyph option because it allows me to create my own custom 'Photoshopped' fonts instead of creating a separate bitmap for words like Game Over and Score :) &lt;BR&gt;&lt;BR&gt;I've been using it for a couple of days now and everything worked fine. I just tried to 'publish' my 2d shooter and I got an filenotfound exception. After doing some digging (I'm new to C# express) &amp;nbsp;I found that the .xml file is not copied to directory: &lt;BR&gt;shoo..tion_05bd4a2781ef8435_0001.0000_9c1bafe256fc38bb &lt;BR&gt;but is copied to: &lt;BR&gt;shoo...exe_05bd4a2781ef8435_0001.0000_none_4341aed75d4629b4 &lt;BR&gt;&lt;BR&gt;When I copy the XML file from the exe to the tion directory it manually after installing the published version, it works fine. I have the xml and png file set to "Content" and "Copy always". The other images in the game, with the same settings, show up in both directories. &lt;BR&gt;&lt;BR&gt;I'm guessing I'm just doing something very wrong, but I noticed some comments about the filepath in your other topic, so I was hoping you could clear this up, or maybe even, if appropriate, change the class to avoid this. &lt;BR&gt;&lt;BR&gt;Thanks again!&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;[I don't do anything magical with the files - I just expect them to be copied to the correct location (and to be given a path to that location). If they're not being copied, then there must be something screwy with the copy. However, it doesn't sound like you're doing anything wrong.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;One suggestion I have is to create a new project, add the art assets and then make sure that they're being copied over correctly. If they copy properly in the new project, then add all your source code and replace your old project with new one.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;Yes, this technically shouldn't do anything, but I needed to do this once to "fix" a truly unfathomable problem I was encountering a week or so ago.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;If you're still having problems with the "new project" version, then let me know.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;-GaryKac]&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#765353</link><pubDate>Fri, 22 Sep 2006 02:58:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:765353</guid><dc:creator>Matt Moore</dc:creator><description>&lt;P&gt;Hey thanks for your help with my "problem." Turns out that it was bad drivers screwing it up. Love the bitmap font generator. &amp;nbsp;Thanks a bunch.&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;[I'm glad that you got it working. -GaryKac]&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description></item><item><title>re: Creating and using bitmap fonts in XNA</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#765398</link><pubDate>Fri, 22 Sep 2006 03:46:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:765398</guid><dc:creator>Matt Moore</dc:creator><description>&lt;P&gt;Oh and one more thing. &amp;nbsp;If you don't put the font files in a seperate directory, the class looks for the font file name in the "c:/: drive root instead of the root in the "bin/debug" folder. &lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;[You're right. It will find the XML file, but will look in the wrong directory for the PNG image files. I'll include a fix in this weekend's release. Thanks!&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;-Gary]&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description></item><item><title>Andys Blog &amp;raquo; XNAInvaders update</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#1179653</link><pubDate>Fri, 01 Dec 2006 01:30:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1179653</guid><dc:creator>Andys Blog » XNAInvaders update</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://andyq.no-ip.com/blog/?p=18"&gt;http://andyq.no-ip.com/blog/?p=18&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>《XNA高级编程：Xbox 360和Windows》4-4</title><link>http://blogs.msdn.com/garykac/archive/2006/08/30/728521.aspx#8424140</link><pubDate>Fri, 25 Apr 2008 17:26:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8424140</guid><dc:creator>JulioZou</dc:creator><description>&lt;p&gt;《XNA高级编程：Xbox 360和Windows》第四章第四小节：更多辅助类&lt;/p&gt;
</description></item></channel></rss>