Mercurial > emacs
annotate src/w32bdf.h @ 30683:386d91b16514
*** empty log message ***
author | Ken Raeburn <raeburn@raeburn.org> |
---|---|
date | Tue, 08 Aug 2000 14:45:00 +0000 |
parents | 9cbfd0ef31df |
children | cc32b6a62560 |
rev | line source |
---|---|
24141 | 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 | |
29601
9cbfd0ef31df
Changed __W32BDF_H__ to EMACS_W32BDF_H to comply with ISO C spec.
Jason Rumney <jasonr@gnu.org>
parents:
24496
diff
changeset
|
24 #ifndef EMACS_W32BDF_H |
9cbfd0ef31df
Changed __W32BDF_H__ to EMACS_W32BDF_H to comply with ISO C spec.
Jason Rumney <jasonr@gnu.org>
parents:
24496
diff
changeset
|
25 #define EMACS_W32BDF_H |
24141 | 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 | |
24496
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
32 #define BDF_FONT_CACHE_SIZE 5000 |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
33 #define BDF_FONT_CLEAR_SIZE 1000 |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
34 |
24141 | 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 */ | |
24496
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
40 } glyph_metric; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
41 |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
42 typedef struct |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
43 { |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
44 glyph_metric metric; |
24141 | 45 int bitmap_size; /* byte lengh of the following slots */ |
46 unsigned char *bitmap; /* */ | |
47 } glyph_struct; | |
48 | |
24496
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
49 typedef struct fchar *pfont_char; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
50 |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
51 typedef struct |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
52 { |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
53 glyph_metric metric; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
54 pfont_char psrc; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
55 HBITMAP hbmp; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
56 } cache_bitmap; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
57 |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
58 typedef struct fchar |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
59 { |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
60 unsigned char *offset; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
61 cache_bitmap *pcbmp; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
62 } font_char; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
63 |
24141 | 64 typedef struct |
65 { | |
66 char *filename; | |
67 HANDLE hfile; | |
68 HANDLE hfilemap; | |
69 unsigned char *font; | |
70 unsigned char *seeked; | |
71 DWORD size; | |
24496
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
72 |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
73 font_char *chtbl[BDF_FIRST_OFFSET_TABLE]; |
24141 | 74 int llx, lly, urx, ury; /* Font bounding box */ |
75 | |
76 int yoffset; | |
77 int relative_compose; | |
78 int default_ascent; | |
24496
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
79 |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
80 unsigned char *registry; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
81 unsigned char *encoding; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
82 unsigned char *slant; |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
83 /* unsigned char *width; */ |
541ff963ba80
Merged patches from Meadow.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24141
diff
changeset
|
84 |
24141 | 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 | |
29601
9cbfd0ef31df
Changed __W32BDF_H__ to EMACS_W32BDF_H to comply with ISO C spec.
Jason Rumney <jasonr@gnu.org>
parents:
24496
diff
changeset
|
104 #endif /* EMACS_W32BDF_H */ |