~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to xmetanet/font.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright INRIA */
 
2
#include <stdio.h>
 
3
#include <X11/Intrinsic.h>
 
4
 
 
5
#include "graphics.h"
 
6
#include "metio.h"
 
7
 
 
8
#define NUMFONTS 6
 
9
 
 
10
char *fontNames[] = {
 
11
  "-adobe-times-bold-r-normal--8-80-*-*-p-*-iso8859-1",
 
12
  "-adobe-times-bold-r-normal--10-100-*-*-p-*-iso8859-1",
 
13
  "-adobe-times-bold-r-normal--12-120-*-*-p-*-iso8859-1",
 
14
  "-adobe-times-bold-r-normal--14-140-*-*-p-*-iso8859-1",
 
15
  "-adobe-times-bold-r-normal--18-180-*-*-p-*-iso8859-1",
 
16
  "-adobe-times-bold-r-normal--24-240-*-*-p-*-iso8859-1"
 
17
};
 
18
 
 
19
static XFontStruct *fontStructs[NUMFONTS];
 
20
 
 
21
XFontStruct *theDrawFont;
 
22
 
 
23
void GetFonts()
 
24
{
 
25
  int i;
 
26
  XFontStruct *fontstruct;
 
27
 
 
28
  for (i = 0; i < NUMFONTS; i++) {
 
29
    if ((fontstruct = XLoadQueryFont(theG.dpy, fontNames[i])) == NULL) {
 
30
      if ((fontstruct = XLoadQueryFont(theG.dpy, "fixed")) == NULL) {
 
31
        sprintf(Description,"Unable to find any font\n");
 
32
        MetanetAlert(Description);
 
33
        exit(1);
 
34
      }
 
35
    }
 
36
    fontStructs[i] = fontstruct;
 
37
  }
 
38
}
 
39
 
 
40
XFontStruct *FontSelect(s)
 
41
int s;
 
42
{
 
43
  switch (s) {
 
44
  case 8:
 
45
    return fontStructs[0];
 
46
    break;
 
47
  case 10:
 
48
    return fontStructs[1];
 
49
    break;
 
50
  case 12:
 
51
    return fontStructs[2];
 
52
    break;
 
53
  case 14:
 
54
    return fontStructs[3];
 
55
    break;
 
56
  case 18:
 
57
    return fontStructs[4];
 
58
    break;
 
59
  case 24:
 
60
    return fontStructs[5];
 
61
    break;
 
62
  default:
 
63
    return NULL;
 
64
    break;
 
65
  }
 
66
}