Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How do i load a font correctly?  (Read 2212 times)

0 Members and 1 Guest are viewing this topic.

Assassinbeast

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
    • Email
How do i load a font correctly?
« on: December 09, 2013, 11:55:07 pm »
Hi.

When i deploy my project in VS2012 Professional, the content in my game will get generated into .DEPLOY files, however, the ttf files for fonts will not get generated. So im getting an error when i try to install and play my game. (See the Attachments).

Right now in my code, i just write something like

                       
Font arial = new Font(@"Content\arial.ttf");
Text text = new Text("Hello", arial);
 

Also, in my project, i have deleted the Output path so it will look and load from the bottom of the project.
Everything works fine, its just when i deploy, it will give me an error about the missing ttf file.

I hope somebody knows how to solve it :-)

Thanks
« Last Edit: December 10, 2013, 12:15:20 am by Assassinbeast »

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: How do i load a font correctly?
« Reply #1 on: December 10, 2013, 03:24:54 am »
Visual Studio has a "Copy to Output Directory" property that you should be able to change for your font and the other content you want to use to make sure that they are present when your program looks for them.
DSFML - SFML for the D Programming Language.

Assassinbeast

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
    • Email
Re: How do i load a font correctly?
« Reply #2 on: December 10, 2013, 01:26:05 pm »
Yes, i have set it to "Copy always", but it still doesn't show up  :-\