]> code.delx.au - gnu-emacs/blob - src/w32font.h
Switch to recommended form of GPLv3 permissions notice.
[gnu-emacs] / src / w32font.h
1 /* Shared GDI and Uniscribe Font backend declarations for the W32 API.
2 Copyright (C) 2007, 2008 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 3 of the License, or
9 (at your option) 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. If not, see <http://www.gnu.org/licenses/>. */
18
19 #ifndef EMACS_W32FONT_H
20 #define EMACS_W32FONT_H
21
22
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. */
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)
36
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
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;
52 TEXTMETRIC metrics;
53 unsigned int glyph_idx;
54 struct w32_metric_cache **cached_metrics;
55 int n_cache_blocks;
56 W32FontStruct *compat_w32_font;
57 };
58
59 #define FONT_COMPAT(f) (((struct w32font_info *) (f))->compat_w32_font)
60
61 #define CACHE_BLOCKSIZE 128
62
63 Lisp_Object w32font_get_cache P_ ((FRAME_PTR fe));
64 Lisp_Object w32font_list_internal P_ ((Lisp_Object frame,
65 Lisp_Object font_spec,
66 int opentype_only));
67 Lisp_Object w32font_match_internal P_ ((Lisp_Object frame,
68 Lisp_Object font_spec,
69 int opentype_only));
70 int w32font_open_internal P_ ((FRAME_PTR f, Lisp_Object font_entity,
71 int pixel_size, Lisp_Object font_object));
72 void w32font_close P_ ((FRAME_PTR f, struct font *font));
73 int w32font_has_char P_ ((Lisp_Object entity, int c));
74 int w32font_text_extents P_ ((struct font *font, unsigned *code, int nglyphs,
75 struct font_metrics *metrics));
76 int w32font_draw P_ ((struct glyph_string *s, int from, int to,
77 int x, int y, int with_background));
78
79
80 int uniscribe_check_otf P_ ((LOGFONT *font, Lisp_Object otf_spec));
81
82 #endif
83
84 /* arch-tag: ef9d9675-a2a5-4d01-9526-815e9a3da7cb
85 (do not change this comment) */