(File Shadowing): New.
[emacs.git] / src / w32bdf.h
blob218cc0331dced4f322b98c3b4c54ef24889df968
1 /* Definitions and header for handling BDF fonts on the Microsoft W32 API.
2 Copyright (C) 1999 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
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.
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.
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. */
21 /* Based heavily on code by H. Miyashita for Meadow (a descendant of
22 MULE for W32). */
24 #ifndef EMACS_W32BDF_H
25 #define EMACS_W32BDF_H
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))
32 #define BDF_FONT_CACHE_SIZE 5000
33 #define BDF_FONT_CLEAR_SIZE 1000
35 /* Structure of glyph information of one character. */
36 typedef struct
38 int dwidth; /* width in pixels */
39 int bbw, bbh, bbox, bboy; /* bounding box in pixels */
40 } glyph_metric;
42 typedef struct
44 glyph_metric metric;
45 int bitmap_size; /* byte lengh of the following slots */
46 unsigned char *bitmap; /* */
47 } glyph_struct;
49 typedef struct fchar *pfont_char;
51 typedef struct
53 glyph_metric metric;
54 pfont_char psrc;
55 HBITMAP hbmp;
56 } cache_bitmap;
58 typedef struct fchar
60 unsigned char *offset;
61 cache_bitmap *pcbmp;
62 } font_char;
64 typedef struct
66 char *filename;
67 HANDLE hfile;
68 HANDLE hfilemap;
69 unsigned char *font;
70 unsigned char *seeked;
71 DWORD size;
73 font_char *chtbl[BDF_FIRST_OFFSET_TABLE];
74 int llx, lly, urx, ury; /* Font bounding box */
76 int yoffset;
77 int relative_compose;
78 int default_ascent;
80 unsigned char *registry;
81 unsigned char *encoding;
82 unsigned char *slant;
83 /* unsigned char *width; */
85 int width;
86 int height;
87 int pixsz;
88 } bdffont;
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))
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);
104 #endif /* EMACS_W32BDF_H */