Commit | Line | Data |
---|---|---|
b46a6a83 | 1 | /* Shared GDI and Uniscribe Font backend declarations for the Windows API. |
acaf905b | 2 | Copyright (C) 2007-2012 Free Software Foundation, Inc. |
713849f6 JR |
3 | |
4 | This file is part of GNU Emacs. | |
5 | ||
b9b1cc14 | 6 | GNU Emacs is free software: you can redistribute it and/or modify |
713849f6 | 7 | it under the terms of the GNU General Public License as published by |
b9b1cc14 GM |
8 | the Free Software Foundation, either version 3 of the License, or |
9 | (at your option) any later version. | |
713849f6 JR |
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 | |
b9b1cc14 | 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
713849f6 JR |
18 | |
19 | #ifndef EMACS_W32FONT_H | |
20 | #define EMACS_W32FONT_H | |
21 | ||
22 | ||
7877f373 JB |
23 | /* Bit 17 of ntmFlags in NEWTEXTMETRIC is set for PostScript OpenType fonts, |
24 | bit 18 for TrueType OpenType fonts, bit 20 for Type1 fonts. */ | |
500591f8 JR |
25 | #ifndef NTM_PS_OPENTYPE |
26 | #define NTM_PS_OPENTYPE 0x00020000 | |
27 | #endif | |
28 | #ifndef NTM_TT_OPENTYPE | |
29 | #define NTM_TT_OPENTYPE 0x00040000 | |
30 | #endif | |
31 | #ifndef NTM_TYPE1 | |
32 | #define NTM_TYPE1 0x00100000 | |
33 | #endif | |
34 | ||
35 | #define NTMFLAGS_OPENTYPE (NTM_PS_OPENTYPE | NTM_TT_OPENTYPE) | |
713849f6 | 36 | |
56a70cca JR |
37 | struct w32_metric_cache |
38 | { | |
39 | short lbearing, rbearing, width; | |
40 | unsigned char status; | |
41 | }; | |
42 | ||
43 | #define W32METRIC_NO_ATTEMPT 0 | |
44 | #define W32METRIC_SUCCESS 1 | |
45 | #define W32METRIC_FAIL 2 | |
46 | ||
713849f6 JR |
47 | /* The actual structure for a w32 font, that can be cast to struct font. |
48 | The Uniscribe backend extends this. */ | |
49 | struct w32font_info | |
50 | { | |
51 | struct font font; | |
bd187c49 | 52 | TEXTMETRICW metrics; |
500591f8 | 53 | unsigned int glyph_idx; |
56a70cca JR |
54 | struct w32_metric_cache **cached_metrics; |
55 | int n_cache_blocks; | |
1b5defe6 | 56 | HFONT hfont; |
713849f6 JR |
57 | }; |
58 | ||
c35f9821 JR |
59 | /* Macros for getting OS specific information from a font struct. */ |
60 | #define FONT_HANDLE(f) (((struct w32font_info *)(f))->hfont) | |
61 | #define FONT_TEXTMETRIC(f) (((struct w32font_info *)(f))->metrics) | |
62 | ||
56a70cca JR |
63 | #define CACHE_BLOCKSIZE 128 |
64 | ||
9e892c8d J |
65 | Lisp_Object w32font_get_cache (FRAME_PTR fe); |
66 | Lisp_Object w32font_list_internal (Lisp_Object frame, | |
67 | Lisp_Object font_spec, | |
68 | int opentype_only); | |
69 | Lisp_Object w32font_match_internal (Lisp_Object frame, | |
70 | Lisp_Object font_spec, | |
71 | int opentype_only); | |
72 | int w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, | |
73 | int pixel_size, Lisp_Object font_object); | |
74 | void w32font_close (FRAME_PTR f, struct font *font); | |
75 | int w32font_has_char (Lisp_Object entity, int c); | |
76 | int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, | |
77 | struct font_metrics *metrics); | |
78 | int w32font_draw (struct glyph_string *s, int from, int to, | |
79 | int x, int y, int with_background); | |
80 | ||
81 | ||
82 | int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec); | |
83 | ||
84 | Lisp_Object intern_font_name (char *); | |
e6df5336 | 85 | |
713849f6 | 86 | #endif |