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