annotate src/w32bdf.h @ 24141:db9dfcd11c84

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