Crystal Space
Welcome, Guest. Please login or register.
September 20, 2014, 09:07:35 am

Login with username, password and session length
Search:     Advanced search
9018 Posts in 2051 Topics by 8487 Members
Latest Member: Car1m3cet
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Problem about loading a ttf font
« previous next »
Pages: [1] Print
Author Topic: Problem about loading a ttf font  (Read 1909 times)
ArKangeL
Newbie
*
Posts: 11


View Profile
« on: September 29, 2005, 04:30:54 pm »

Hi all

Im trying to load a ttf font that i downloaded from internet.

Well i put the font on my c:\CS\data\fonts\font.ttf, C:\CS is the main directory for Crystal Space.

The code i put is this:

Code:

  FSrv = g2d->GetFontServer();
Font = g2d->GetFontServer()->LoadFont("/font/cantebriggia.ttf",14);


and the aplication crash in line 403 of the file 'glfontcache.cpp' with this debug data:

>   glwin32.dll!csGLFontCache::WriteString(iFont * font=0x00000000, int pen_x=200, int pen_y=200, int fg=16711680, int bg=-1, const unsigned char * text=0x0012fc34, unsigned int flags=0)  Line 403 + 0xb   C++

i can see that pointer CANT be 0x00, so i think that font dosent load in a correct mode, so whats wrong with this ? I need to reformat the ttf font to a CSF format ?

Thx for all

ARKANGEL
Logged
sunshine
Administrator
Sr. Member
*****
Posts: 294


View Profile
« Reply #1 on: September 29, 2005, 04:49:13 pm »

First, you're mixing spelling in the path names: 'fonts' vs. 'font'.

Second, vfs.cfg doesn't contain any mount for the directory into which you placed the ttf file, so the VFS path you specified simply doesn't exist. You could probably create a directory named CS/data/ttf and place your TTF font there. If you look in vfs.cfg, you will see that it does mount $@data$/ttf$/ onto the VFS path /fonts/ttf. You would then LoadFont("/fonts/ttf/myfont.ttf",...)

You can use the 'vsh' program to browse the virtual filesystem provided by VFS. Use this program to make sure that the VFS path you are passing to LoadFont() is actually valid.
Logged
ArKangeL
Newbie
*
Posts: 11


View Profile
« Reply #2 on: September 30, 2005, 09:55:28 am »

Hi all

Well 'vsh' its a great tool, i use it to see if my downloaded font its there, and yes, now its there.

Its located in

Real path = C:\CS\data\ttf\
Virtual path = \fonts\ttf\

and i write this code to load the ttf font:

Code:
FSrv = g2d->GetFontServer();
Font = g2d->GetFontServer()->LoadFont("/fonts/ttf/cantebriggia.ttf",10);

and still crashing with the same problem in the first post, the pointer to the ttf font is 0x00, whats can be wrong ?

Thx to all

ARKANGEL
Logged
ArKangeL
Newbie
*
Posts: 11


View Profile
« Reply #3 on: September 30, 2005, 11:26:48 am »

Hi all

Now im trying to convert the font due to the last crash, in this intent i try to convert TTF font to CS format with CSFGEN.EXE program, so i put the ttf font in the same directory where csfgen is and execute it:

> csfgen.exe -v font.ttf

The output of this program is:

C:\CS>csfgen.exe -v incantat.ttf
Loading font incantat.ttf, size = -1
Could not open fontfile incantat.ttf!
Cannot load font file incantat.ttf

May be my app crash due to system can't open the ttf file, but with windows font viewer i can see the font file, i tryed this with 2 font files and recive the same output with 'csfgen.exe'

What can be worng ?

Thx for all

ARKANGEL
Logged
sunshine
Administrator
Sr. Member
*****
Posts: 294


View Profile
« Reply #4 on: September 30, 2005, 11:39:53 am »

Are you loading the correct font server? If you use the wrong font server -- one which doesn't know how to load TTF fonts -- then it would make sense for it to fail to load your font. You probably want to use either the crystalspace.font.server.freetype2 or crystalspace.font.server.multiplexer server. You do not want to use the crystalspace.font.server.default server if you are trying to load a TTF font.

As for csfgen, it appears that it expects you to specify the input file using a VFS pathname, not a "real" pathname.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.511 seconds with 16 queries.