pmbergland@violet.waterloo.edu (Per M Bergland) (10/13/90)
Hi!
I have three questions concerning Borland's "Turbo" fonts and
the use of them:
1) I thought (before I tried) that setting the font size to 1
with SetTextStyle would be equivalent to using
SetUserCharSize(1,1,1,1), but it turns out not to be the case.
My question is: How is the third argument in SetTextStyle translated
into MulX,DivX,MulY,DivY parameters in SetUserCharSize, and does
anyone know how to READ the values set with UserCharSize?
My first thought was that "maybe SetTextStyle is smart and creates
text looking the same size for different graphmodes", but I tried
with EGA,VGA and CGA mode, checking the value of TextHeight('A') (and
looking at the screen of course...), and it turned out the result was
the same in the three cases.
My code:
...
x := EGA; y:=EGAHi; Initgraph(x,y,'<my turbo directory>');
(* try replacing EGA with VGA or CGA, result is constant...*)
settextstyle(triplexfont,horizdir,1);
if readkey=' ' then SetUserCharSize(1,1,1,1);
a := TextHeight('A'); (* returns 16 if usercharsize is not called,
28 otherwise *)
outtextxy(100,100,'Test of BORLAND fonts');
...
2) Does anyone know why TextHeight is constant for all letters and
combinations of them, i.e. textheight('o') = textheight('O'), and
is it a bug that the value returned by textheight can not be used
to find out the distance (in pixels) from top 'T' to bottom 'g'?
(textheight('T') = textheight('g') = textheight('Tg'))
I suppose it has to do with the .chr-file format.
3) Can you select a font by referring to the four-letter *unique* fontname
(i.e. 'TRIP' for triplexfont) instead of the number, or, with fonts
included in your .exe file using binobj, selecting the font by
the adress of the FontProc (i.e. selectfont(Addr(TriplexFontProc)))?
I had a problem with using numbers when using the extra fonts
found at various ftp-sites.
If anyone has written their own versions of the font drawing routines and
is willing to share the source code with me, I would be most grateful.
This package must be fast, working in EGA and VGA, be able to draw text
anywhere in screen memory (no clipping) and include some smart way to load
and select fonts.
I can give you some fast EGA 640x350x16 routines used in the game FRAC
for copying, clearing etc, instead (no, not public domain, I will only
send it to someone that provides me with the above software).
Help?
- Per
--
| PER M BERGLAND CS&E student | snailmail: |
| email: pmbergland@violet.waterloo.edu | Rm 322, Minota Hagey Residence|
| or d6caps@dtek.chalmers.se | U of W, Waterloo, Ontario |
| (519) 725-6069 (home) Fax: Nah! | CANADA N2L 3G1 |