Path: chuka.playstation.co.uk!news From: "Craig Graham" Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: how made his own font ? Date: 5 Aug 1998 11:11:40 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 65 Message-ID: <01bdc061$2c186980$f30b0a0a@Angela1.intelligent-group.com> References: <35C81A30.4ACB@club-internet.fr> <35C82DDB.3E12E37C@scee.sony.co.uk> NNTP-Posting-Host: d2-s8-102-telehouse.mistral.co.uk X-Newsreader: Microsoft Internet News 4.70.1155 James Russell wrote in article <35C82DDB.3E12E37C@scee.sony.co.uk>... > MAGNIER Francis wrote: > > > > I don't know how made his own font , > > I suppose there is an array , > > but how many cells horizontal and vertical ? > > It depends on how many characters you want. Do you want the entire ASCII alphabet, or just the > letters? Do you want both uppercase and lowercase? Do you need punctuation, like '!', '.', etc..? > > Once you've decided what characters you want, this determines the maximum size of your font. Most > people would go into a graphics program like Photoshop, Paint Shop Pro or Dpaint and create a > 256x256 image containing all the letters of your font in a grid. This implies that all your letters > are the same width/height. The size of the grid depends on how many characters are in your font. If > you had 256 characters, then the grid would be 8x8, with each cell in the grid being 8x8 pixels. But > if you have just numbers and letters, thats 10 (0-9) + 26 (A-Z) = 36, so you could have a 6x6 grid, > with each cell being 42x42! An extention of this is to have an additional array of character widths, to give your font that nice proportional look: > SetUpGsSprite(&FontSprite); // Set up the tpage, width, height, etc. This only has to be done once > in the program > unsigned char font_width_table[256]={/*and array of character widths goes here*/}; > void printString(char *string, int x, int y) { > > FontSprite.x = x; > FontSprite.y = y; > > while(*string) { // while there are still characters in the string > if(*string != ' ') { // Skip spaces > CharToUV(*string, &FontSprite.u, &FontSprite.v); // Calculate the proper UV > GsSortSprite(&FontSprite, My orderingtable, my priority); > } FontSprite.x += font_width_table[*string]; // proportional spaced width of the letter > //FontSprite.x += FONT_GRID_WIDTH; // The width of a letter > string++; > } > } > > > James Craig.