24141
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
1 /* Definitions and header for handling BDF fonts on the Microsoft W32 API.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
2 Copyright (C) 1999 Free Software Foundation, Inc.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
3
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
4 This file is part of GNU Emacs.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
5
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
6 GNU Emacs is free software; you can redistribute it and/or modify
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
7 it under the terms of the GNU General Public License as published by
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
8 the Free Software Foundation; either version 2, or (at your option)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
9 any later version.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
10
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
11 GNU Emacs is distributed in the hope that it will be useful,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
14 GNU General Public License for more details.
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
15
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
17 along with GNU Emacs; see the file COPYING. If not, write to
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
19 Boston, MA 02111-1307, USA. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
20
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
21 /* Based heavily on code by H. Miyashita for Meadow (a descendant of
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
22 MULE for W32). */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
23
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
24 #ifndef __W32BDF_H__
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
25 #define __W32BDF_H__
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
26
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
27 #define BDF_FIRST_OFFSET_TABLE 0x200
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
28 #define BDF_SECOND_OFFSET_TABLE 0x80
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
29 #define BDF_SECOND_OFFSET(x) ((x) & 0x7f)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
30 #define BDF_FIRST_OFFSET(x) (((x) >> 8) | (((x) & 0x80) << 1))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
31
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
32 /* Structure of glyph information of one character. */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
33 typedef struct
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
34 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
35 int dwidth; /* width in pixels */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
36 int bbw, bbh, bbox, bboy; /* bounding box in pixels */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
37 int bitmap_size; /* byte lengh of the following slots */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
38 unsigned char *bitmap; /* */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
39 } glyph_struct;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
40
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
41 typedef struct
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
42 {
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
43 char *filename;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
44 HANDLE hfile;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
45 HANDLE hfilemap;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
46 unsigned char *font;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
47 unsigned char *seeked;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
48 DWORD size;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
49 unsigned char **offset[BDF_FIRST_OFFSET_TABLE];
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
50 int llx, lly, urx, ury; /* Font bounding box */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
51
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
52 int yoffset;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
53 int relative_compose;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
54 int default_ascent;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
55 int width;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
56 int height;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
57 int pixsz;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
58 } bdffont;
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
59
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
60
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
61 #define BDF_FILE_SIZE_MAX 256*1024*1024 /* 256Mb */
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
62 #define BDF_FONT_FILE(font) (((bdffont*)(font))->filename)
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
63 #define MAKELENDSHORT(c1, c2) (unsigned short)((c1) | ((c2) << 8))
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
64
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
65 bdffont *w32_init_bdf_font (char *filename);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
66 void w32_free_bdf_font (bdffont *fontp);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
67 int w32_get_bdf_glyph (bdffont *fontp, int index, int size,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
68 glyph_struct *glyph);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
69 int w32_BDF_TextOut (bdffont *fontp, HDC hdc, int left,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
70 int top, unsigned char *text, int dim,
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
71 int bytelen, int fixed_pitch_size);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
72 int w32_BDF_to_x_font (char *file, char* xstr, int len);
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
73
|
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff
changeset
|
74 #endif /* __W32BDF_H__ */
|