Commit | Line | Data |
---|---|---|
7b416d42 GV |
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 | ||
4cc436ed JR |
24 | #ifndef EMACS_W32BDF_H |
25 | #define EMACS_W32BDF_H | |
7b416d42 GV |
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 | ||
865203c3 GV |
32 | #define BDF_FONT_CACHE_SIZE 5000 |
33 | #define BDF_FONT_CLEAR_SIZE 1000 | |
34 | ||
7b416d42 GV |
35 | /* Structure of glyph information of one character. */ |
36 | typedef struct | |
37 | { | |
38 | int dwidth; /* width in pixels */ | |
39 | int bbw, bbh, bbox, bboy; /* bounding box in pixels */ | |
865203c3 GV |
40 | } glyph_metric; |
41 | ||
42 | typedef struct | |
43 | { | |
44 | glyph_metric metric; | |
7b416d42 GV |
45 | int bitmap_size; /* byte lengh of the following slots */ |
46 | unsigned char *bitmap; /* */ | |
47 | } glyph_struct; | |
48 | ||
865203c3 GV |
49 | typedef struct fchar *pfont_char; |
50 | ||
51 | typedef struct | |
52 | { | |
53 | glyph_metric metric; | |
54 | pfont_char psrc; | |
55 | HBITMAP hbmp; | |
56 | } cache_bitmap; | |
57 | ||
58 | typedef struct fchar | |
59 | { | |
60 | unsigned char *offset; | |
61 | cache_bitmap *pcbmp; | |
62 | } font_char; | |
63 | ||
7b416d42 GV |
64 | typedef struct |
65 | { | |
66 | char *filename; | |
67 | HANDLE hfile; | |
68 | HANDLE hfilemap; | |
69 | unsigned char *font; | |
70 | unsigned char *seeked; | |
71 | DWORD size; | |
865203c3 GV |
72 | |
73 | font_char *chtbl[BDF_FIRST_OFFSET_TABLE]; | |
7b416d42 GV |
74 | int llx, lly, urx, ury; /* Font bounding box */ |
75 | ||
76 | int yoffset; | |
77 | int relative_compose; | |
78 | int default_ascent; | |
865203c3 GV |
79 | |
80 | unsigned char *registry; | |
81 | unsigned char *encoding; | |
82 | unsigned char *slant; | |
83 | /* unsigned char *width; */ | |
84 | ||
7b416d42 GV |
85 | int width; |
86 | int height; | |
87 | int pixsz; | |
88 | } bdffont; | |
89 | ||
90 | ||
91 | #define BDF_FILE_SIZE_MAX 256*1024*1024 /* 256Mb */ | |
92 | #define BDF_FONT_FILE(font) (((bdffont*)(font))->filename) | |
93 | #define MAKELENDSHORT(c1, c2) (unsigned short)((c1) | ((c2) << 8)) | |
94 | ||
95 | bdffont *w32_init_bdf_font (char *filename); | |
96 | void w32_free_bdf_font (bdffont *fontp); | |
97 | int w32_get_bdf_glyph (bdffont *fontp, int index, int size, | |
98 | glyph_struct *glyph); | |
99 | int w32_BDF_TextOut (bdffont *fontp, HDC hdc, int left, | |
100 | int top, unsigned char *text, int dim, | |
101 | int bytelen, int fixed_pitch_size); | |
102 | int w32_BDF_to_x_font (char *file, char* xstr, int len); | |
103 | ||
4cc436ed | 104 | #endif /* EMACS_W32BDF_H */ |