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

Author Topic: Fonts not loading  (Read 5494 times)

0 Members and 1 Guest are viewing this topic.

bucknasty189

  • Newbie
  • *
  • Posts: 23
    • View Profile
Fonts not loading
« on: May 23, 2011, 07:20:26 am »
Ok, this is wierd. Images and sounds both load fine. Fonts fail to load. I've tried the same font in another project and it loads fine. So confused...
Knowledge Speaks,
Wisdom Listens
                       -JH

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Fonts not loading
« Reply #1 on: May 23, 2011, 12:43:34 pm »
Post some code. Are you sure paths and stuff are set up correctly? Is the font file *really* where you think it is? I fell over that one...   :roll:
SFML 2.1

Relic

  • Newbie
  • *
  • Posts: 43
    • View Profile
Fonts not loading
« Reply #2 on: May 23, 2011, 01:04:55 pm »
Are you sure you really cant load the font? May be you are trying to use a temporary instance of a successfully loaded font in an instance of a text that lives longer than the font it refers to.

bucknasty189

  • Newbie
  • *
  • Posts: 23
    • View Profile
Fonts not loading
« Reply #3 on: June 14, 2011, 12:37:15 am »
Sorry I took so long to reply. The path is definitely correct, I'm using the AssetManager from the GameEngine tutorial and it loads fonts and sounds fine, but fonts are giving me a problem. They load in a simple main() context, but it says it cannot find the resource when I use the LoadFont() function.

This error message is from SFML, not from in the AssetManager. You can view the source at
http://www.sfml-dev.org/wiki/en/sources/gqe_en#assetmanager.cpp

Here's the line that produces the error.
Code: [Select]

m_Game->m_AssetManager.AddFont("CheeseBurger", "../data/fonts/cheeseburger.tff", AssetLoadStyleImmediate);
[/url]
Knowledge Speaks,
Wisdom Listens
                       -JH

GatorQue

  • Newbie
  • *
  • Posts: 36
    • View Profile
Fonts not loading
« Reply #4 on: June 14, 2011, 05:49:08 am »
I had the same problem recently testing my GQE v0.7 update and discovered that it was related to SFML 2.0.  I need to investigate further to see if I can figure out why, I think there was something wrong with linking against the 2.0 libraries I made.  I'll see if I can figure it out over the next couple of days and get back to you.  The error I got was an Access Violation using Windows 7 and Visual Studio 2008 and shared libraries.

-Ryan

Quote from: "bucknasty189"
Sorry I took so long to reply. The path is definitely correct, I'm using the AssetManager from the GameEngine tutorial and it loads fonts and sounds fine, but fonts are giving me a problem. They load in a simple main() context, but it says it cannot find the resource when I use the LoadFont() function.

This error message is from SFML, not from in the AssetManager. You can view the source at
http://www.sfml-dev.org/wiki/en/sources/gqe_en#assetmanager.cpp

Here's the line that produces the error.
Code: [Select]

m_Game->m_AssetManager.AddFont("CheeseBurger", "../data/fonts/cheeseburger.tff", AssetLoadStyleImmediate);
[/url]

GatorQue

  • Newbie
  • *
  • Posts: 36
    • View Profile
Fonts not loading
« Reply #5 on: June 14, 2011, 02:25:32 pm »
I have reviewed the SFML 2.0 code and can't find anything obviously wrong with the LoadFromFile method in the Font class.  I will create a Visual Studio project that uses SFML 2.0 and this font and see if I can find out which line is causing the Access Violation I saw when calling this method.  If anything, its a problem with FreeType 2 that SFML is using, or its libraries.

Doing a Google search yielded an interesting comment on the Ogre forums where someone said the inability to load a font in FreeType 2 was related to having current Video Drivers, the person who posted the question was trying to run his program over a Remote Desktop connection and when he ran it locally everything was fine.  That's not the case with me, so I'm not sure yet what might be wrong yet.  I'll keep digging.

-Ryan

GatorQue

  • Newbie
  • *
  • Posts: 36
    • View Profile
Fonts not loading
« Reply #6 on: June 15, 2011, 01:42:48 pm »
I created a simple SFML 2.0 project with the example from the first page of the SFML documentation that loads the arial.ttf font and didn't repeat the problem.  At this point I think there must be something that happened during the linking of GQE and SFML 2.0 and my demo example.  Can you tell me what you were linking against?  Dynamic or Static Libraries for SFML and Dynamic or Static Libraries for GQE?  It might help me recreate the issue.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Fonts not loading
« Reply #7 on: June 15, 2011, 01:46:52 pm »
You should also check the CRT settings, mixing static and DLL CRTs can lead to strange behaviours. The default value for SFML changed a few weeks ago, so maybe there are two different versions (one with static CRT and one with DLL CRT) linked to the same project.
Laurent Gomila - SFML developer

bucknasty189

  • Newbie
  • *
  • Posts: 23
    • View Profile
Fonts not loading
« Reply #8 on: June 23, 2011, 05:55:17 am »
Sorry for the late reply, I've been extremely busy finishing up this project for school. I'm not actually using the entire GQE as a library, just your asset manager and asset classes in my own project of which I've made a few changes, but I've changed nothing to the font asset or any font functions.  Also, I'm using SFML 1.6's dynamic libraries.
Knowledge Speaks,
Wisdom Listens
                       -JH

GatorQue

  • Newbie
  • *
  • Posts: 36
    • View Profile
Fonts not loading
« Reply #9 on: June 23, 2011, 01:50:46 pm »
Thanks for the reply, hope your project went well, I'm in school too so I know how you feel.  I have made some changes to GQE, especially in how it links.  I haven't been able to recreate the problem you and I experienced recently, but with the information you have provided I will give it another try.  You may want to look very carefully at how your compiling the standard libraries, there might be something to what Laurent says about linking against static vs dynamic standard libraries.

 

anything