annotate src/w32bdf.h @ 31258:12f2e341ee9c

(mouse-major-mode-menu): Use local-key-binding. (mouse-popup-menubar): Add minor mode menus. (popup-menu): Check for lookup-key returning number.
author Dave Love <fx@gnu.org>
date Tue, 29 Aug 2000 11:10:48 +0000
parents 9cbfd0ef31df
children cc32b6a62560
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
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
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
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
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 /* Structure of glyph information of one character. */
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 typedef struct
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 {
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38 int dwidth; /* width in pixels */
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 int bitmap_size; /* byte lengh of the following slots */
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 unsigned char *bitmap; /* */
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47 } glyph_struct;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
64 typedef struct
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
65 {
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
66 char *filename;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
67 HANDLE hfile;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
68 HANDLE hfilemap;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
69 unsigned char *font;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
70 unsigned char *seeked;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
74 int llx, lly, urx, ury; /* Font bounding box */
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
75
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76 int yoffset;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
77 int relative_compose;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
85 int width;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86 int height;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87 int pixsz;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
88 } bdffont;
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
91 #define BDF_FILE_SIZE_MAX 256*1024*1024 /* 256Mb */
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
92 #define BDF_FONT_FILE(font) (((bdffont*)(font))->filename)
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
93 #define MAKELENDSHORT(c1, c2) (unsigned short)((c1) | ((c2) << 8))
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
94
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
95 bdffont *w32_init_bdf_font (char *filename);
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
96 void w32_free_bdf_font (bdffont *fontp);
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
97 int w32_get_bdf_glyph (bdffont *fontp, int index, int size,
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
98 glyph_struct *glyph);
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
99 int w32_BDF_TextOut (bdffont *fontp, HDC hdc, int left,
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
100 int top, unsigned char *text, int dim,
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
101 int bytelen, int fixed_pitch_size);
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
102 int w32_BDF_to_x_font (char *file, char* xstr, int len);
db9dfcd11c84 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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 */