1 /**
2  ** BCC2GRX  -  Interfacing Borland based graphics programs to LIBGRX
3  ** Copyright (C) 1993-97 by Hartmut Schirmer
4  **
5  **
6  ** Contact :                Hartmut Schirmer
7  **                          Feldstrasse 118
8  **                  D-24105 Kiel
9  **                          Germany
10  **
11  ** e-mail : hsc@techfak.uni-kiel.de
12  **
13  ** This file is part of the GRX graphics library.
14  **
15  ** The GRX graphics library is free software; you can redistribute it
16  ** and/or modify it under some conditions; see the "copying.grx" file
17  ** for details.
18  **
19  ** This library is distributed in the hope that it will be useful,
20  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22  **
23  **/
24 
25 #include "text.h"
26 
27 static void _outtextxy(int *xx, int *yy, int XX, int YY,
28                                       int len, const uchar *textstring);
29 
30 /* ----------------------------------------------------------------- */
outtext(const char * textstring)31 void outtext(const char *textstring)
32 {
33   _outtextxy(&X, &Y, X+VL, Y+VT+PY, strlen(textstring), (uchar *)textstring);
34 }
35 
36 /* ----------------------------------------------------------------- */
outtextxy(int x,int y,const char * textstring)37 void outtextxy(int x, int y, const char *textstring)
38 {
39   _outtextxy( &x, &y, x+VL, y+VT+PY, strlen(textstring), (uchar *)textstring);
40 }
41 
42 /* ----------------------------------------------------------------- */
_outtextxy(int * xx,int * yy,int XX,int YY,int len,const uchar * textstring)43 static void _outtextxy(int *xx, int *yy, int XX, int YY,
44 				      int len, const uchar *textstring)
45 {
46   _DO_INIT_CHECK;
47   __gr_text_init();
48 #ifdef GRX_VERSION
49   if (TXT.font==DEFAULT_FONT) {
50     if (DefaultFonts[TXT.charsize] == NULL)
51       DefaultFonts[TXT.charsize] =
52 	GrBuildConvertedFont(
53 	  DefaultFonts[1],
54 	  GR_FONTCVT_RESIZE,
55 	  8*ZERO2ONE(TXT.charsize),
56 	  8*ZERO2ONE(TXT.charsize),
57 	  0, 0);
58     __gr_text_bit(DefaultFonts[TXT.charsize],xx,yy,XX,YY,len,(char *) textstring);
59   } else
60 #endif
61   if (BITMAP(TXT.font))
62     __gr_text_bit((GrFont *)Fonts[TXT.font],xx,yy,XX,YY,len,(char *) textstring);
63   else
64     __gr_text_vec(xx,yy,XX,YY,len,(char *) textstring);
65 }
66