1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#include <Xw_Extension.h>
/* ifdef then trace on */
#ifdef TRACE
#define TRACE_GET_FONT
#endif
/*
char* Xw_get_font (afontmap,index,size,bheight):
XW_EXT_FONTMAP *afontmap
int index font index
float *size font size in MM
float *bheight baseline font height in MM
Get Line Font Extended fontmap FONT values from index .
Returns NULL if BadFont Index or font is not defined
Returns font string address if Successful
*/
#ifdef XW_PROTOTYPE
char* Xw_get_font (void* afontmap,int index,float *size,float *bheight)
#else
char* Xw_get_font (afontmap,index,size,bheight)
void *afontmap;
int index ;
float *size ;
float *bheight ;
#endif /*XW_PROTOTYPE*/
{
XW_EXT_FONTMAP *pfontmap = (XW_EXT_FONTMAP*)afontmap;
//XW_EXT_DISPLAY *pdisplay = pfontmap->connexion;
char *font = NULL;
//int i ;
*size = *bheight = 0.;
if ( !Xw_isdefine_font(pfontmap,index) ) {
/*ERROR*Bad defined font*/
Xw_set_error(43,"Xw_get_font",&index) ;
return (NULL) ;
}
if( pfontmap->snames[index] ) font = pfontmap->snames[index] ;
else if( pfontmap->gnames[index] ) font = pfontmap->gnames[index];
if( !font ) {
/*ERROR*Bad defined font*/
Xw_set_error(43,"Xw_get_font",&index);
return NULL;
}
*size = pfontmap->fsizes[index];
*bheight = *size * pfontmap->fratios[index];
#ifdef TRACE_GET_FONT
if( Xw_get_trace() > 1 ) {
printf (" '%s' = Xw_get_font(%lx,%d,%f,%f)\n",font,(long ) pfontmap,index,*size,*bheight) ;
}
#endif
return (font);
}
|