Commit | Line | Data |
---|---|---|
b46a6a83 | 1 | /* Shared GDI and Uniscribe Font backend declarations for the Windows API. |
ab422c4d | 2 | Copyright (C) 2007-2013 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 | ||
17a2cbbd | 22 | #include "font.h" |
713849f6 | 23 | |
7877f373 JB |
24 | /* Bit 17 of ntmFlags in NEWTEXTMETRIC is set for PostScript OpenType fonts, |
25 | bit 18 for TrueType OpenType fonts, bit 20 for Type1 fonts. */ | |
500591f8 JR |
26 | #ifndef NTM_PS_OPENTYPE |
27 | #define NTM_PS_OPENTYPE 0x00020000 | |
28 | #endif | |
29 | #ifndef NTM_TT_OPENTYPE | |
30 | #define NTM_TT_OPENTYPE 0x00040000 | |
31 | #endif | |
32 | #ifndef NTM_TYPE1 | |
33 | #define NTM_TYPE1 0x00100000 | |
34 | #endif | |
35 | ||
36 | #define NTMFLAGS_OPENTYPE (NTM_PS_OPENTYPE | NTM_TT_OPENTYPE) | |
713849f6 | 37 | |
56a70cca JR |
38 | struct w32_metric_cache |
39 | { | |
40 | short lbearing, rbearing, width; | |
41 | unsigned char status; | |
42 | }; | |
43 | ||
44 | #define W32METRIC_NO_ATTEMPT 0 | |
45 | #define W32METRIC_SUCCESS 1 | |
46 | #define W32METRIC_FAIL 2 | |
47 | ||
713849f6 JR |
48 | /* The actual structure for a w32 font, that can be cast to struct font. |
49 | The Uniscribe backend extends this. */ | |
50 | struct w32font_info | |
51 | { | |
52 | struct font font; | |
bd187c49 | 53 | TEXTMETRICW metrics; |
500591f8 | 54 | unsigned int glyph_idx; |
56a70cca JR |
55 | struct w32_metric_cache **cached_metrics; |
56 | int n_cache_blocks; | |
1b5defe6 | 57 | HFONT hfont; |
713849f6 JR |
58 | }; |
59 | ||
c35f9821 JR |
60 | /* Macros for getting OS specific information from a font struct. */ |
61 | #define FONT_HANDLE(f) (((struct w32font_info *)(f))->hfont) | |
62 | #define FONT_TEXTMETRIC(f) (((struct w32font_info *)(f))->metrics) | |
63 | ||
56a70cca JR |
64 | #define CACHE_BLOCKSIZE 128 |
65 | ||
9e892c8d | 66 | Lisp_Object w32font_get_cache (FRAME_PTR fe); |
6c1a09ba | 67 | Lisp_Object w32font_list_internal (struct frame *f, |
9e892c8d J |
68 | Lisp_Object font_spec, |
69 | int opentype_only); | |
6c1a09ba | 70 | Lisp_Object w32font_match_internal (struct frame *f, |
9e892c8d J |
71 | Lisp_Object font_spec, |
72 | int opentype_only); | |
73 | int w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, | |
74 | int pixel_size, Lisp_Object font_object); | |
75 | void w32font_close (FRAME_PTR f, struct font *font); | |
76 | int w32font_has_char (Lisp_Object entity, int c); | |
77 | int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, | |
78 | struct font_metrics *metrics); | |
79 | int w32font_draw (struct glyph_string *s, int from, int to, | |
a864ef14 | 80 | int x, int y, bool with_background); |
9e892c8d J |
81 | |
82 | ||
83 | int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec); | |
84 | ||
85 | Lisp_Object intern_font_name (char *); | |
e6df5336 | 86 | |
17a2cbbd DC |
87 | extern void syms_of_w32font (void); |
88 | extern void globals_of_w32font (void); | |
89 | ||
713849f6 | 90 | #endif |