From: neil AT robots DOT ox DOT ac DOT uk (Neil Townsend) Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro / fonts - dumb new user seeks advice Date: Tue, 7 Jul 1998 11:36:10 GMT Organization: None evident here. Lines: 75 Message-ID: <1998Jul7.113610.16036@catorobots.ox.ac.uk> References: <199807030019 DOT BAA27198 AT sable DOT ox DOT ac DOT uk> <6nip5d$88h$1 AT nnrp1 DOT dejanews DOT com> NNTP-Posting-Host: cato.robots.ox.ac.uk Originator: neil AT cato To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Frist, many thanks to Stefan Viljoen, George Foot, Bill Gillhespy and Dough Eleveld for taking the time to answer my query. I have now resolved my problem by using, as you suggested, ttf2pcx. For what it's worth I tried botht the version that comes with allegttf and one from the allegro web pages. Whilst I prefered the command line interface, I prefered the fonts produced by the windows one (although it seems to multiply the point size you give it by about 8, I think this is due to a misset 'big' Boolean in the code, but my C++ is nonexistant. The other thing I noticed, which doubtless you are all aware of, is that PCX fonts drived from TTf fonts are quite high (especially using the DOS TTF2PCX), with (sensibly) space for accents and descenders. Under allegro, however, this information is not explicitly available (as far as I could see) and it would be useful for aligning certain forms of text. Well, I needed to know it anyway. So, in case it's of any use to anyone, here's a hack solution to the problem, it assumes that the characters 0-9 and A-Z are a sufficient description of non-descending, non-accented characters. Yours, Neil void give_baseline_and_topgap_for_character_in_font(FONT *font, int c, int *baseline, int *topgap) { BITMAP *c_bmp; int i; int j; c_bmp = font->dat.dat_prop->dat[c-32]; for (i=0; iw; j++) { if (*(c_bmp->line[i] + j) != 0) { *topgap = i; j = c_bmp->w; i = text_height(font); } } } for (i=(text_height(font)-1); i>= 0; i--) { for (j=0; jw; j++) { if (*(c_bmp->line[i] + j) != 0) { *baseline = text_height(font) - i + 1; j = c_bmp->w; i = 0; } } } } void give_baseline_and_topgap_for_font(FONT *font, int *baseline, int *topgap) { int i; int c_bl; int c_tg; *baseline = text_height(font); *topgap = text_height(font); for (i='A'; i<='Z'; i++) { give_baseline_and_topgap_for_character_in_font(font, i, &c_bl, &c_tg); if (c_bl < *baseline) *baseline = c_bl; if (c_tg < *topgap) *topgap = c_tg; } for (i='0'; i<='9'; i++) { give_baseline_and_topgap_for_character_in_font(font, i, &c_bl, &c_tg); if (c_bl < *baseline) *baseline = c_bl; if (c_tg < *topgap) *topgap = c_tg; } } -- Neil Townsend +44 (1865) 273121 neil AT robots DOT ox DOT ac DOT uk