|
|
|
|||||||
| Development Discussions All developers who are coding games may stop by here for any help, suggestions, and everything development related. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Jr. Zuner
Join Date: May 2008
Posts: 38
Reputation: 37
Donate |
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!
|
|
|
|
| Remove Advertisements Sponsored Links | |
Advertisement |
|
|
|
#2 (permalink) |
|
Jr. Member
Join Date: May 2008
Location: Seattle, WA
Posts: 398
Reputation: 60
Donate |
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.
|
|
|
|
|
|
#3 (permalink) |
|
zB Programmer
Experienced Member Join Date: Mar 2007
Posts: 950
Reputation: 107
Donate |
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.
|
|
|
|
|
|
#4 (permalink) | |
|
Jr. Zuner
Join Date: May 2008
Posts: 38
Reputation: 37
Donate |
Quote:
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!
|
|
|
|
|
|
|
#5 (permalink) |
|
Jr. Member
Join Date: May 2008
Posts: 325
Reputation: 90
Donate |
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. |
|
|
|
|
|
#8 (permalink) | |
|
zB Programmer
Experienced Member Join Date: Mar 2007
Posts: 950
Reputation: 107
Donate |
Quote:
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.
|
|
|
|
|
|
|
#9 (permalink) |
|
Jr. Member
Join Date: May 2008
Location: Seattle, WA
Posts: 398
Reputation: 60
Donate |
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.
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.
|
|
|
|
|
|
#10 (permalink) |
|
An army of many
zB Programmer Jr. Member Join Date: May 2008
Posts: 474
Reputation: 91
Donate |
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.
|
|
|
|
![]() |
| Thread Tools | |
|
|
| |