nanogui: Using own true type font with Nano-X


Previous by date: 28 Sep 2006 14:19:24 +0100 Creating thumbnails of images and videos, pratish ganguly
Next by date: 28 Sep 2006 14:19:24 +0100 Re: Finding out width of a text string in terms of pixels, tj
Previous in thread: 28 Sep 2006 14:19:24 +0100 Re: Using own true type font with Nano-X, Martin Kajdas
Next in thread: 28 Sep 2006 14:19:24 +0100 Re: Using own true type font with Nano-X, Greg Haerr

Subject: RE: [nanogui] Using own true type font with Nano-X
From: Kiran Mahajan ####@####.####
Date: 28 Sep 2006 14:19:24 +0100
Message-Id: <1159450463.3404.24.camel@KiranLinux>

hi Martine,
Sorry but i couldn't find loadfont routine you said me!
but i am sending the changes i have made in "fontdemo.c" file for
debugging purpose along with the output i am getting. 
The GrGetFontList() is showing my fonts (dvsr0ntt.ttf and DVWSR0NT.TTF).
Please have a look and tell me what would be the problem?

*********************************************************************
static void
do_paint(GR_EVENT_EXPOSURE *ep)
{
	int	i, y = 0;

	//for (i=3; i<=30; ++i) {
		GR_FONT_INFO	info;
		unsigned char		buf[64];
//Kiran's additions
		GR_FONTLIST	**fontlist;
		int		nofonts;
		
		GrGetFontList(&fontlist, &nofonts);

		for(i=0; i<nofonts; i++)
		{
			printf("%d> TTF name: %s, MW name: %s\n", (i+1), fontlist[i]->ttname,
fontlist[i]->mwname);
		}

		GrFreeFontList(&fontlist, nofonts);
//end Kiran's additions

		font = GrCreateFont(FONTNAME, 20, NULL);

//Kiran's addition
		printf("\nValue of font: %d\n", font);
		
		GrGetFontInfo(font, &info);
		printf("\nFont Info..........\n");
		printf("\tMax Width : %d\n", info.maxwidth);
		printf("\tHeight    : %d\n", info.height);
		printf("\tFirst Char: %d\n", info.firstchar);
		printf("\tLast Char : %d\n", info.lastchar);
//end Kiran's addition

		if (aa)
			GrSetFontAttr(font, GR_TFANTIALIAS|GR_TFKERNING, 0);
		/*GrSetFontRotation(font, 150);*/
		GrSetGCFont(gc, font);

//Kiran's addition
		buf[0] = 0xCA;
		buf[1] = 0x45;
		buf[2] = 0xAE;
		buf[3] = 0x68;
		buf[4] = 0xC9;
		buf[5] = '\0';
		//buf[6] = ;
		//buf[7] = ;

		//sprintf(buf, "%d The Quick Brown Fox Jumped Over The Lazy Dog", i);
		GrText(w, gc, 0, y, buf, 5, GR_TFASCII|GR_TFTOP);
//end Kiran's addition

		//GrGetFontInfo(font, &info);
		y += info.height;

		GrDestroyFont(font);
	//}
}

*********************************************************************

Output i am getting is
 
*******************************************************************
1> TTF name: OmegaSerif88594 Bold, MW name: lt4-b-omega-serif.ttf
2> TTF name: OmegaSerifVISCII, MW name: viscii-omega-serif.ttf
3> TTF name: Courier New Italic, MW name: couri.ttf
4> TTF name: Arial Italic, MW name: ariali.ttf
5> TTF name: OmegaSerif88593 Italic, MW name: lt3-i-omega-serif.ttf
6> TTF name: OmegaSerif88591, MW name: lt1-r-omega-serif.ttf
7> TTF name: Courier New, MW name: cour.ttf
8> TTF name: OmegaSerif88595 Bold, MW name: lt5-b-omega-serif.ttf
9> TTF name: OmegaSerif88592 Bold, MW name: lt2-b-omega-serif.ttf
.
.
.
23> TTF name: DV-TTSurekh Normal, MW name: dvsr0ntt.ttf
24> TTF name: Arial Black, MW name: ariblk.ttf
25> TTF name: OmegaSerif88592 Italic, MW name: lt2-i-omega-serif.ttf
.
.
.
37> TTF name: DVW-TTSurekh Normal, MW name: DVWSR0NT.TTF
38> TTF name: OmegaSerif88592 BoldItalic, MW name: lt2-bi-omega-
serif.ttf
39> TTF name: OmegaSerif88595 BoldItalic, MW name: lt5-bi-omega-
serif.ttf

fnt_createfont: DVWSR0NT.TTF,20 not found
pcf_createfont: DVWSR0NT.TTF,20 not found
freetype_createfont: DVWSR0NT.TTF,20 not found
createfont: (height != 0) using builtin font System (0)

Value of font: 1000

Font Info..........
        Max Width : 11
        Height    : 13
        First Char: 32
        Last Char : 255

**************************************************************

If it could show my font through GrGetFontList() then why it could not
found my font while GrCreateFont()?

thanks and regards,
Kiran

On Mon, 2006-09-25 at 07:56 -0700, Martin Kajdas wrote:
> When I was debugging my problem with 'TTF fonts not found', I put a
> printf() in a search (loadfont) routine to show me what fonts were
> searched and what font I was looking for.
> This showed me exactly what the problem was.
> I cannot tell you what your problem is without knowing what is going on.
> Do the printf's and then we will see.
> It is either looking for a wrong front (no match) or at the wrong
> directory.
> 
> Martin
> 



Previous by date: 28 Sep 2006 14:19:24 +0100 Creating thumbnails of images and videos, pratish ganguly
Next by date: 28 Sep 2006 14:19:24 +0100 Re: Finding out width of a text string in terms of pixels, tj
Previous in thread: 28 Sep 2006 14:19:24 +0100 Re: Using own true type font with Nano-X, Martin Kajdas
Next in thread: 28 Sep 2006 14:19:24 +0100 Re: Using own true type font with Nano-X, Greg Haerr


Powered by ezmlm-browse 0.20.