Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411582 Posts in 69386 Topics- by 58445 Members - Latest Member: Mansreign

May 06, 2024, 01:17:30 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Font Problems
Pages: [1]
Print
Author Topic: Font Problems  (Read 4193 times)
TastyGhost
Level 0
*


View Profile
« on: June 28, 2009, 01:25:30 PM »

I've been stuck on something for a while now and I still can't figure this out. I make a title screen with a font that is on my laptop, then I send it to my desktop(That doesn't have the font) with my flashdrive, and the font for the title becomes arial. I want to be able to use other fonts so I went to Control Panel -> Fonts, then copied that font into a folder next to the game, and tried it again after transfering it. There was the same problem. I think I need to use a code that will tell the program to use the font in that folder that came with the program.

The code I use to get any font currently is,
Font fntDestine50 = new Font("AR DESTINE", Font.BOLD, 50);

I think I might need to use something like getFont() but I don't know how that works.
I'm using java to make the game with the jdk1.6.0_13

Edit:
I was able to get the font to work by copying it into where the fonts are located on the computer. Unfortunatly this doesn't help me because noone is going to go out of there way to do that  Sad
« Last Edit: June 28, 2009, 05:36:17 PM by Trabon » Logged
David Pittman
Level 2
**


MAEK GAEM


View Profile WWW
« Reply #1 on: June 29, 2009, 10:25:32 AM »

Maybe something like this? http://msdn.microsoft.com/en-us/library/system.drawing.text.privatefontcollection.addfontfile.aspx

Be careful distributing loose font files with your game, unless you're 100% sure it's legal (e.g., you made the font yourself). Fonts are usually not licensed for distribution, and you should find a different way to use it. At the very least, embed it in your .exe so it's harder to get at, but that's still legally murky.
Logged

TastyGhost
Level 0
*


View Profile
« Reply #2 on: June 29, 2009, 12:30:05 PM »

The fonts I'm using came with my laptop so I don't think there is any legal issues with them. Just that older computers such as my desktop do not have them. Also I refuse to believe that any game that uses text doesnt have the ability to store any fonts so that older computers without the font can still run them. Thats like saying every game Must use Times New Roman and Arial to be sure to work on every computer.

although I could trace out every letter as a polygon or two, then save xy ints as data, because the time I used trying to figure this out I would've been done with that by now.

Edit:

Anyways I have changed most of the things in my game to fit the Eurostile font (just some resizing). Can a few people check to make sure that that font is available on their comps, I want to make sure I use a font that is universally available.
« Last Edit: June 29, 2009, 12:43:29 PM by Trabon » Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #3 on: June 29, 2009, 12:44:43 PM »

It's been a while since I've done Java, but I'm pretty sure there is a way to include resources such as fonts in the jar file that you are presumably distributing.

This would be the way to go, since it would avoid the platform-specific Microsoft solution posted above, and should work on any system with a JVM.
Logged



What would John Carmack do?
Ina Vegt
Level 1
*


Girl Game Developer


View Profile
« Reply #4 on: June 29, 2009, 01:26:07 PM »

The fonts I'm using came with my laptop so I don't think there is any legal issues with them. Just that older computers such as my desktop do not have them. Also I refuse to believe that any game that uses text doesnt have the ability to store any fonts so that older computers without the font can still run them. Thats like saying every game Must use Times New Roman and Arial to be sure to work on every computer.

Well, there is a legal issue.

These fonts are copyrighted to Microsoft, they have not granted you a license to distribute. If you want to include a font, I suggest you look at free fonts or getting a license for a font.
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #5 on: June 29, 2009, 01:42:05 PM »

The articles I'm using came with my newspaper so I don't think there is any legal issues with them. Just that other newspapers do not have them.
Yeah, problem. Games can distribute fonts that they have the right to distribute. This usually costs money, or requires an artist, or at least someone generous. It's exactly the same as any other asset, hence the articles example.
Logged
Draknek
Level 6
*


"Alan Hazelden" for short


View Profile WWW
« Reply #6 on: June 29, 2009, 02:48:35 PM »

What people are saying is that it's illegal to distribute most fonts by packaging them with your game. It's perfectly allowable to try to use a font if it is already installed on someone's computer, because then you're not distributing the font.

What you probably want to do is find a font that it is legal to redistribute, and then include that with your game, loading it at runtime from a known location.

It looks like to do that you want to use the Font.createFont method. That creates a Font object from either a File or an InputStream.
« Last Edit: June 29, 2009, 02:53:56 PM by Draknek » Logged

TastyGhost
Level 0
*


View Profile
« Reply #7 on: June 29, 2009, 02:53:35 PM »

Sounds like you want to use the Font.createFont method.

Creates a Font object from either a File or an InputStream.

Ok thanks I'll look into it.

Edit:
OK I got this to work, and it has helped so much. Don't worry about the legal issues with the fonts I'm using, all of the fonts I'm using are available for free comercial and non-comercial use. (I checked the readme's from the artists that made the fonts from the site I got them)

BTW thanks for your help, and my game should be done in a month or 2, I still have a little bit of bugs to work out, but I can handle them on my own. You guys rock.
« Last Edit: June 29, 2009, 03:58:47 PM by Trabon » Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic