-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXFonts.cc
72 lines (55 loc) · 2.07 KB
/
XFonts.cc
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
65
66
67
68
69
70
71
72
/*
-------------------------------------------------------------------------
OBJECT NAME: XFonts.cc
FULL NAME:
DESCRIPTION:
COPYRIGHT: University Corporation for Atmospheric Research, 1997
-------------------------------------------------------------------------
*/
#include "XFonts.h"
/* Values for reading Font Resources */
char XtNfont24[] = "font24";
char XtCFont24[] = "Font24";
char XtNfont18[] = "font18";
char XtCFont18[] = "Font18";
char XtNfont14[] = "font14";
char XtCFont14[] = "Font14";
char XtNfont12[] = "font12";
char XtCFont12[] = "Font12";
char XtNfont10[] = "font10";
char XtCFont10[] = "Font10";
typedef struct _insRec
{
const char *font24;
const char *font18;
const char *font14;
const char *font12;
const char *font10;
} instanceRec;
static XtResource resources[] = {
{XtNfont24, XtCFont24, XtRString, sizeof(char *),
XtOffsetOf(instanceRec, font24), XtRString, NULL},
{XtNfont18, XtCFont18, XtRString, sizeof(char *),
XtOffsetOf(instanceRec, font18), XtRString, NULL},
{XtNfont14, XtCFont14, XtRString, sizeof(char *),
XtOffsetOf(instanceRec, font14), XtRString, NULL},
{XtNfont12, XtCFont12, XtRString, sizeof(char *),
XtOffsetOf(instanceRec, font12), XtRString, NULL},
{XtNfont10, XtCFont10, XtRString, sizeof(char *),
XtOffsetOf(instanceRec, font10), XtRString, NULL},
};
/* -------------------------------------------------------------------- */
XFonts::XFonts(Widget shell)
{
instanceRec iv;
Display *dpy = XtDisplay(shell);
XtGetApplicationResources(shell, (caddr_t)&iv, resources,
XtNumber(resources), NULL, 0);
if ((fontInfo[Point24] = XLoadQueryFont(dpy, iv.font24)) == NULL ||
(fontInfo[Point18] = XLoadQueryFont(dpy, iv.font18)) == NULL ||
(fontInfo[Point14] = XLoadQueryFont(dpy, iv.font14)) == NULL ||
(fontInfo[Point12] = XLoadQueryFont(dpy, iv.font12)) == NULL ||
(fontInfo[Point10] = XLoadQueryFont(dpy, iv.font10)) == NULL)
std::cerr << "XFonts: can't load font.\n";
} /* END CONSTRUCTOR */
/* END XFONTS.CC */