Path: chuka.playstation.co.uk!scea!peter_alau@playstation.sony.com From: Elliott Lee Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: User created fonts Date: Sun, 25 Apr 1999 22:38:05 -0700 Organization: SCEA News Server Lines: 111 Message-ID: <3723FBBD.1FFFEED0@shell.jps.net> References: <7ffni9$dpk1@chuka.playstation.co.uk> NNTP-Posting-Host: svalliap-isdn3.cisco.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.51 [en] (Win95; I) X-Accept-Language: en One way that I do it is: 1) create a TIM with all the letters in a grid (e.g. 16 chars wide by 8 chars down, for 128 total char entries) 2) create a routine that plots the characters to the frame buffer one by one by adjusting the GsSPRITE structure's u and v settings. My routine is pasted at the end of this post. If you want the full set of routines and header file to drive this thing (which are required to use it), just let me know... Rikki Prince wrote: > > I read a NG thread about user created fonts, but for some reason, when I > need it, I can't find it. Can anyone point me towards it? > > Thanks > Rikki -- Mata ne, ... ... - e! ::' tenchi@shell.jps.net ':: (Protocol) :: ACiD -/- ACS -/- pHluid -/- Yaroze :: (Tenchikun) ::. http://www.jps.net/tenchi .:: ''' ''' int FontGPrint( FONTG *font, int startx, int starty, u_long attribute, GsOT *ot, int priority, int r, int g, int b, char *text ) { int x,y,xi,yi, chars, row,col,cols, char_start,char_end, start_u,start_v, w,h; char c; GsSPRITE *tim; // Set up the current location pointers x = startx; y = starty; w = font->cell_width; h = font->cell_height; xi = w; yi = font->line_height; // Make local copies of data cols = font->columns; char_start = font->char_start; char_end = font->char_end; start_u = font->start_u; start_v = font->start_v; // Adjust the brightness of the font tim = font->sprite; tim->r = r; tim->g = g; tim->b = b; // Print out the font! chars = 0; while( *text!=0 && charsx = x; tim->y = y; // Which character? c = *text; // Newline? if( c == '\n' ) { x = startx; y += yi; } // if( c == '\n' ) else { // Is the character in range? If no, then just make it a blank. if( cchar_end ) { x += xi; continue; } // if( cchar_end ) // Adjust the starting character c -= char_start; // Select the character in the block! col = c%cols; row = (c-col)/cols; tim->u = start_u + (col*w); tim->v = start_v + (row*h); // Dump character to the screen! GsSortFastSprite( tim,ot,priority ); // Reposition x += xi; } // else if( c == '\n' ) // Next character please text++; chars++; } // while( *text!=0 ) return(1); }