Sponsors

Go Back   Zune Boards > Zune Discussions > Zune Games > Development Discussions

New Member?


Register Zunecentive FAQ Members List Calendar Search Today's Posts Mark Forums Read

Development Discussions All developers who are coding games may stop by here for any help, suggestions, and everything development related.

Reply
 
LinkBack Thread Tools
Old 06-29-2008, 10:17 AM   #1 (permalink)
Jr. Zuner
 
CouchPotato99's Avatar
 
Join Date: May 2008
Posts: 38
Reputation: 37
$zB: 35
Donate
Default [SOLVED] Precompiled fonts?

So I have text-based menus in my game, but I really would like to avoid all of the issues that come from using fonts. I've looked at some other games' code (SIR TET and Scrambled Albums, to be specific) and they use precompiled fonts. How does one do this? I assume you take the XNB file that you get from your font when you build your solution. However, if I just try and import that file as the spritefont it doesn't work. Any help is appreciated. Thanks!



CouchPotato99 is offline   Reply With Quote
Remove Advertisements Sponsored Links
Advertisement
 
Old 06-29-2008, 11:34 AM   #2 (permalink)
Jr. Member
 
SimReality's Avatar
 
Join Date: May 2008
Location: Seattle, WA
Posts: 398
Reputation: 60
$zB: 341
Donate
Default

That's close. I followed this post by Shawn Hargreaves on embedding resources: http://blogs.msdn.com/shawnhar/archi...resources.aspx. Then it just sticks all the XNB files into the game's EXE and loads them from there. It's great because then I can use any font I want and not worry about every user having it.
__________________
Nick Gravelyn
Microsoft MVP - DirectX/XNA

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



SimReality is offline   Reply With Quote
Old 06-29-2008, 12:14 PM   #3 (permalink)
zB Programmer
Experienced Member
 
LedZepp's Avatar
 
Join Date: Mar 2007
Posts: 950
Reputation: 107
$zB: 610
Donate
Default

Create the spritefont file with whatever font you want, deploy your game to your zune, then go to

your Documents folder>Visual Studio 2008>Projects>Your Project>The Bin folder>Zune> Debug or Release(Whichever you deployed)>Content folder

There you will find the .xnb file of your spritefont file. Go into your project in visual studio, delete the SpriteFont file from your content folder and just drag the .xnb file in its place, you dont need to change anything else.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



LedZepp is offline   Reply With Quote
Old 06-29-2008, 12:59 PM   #4 (permalink)
Jr. Zuner
 
CouchPotato99's Avatar
 
Join Date: May 2008
Posts: 38
Reputation: 37
$zB: 35
Donate
Default

Quote:
Originally Posted by LedZepp View Post
Create the spritefont file with whatever font you want, deploy your game to your zune, then go to

your Documents folder>Visual Studio 2008>Projects>Your Project>The Bin folder>Zune> Debug or Release(Whichever you deployed)>Content folder

There you will find the .xnb file of your spritefont file. Go into your project in visual studio, delete the SpriteFont file from your content folder and just drag the .xnb file in its place, you dont need to change anything else.
Okay, I've done that, no problem. But when I try to build the solution, I get this error: "Cannot autodetect which importer to use for "Blue\Fonts\normal.xnb". There are no importers which handle this file type. Specify the importer that handles this file type in your project."

I'm trying to load the font with this code:
normal = Content.Load<SpriteFont>("Blue/Fonts/normal");

What am I missing? Thanks for your help!



CouchPotato99 is offline   Reply With Quote
Old 06-29-2008, 01:06 PM   #5 (permalink)
Jr. Member
 
The Undead's Avatar
 
Join Date: May 2008
Posts: 325
Reputation: 90
$zB: 8
Donate
Default

click on the .xnb in the explore part of your project. look below it, were it says Build Action change it from Compile to None
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



The Undead is offline   Reply With Quote
Old 06-29-2008, 01:28 PM   #6 (permalink)
Jr. Zuner
 
CouchPotato99's Avatar
 
Join Date: May 2008
Posts: 38
Reputation: 37
$zB: 35
Donate
Smile

Quote:
Originally Posted by The Undead View Post
click on the .xnb in the explore part of your project. look below it, were it says Build Action change it from Compile to None
That did the trick! I also had to set the "Copy to Output Directory" to "Copy Always", and now it's working like a charm. Thanks for the help, all!



CouchPotato99 is offline   Reply With Quote
Old 06-29-2008, 02:27 PM   #7 (permalink)
Zuner
 
xjakehxbabehx's Avatar
 
Join Date: Jun 2007
Posts: 51
Reputation: 10
$zB: 11
Donate
Default

just make sure the font is allowed to be shared freely to others users =]
__________________
pink zune,
30gig,
1379 songs,
437 videos,
1893 pictures



xjakehxbabehx is offline   Reply With Quote
Old 06-29-2008, 04:29 PM   #8 (permalink)
zB Programmer
Experienced Member
 
LedZepp's Avatar
 
Join Date: Mar 2007
Posts: 950
Reputation: 107
$zB: 610
Donate
Default

Quote:
Originally Posted by xjakehxbabehx View Post
just make sure the font is allowed to be shared freely to others users =]
Nick feel free to correct me but,
As long as its compiled, users cant touch it, users dont have to install anything on your computer, and you arent providing any download links to the font or including the real font with the game. So you can technically use any font you want.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



LedZepp is offline   Reply With Quote
Old 06-29-2008, 08:23 PM   #9 (permalink)
Jr. Member
 
SimReality's Avatar
 
Join Date: May 2008
Location: Seattle, WA
Posts: 398
Reputation: 60
$zB: 341
Donate
Default

It's a gray area and one I'm not knowledgeable enough to say with certainty. Some people claim that since you can technically use that compiled font to generate new text, that it is subject to licensing. However others claim it more like printing a piece of paper where it's no longer in "font" form. I honestly don't know the answer there so ask a lawyer or look it up if you are concerned.

Quote:
Originally Posted by CouchPotato99 View Post
That did the trick! I also had to set the "Copy to Output Directory" to "Copy Always", and now it's working like a charm. Thanks for the help, all!
It's better to just say "Copy if Newer" that way it will only copy if the file changes. Otherwise you'll just keep copying the file each time you build which, though quick, is still time wasted.
__________________
Nick Gravelyn
Microsoft MVP - DirectX/XNA

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



SimReality is offline   Reply With Quote
Old 07-01-2008, 12:44 PM   #10 (permalink)
An army of many
zB Programmer
Jr. Member
 
itsnotabigtruck's Avatar
 
Join Date: May 2008
Posts: 474
Reputation: 91
$zB: 329
Donate
Awards Showcase
Best New Member 
Total Awards: 1
Default

To the best of my knowledge (IANAL TINLA), you're free and clear as long as you don't distribute the actual font file. A spritefont contains bitmapped versions of each character in the original font, and bitmapped characters can't be copyrighted.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



itsnotabigtruck is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -8. The time now is 12:40 AM.

 
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC8
vB Ad Management by =RedTyger=
(C) ZuneBoards 2006-2007