Font scripts not loading

Problems building or running the engine, queries about how to use features etc.
Post Reply
jakeholes
Gnoblar
Posts: 3
Joined: Tue Jun 26, 2018 6:33 pm

Font scripts not loading

Post by jakeholes »

Ogre Version: :?: 1.11
Operating System: :?: fedora 27
Render System: :?: GL

Right now I'm having trouble with font scripts not being recognized as font resources. I'm trying to load in font scripts from a directory using

Code: Select all

		Ogre::ResourceGroupManager &resgroup = Ogre::ResourceGroupManager::getSingleton();
		Ogre::FontManager &fontMan = Ogre::FontManager::getSingleton();
		fontMan.setVerbose(true);
                resgroup.addResourceLocation(font_dir, "FileSystem", "DspaceOgre-fonts", true);
		resgroup.initialiseResourceGroup("DspaceOgre-fonts");
In the font_dir there are .fontdef and .tff files. When I query the ResourceGroupManger for the names of resources in this group, it prints out things like proportional.fontdef and proportional.tff but doesn't recognize that these are fonts. Furthermore the FontManager doesn't recognize that any of these resources even exist. When I try loading a font resource later on the program crashes because they don't seem to have registered anywhere. Any help would be greatly appreciated.

Here is the bottom section of my log output:

Code: Select all

******************************
*** Starting GLX Subsystem ***
******************************
GLX_VERSION = 1.4
GLX_EXTENSIONS = GLX_ARB_get_proc_address GLX_ARB_multisample GLX_EXT_visual_info GLX_EXT_visual_rating GLX_EXT_import_context GLX_SGI_video_sync GLX_NV_swap_group GLX_NV_video_out GLX_SGIX_fbconfig GLX_SGIX_pbuffer GLX_SGI_swap_control GLX_EXT_swap_control GLX_EXT_swap_control_tear GLX_EXT_buffer_age GLX_ARB_create_context GLX_ARB_create_context_profile GLX_NV_float_buffer GLX_ARB_fbconfig_float GLX_EXT_fbconfig_packed_float GLX_EXT_texture_from_pixmap GLX_EXT_framebuffer_sRGB GLX_NV_present_video GLX_NV_copy_image GLX_NV_copy_buffer GLX_NV_multisample_coverage GLX_NV_video_capture GLX_EXT_create_context_es_profile GLX_EXT_create_context_es2_profile GLX_ARB_create_context_no_error GLX_ARB_create_context_robustness GLX_NV_delay_before_swap GLX_EXT_stereo_tree GLX_ARB_context_flush_control GLX_NV_robustness_video_memory_purge 
Registering ResourceManager for type Texture
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
CPU Identifier & Features
-------------------------
 *   CPU ID: GenuineIntel: Intel(R) Xeon(R) CPU E5-2630 0 @ 2.30GHz
 *          SSE: yes
 *         SSE2: yes
 *         SSE3: yes
 *        SSE41: yes
 *        SSE42: yes
 *          MMX: yes
 *       MMXEXT: yes
 *        3DNOW: no
 *     3DNOWEXT: no
 *         CMOV: yes
 *          TSC: yes
 *INVARIANT TSC: yes
 *          FPU: yes
 *          PRO: yes
 *           HT: no
-------------------------
******************************
*** Starting GLX Subsystem ***
******************************
GLX_VERSION = 1.4
GLX_EXTENSIONS = GLX_ARB_get_proc_address GLX_ARB_multisample GLX_EXT_visual_info GLX_EXT_visual_rating GLX_EXT_import_context GLX_SGI_video_sync GLX_NV_swap_group GLX_NV_video_out GLX_SGIX_fbconfig GLX_SGIX_pbuffer GLX_SGI_swap_control GLX_EXT_swap_control GLX_EXT_swap_control_tear GLX_EXT_buffer_age GLX_ARB_create_context GLX_ARB_create_context_profile GLX_NV_float_buffer GLX_ARB_fbconfig_float GLX_EXT_fbconfig_packed_float GLX_EXT_texture_from_pixmap GLX_EXT_framebuffer_sRGB GLX_NV_present_video GLX_NV_copy_image GLX_NV_copy_buffer GLX_NV_multisample_coverage GLX_NV_video_capture GLX_EXT_create_context_es_profile GLX_EXT_create_context_es2_profile GLX_ARB_create_context_no_error GLX_ARB_create_context_robustness GLX_NV_delay_before_swap GLX_EXT_stereo_tree GLX_ARB_context_flush_control GLX_NV_robustness_video_memory_purge 
Registering ResourceManager for type Texture
Added resource location '/home/atbe/dev/users/jholesinger/OgreStandalone/src/DspaceOgre/ogre_11_fonts' of type 'FileSystem' to resource group 'DspaceOgre-fonts' with recursive option
Initialising resource group DspaceOgre-fonts
Font proportional has existence: 0
List size: 0
Names size: 7
ResourceName: proportional-serif.fontdef
ResourceName: proportional.ttf
ResourceName: proportional-serif.ttf
ResourceName: monospaced.ttf
ResourceName: proportional.font
ResourceName: proportional.fontdef
ResourceName: monospaced.fontdef

paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Font scripts not loading

Post by paroj »

can you give an example how your font definitions look like?

note that there were some changes to the format in 1.11 with the new format being:
https://ogrecave.github.io/ogre/api/lat ... ripts.html

there are fallbacks in place that should generate warnings for the old format, but maybe something is broken there..
jakeholes
Gnoblar
Posts: 3
Joined: Tue Jun 26, 2018 6:33 pm

Re: Font scripts not loading

Post by jakeholes »

Thank you that was part of the problem. I was also calling initialise on the resources before the OverlaySystem was being initialised which was also keeping the fonts from loading. Now I see it parsing the scripts and treating the resources as fonts but I now have the odd bug that Ogre is trying to create the resources twice.
When I comment out Ogre::ResourceGroupManager::getSingletonPtr()->initialiseAllResourceGroups(); I get the error that when calling FontManager::getByName("proportional") that the Font Manager returns null having not found the resource. However, when I leave this line I get the error "Resource with name "proportional" already exists" suggesting that this is the second time the resource has been initialised. Do you have any ideas off the top of your head?
I've recreated this duplicate initialization error in a standalone test case by initializing a FontManager before calling initialiseAllResourceGroups. Removing the FontManager initialization fixed it however and I don't initialise the FontManger in the applicaiton I'm working on.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Font scripts not loading

Post by paroj »

most likely you indeed have "proportional" defined twice somewhere. Try running "grep proportional -R ." in your resource folder.

The font manager is initialized by the Overlay system.
jakeholes
Gnoblar
Posts: 3
Joined: Tue Jun 26, 2018 6:33 pm

Re: Font scripts not loading

Post by jakeholes »

I found my problem. For some reason when using FontManager::getByName, getByName("name") would always return null but if I also specified the group name with getByName("name", "resource group name") it would find the resource.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Font scripts not loading

Post by paroj »

yes, by default ogre look in the "General" resource group, while your fonts are in "DspaceOgre-fonts"
Post Reply