Mercurial > emacs
annotate src/ftxfont.c @ 101433:e3722b48e6da
(Windows Printing): Add an index entry for Ghostscript.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 24 Jan 2009 15:51:24 +0000 |
parents | e038c1a8307c |
children | edcf6efdc10a |
rev | line source |
---|---|
90400 | 1 /* ftxfont.c -- FreeType font driver on X (without using XFT). |
100951 | 2 Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
3 Copyright (C) 2006, 2007, 2008, 2009 | |
90400 | 4 National Institute of Advanced Industrial Science and Technology (AIST) |
5 Registration Number H13PRO009 | |
6 | |
7 This file is part of GNU Emacs. | |
8 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94932
diff
changeset
|
9 GNU Emacs is free software: you can redistribute it and/or modify |
90400 | 10 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94932
diff
changeset
|
11 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94932
diff
changeset
|
12 (at your option) any later version. |
90400 | 13 |
14 GNU Emacs is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94932
diff
changeset
|
20 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
90400 | 21 |
22 #include <config.h> | |
23 #include <stdio.h> | |
24 #include <X11/Xlib.h> | |
25 | |
26 #include "lisp.h" | |
27 #include "dispextern.h" | |
28 #include "xterm.h" | |
29 #include "frame.h" | |
30 #include "blockinput.h" | |
31 #include "character.h" | |
32 #include "charset.h" | |
33 #include "fontset.h" | |
34 #include "font.h" | |
35 | |
36 /* FTX font driver. */ | |
37 | |
38 static Lisp_Object Qftx; | |
39 | |
40 /* Prototypes for helper function. */ | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
41 static GC *ftxfont_get_gcs P_ ((FRAME_PTR, unsigned long, unsigned long)); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
42 static int ftxfont_draw_bitmap P_ ((FRAME_PTR, GC, GC *, struct font *, |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
43 unsigned, int, int, XPoint *, int, int *, |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
44 int)); |
90400 | 45 static void ftxfont_draw_backgrond P_ ((FRAME_PTR, struct font *, GC, |
46 int, int, int)); | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
47 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
48 struct ftxfont_frame_data |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
49 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
50 /* Background and foreground colors. */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
51 XColor colors[2]; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
52 /* GCs interporationg the above colors. gcs[0] is for a color |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
53 closest to BACKGROUND, and gcs[5] is for a color closest to |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
54 FOREGROUND. */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
55 GC gcs[6]; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
56 struct ftxfont_frame_data *next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
57 }; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
58 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
59 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
60 /* Return an array of 6 GCs for antialiasing. */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
61 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
62 static GC * |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
63 ftxfont_get_gcs (f, foreground, background) |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
64 FRAME_PTR f; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
65 unsigned long foreground, background; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
66 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
67 XColor color; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
68 XGCValues xgcv; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
69 int i; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
70 struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
71 struct ftxfont_frame_data *prev = NULL, *this = NULL, *new; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
72 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
73 if (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
74 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
75 for (this = data; this; prev = this, this = this->next) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
76 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
77 if (this->colors[0].pixel < background) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
78 continue; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
79 if (this->colors[0].pixel > background) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
80 break; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
81 if (this->colors[1].pixel < foreground) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
82 continue; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
83 if (this->colors[1].pixel > foreground) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
84 break; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
85 return this->gcs; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
86 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
87 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
88 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
89 new = malloc (sizeof (struct ftxfont_frame_data)); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
90 if (! new) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
91 return NULL; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
92 new->next = this; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
93 if (prev) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
94 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
95 prev->next = new; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
96 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
97 else if (font_put_frame_data (f, &ftxfont_driver, new) < 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
98 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
99 free (new); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
100 return NULL; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
101 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
102 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
103 new->colors[0].pixel = background; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
104 new->colors[1].pixel = foreground; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
105 |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
106 BLOCK_INPUT; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
107 XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), new->colors, 2); |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
108 for (i = 1; i < 7; i++) |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
109 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
110 /* Interpolate colors linearly. Any better algorithm? */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
111 color.red |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
112 = (new->colors[1].red * i + new->colors[0].red * (8 - i)) / 8; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
113 color.green |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
114 = (new->colors[1].green * i + new->colors[0].green * (8 - i)) / 8; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
115 color.blue |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
116 = (new->colors[1].blue * i + new->colors[0].blue * (8 - i)) / 8; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
117 if (! x_alloc_nearest_color (f, FRAME_X_COLORMAP (f), &color)) |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
118 break; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
119 xgcv.foreground = color.pixel; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
120 new->gcs[i - 1] = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
121 GCForeground, &xgcv); |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
122 } |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
123 UNBLOCK_INPUT; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
124 |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
125 if (i < 7) |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
126 { |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
127 BLOCK_INPUT; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
128 for (i--; i >= 0; i--) |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
129 XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]); |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
130 UNBLOCK_INPUT; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
131 if (prev) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
132 prev->next = new->next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
133 else if (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
134 font_put_frame_data (f, &ftxfont_driver, new->next); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
135 free (new); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
136 return NULL; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
137 } |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
138 return new->gcs; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
139 } |
90400 | 140 |
141 static int | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
142 ftxfont_draw_bitmap (f, gc_fore, gcs, font, code, x, y, p, size, n, flush) |
90400 | 143 FRAME_PTR f; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
144 GC gc_fore, *gcs; |
90400 | 145 struct font *font; |
146 unsigned code; | |
147 int x, y; | |
148 XPoint *p; | |
149 int size, *n; | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
150 int flush; |
90400 | 151 { |
152 struct font_bitmap bitmap; | |
153 unsigned char *b; | |
154 int i, j; | |
155 | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
156 if (ftfont_driver.get_bitmap (font, code, &bitmap, size > 0x100 ? 1 : 8) < 0) |
90400 | 157 return 0; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
158 if (size > 0x100) |
90400 | 159 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
160 for (i = 0, b = bitmap.buffer; i < bitmap.rows; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
161 i++, b += bitmap.pitch) |
90400 | 162 { |
163 for (j = 0; j < bitmap.width; j++) | |
164 if (b[j / 8] & (1 << (7 - (j % 8)))) | |
165 { | |
166 p[n[0]].x = x + bitmap.left + j; | |
167 p[n[0]].y = y - bitmap.top + i; | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
168 if (++n[0] == size) |
90400 | 169 { |
170 XDrawPoints (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
171 gc_fore, p, size, CoordModeOrigin); |
90400 | 172 n[0] = 0; |
173 } | |
174 } | |
175 } | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
176 if (flush && n[0] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
177 XDrawPoints (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
178 gc_fore, p, n[0], CoordModeOrigin); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
179 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
180 else |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
181 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
182 for (i = 0, b = bitmap.buffer; i < bitmap.rows; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
183 i++, b += bitmap.pitch) |
90400 | 184 { |
185 for (j = 0; j < bitmap.width; j++) | |
186 { | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
187 int idx = (bitmap.bits_per_pixel == 1 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
188 ? ((b[j / 8] & (1 << (7 - (j % 8)))) ? 6 : -1) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
189 : (b[j] >> 5) - 1); |
90400 | 190 |
191 if (idx >= 0) | |
192 { | |
193 XPoint *pp = p + size * idx; | |
194 | |
195 pp[n[idx]].x = x + bitmap.left + j; | |
196 pp[n[idx]].y = y - bitmap.top + i; | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
197 if (++(n[idx]) == size) |
90400 | 198 { |
199 XDrawPoints (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
200 idx == 6 ? gc_fore : gcs[idx], pp, size, |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
201 CoordModeOrigin); |
90400 | 202 n[idx] = 0; |
203 } | |
204 } | |
205 } | |
206 } | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
207 if (flush) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
208 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
209 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
210 if (n[i] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
211 XDrawPoints (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
212 gcs[i], p + 0x100 * i, n[i], CoordModeOrigin); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
213 if (n[6] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
214 XDrawPoints (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
215 gc_fore, p + 0x600, n[6], CoordModeOrigin); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
216 } |
90400 | 217 } |
218 | |
219 if (ftfont_driver.free_bitmap) | |
220 ftfont_driver.free_bitmap (font, &bitmap); | |
221 | |
222 return bitmap.advance; | |
223 } | |
224 | |
225 static void | |
226 ftxfont_draw_backgrond (f, font, gc, x, y, width) | |
227 FRAME_PTR f; | |
228 struct font *font; | |
229 GC gc; | |
230 int x, y, width; | |
231 { | |
232 XGCValues xgcv; | |
233 | |
234 XGetGCValues (FRAME_X_DISPLAY (f), gc, | |
235 GCForeground | GCBackground, &xgcv); | |
236 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.background); | |
237 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
238 x, y - font->ascent, width, y + font->descent); |
90400 | 239 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground); |
240 } | |
241 | |
242 /* Prototypes for font-driver methods. */ | |
243 static Lisp_Object ftxfont_list P_ ((Lisp_Object, Lisp_Object)); | |
90560
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
244 static Lisp_Object ftxfont_match P_ ((Lisp_Object, Lisp_Object)); |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
245 static Lisp_Object ftxfont_open P_ ((FRAME_PTR, Lisp_Object, int)); |
90400 | 246 static void ftxfont_close P_ ((FRAME_PTR, struct font *)); |
247 static int ftxfont_draw P_ ((struct glyph_string *, int, int, int, int, int)); | |
248 | |
249 struct font_driver ftxfont_driver; | |
250 | |
251 static Lisp_Object | |
252 ftxfont_list (frame, spec) | |
253 Lisp_Object frame; | |
254 Lisp_Object spec; | |
255 { | |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
256 Lisp_Object list = ftfont_driver.list (frame, spec), tail; |
90400 | 257 |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
258 for (tail = list; CONSP (tail); tail = XCDR (tail)) |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
259 ASET (XCAR (tail), FONT_TYPE_INDEX, Qftx); |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
260 return list; |
90400 | 261 } |
262 | |
90560
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
263 static Lisp_Object |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
264 ftxfont_match (frame, spec) |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
265 Lisp_Object frame; |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
266 Lisp_Object spec; |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
267 { |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
268 Lisp_Object entity = ftfont_driver.match (frame, spec); |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
269 |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
270 if (VECTORP (entity)) |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
271 ASET (entity, FONT_TYPE_INDEX, Qftx); |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
272 return entity; |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
273 } |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
274 |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
275 static Lisp_Object |
90400 | 276 ftxfont_open (f, entity, pixel_size) |
277 FRAME_PTR f; | |
278 Lisp_Object entity; | |
279 int pixel_size; | |
280 { | |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
281 Lisp_Object font_object; |
90400 | 282 struct font *font; |
283 | |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
284 font_object = ftfont_driver.open (f, entity, pixel_size); |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
285 if (NILP (font_object)) |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
286 return Qnil; |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
287 font = XFONT_OBJECT (font_object); |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
288 font->driver = &ftxfont_driver; |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
289 return font_object; |
90400 | 290 } |
291 | |
292 static void | |
293 ftxfont_close (f, font) | |
294 FRAME_PTR f; | |
295 struct font *font; | |
296 { | |
297 ftfont_driver.close (f, font); | |
298 } | |
299 | |
300 static int | |
301 ftxfont_draw (s, from, to, x, y, with_background) | |
302 struct glyph_string *s; | |
303 int from, to, x, y, with_background; | |
304 { | |
305 FRAME_PTR f = s->f; | |
306 struct face *face = s->face; | |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
307 struct font *font = s->font; |
90400 | 308 XPoint p[0x700]; |
309 int n[7]; | |
310 unsigned *code; | |
311 int len = to - from; | |
312 int i; | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
313 GC *gcs; |
92186
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
314 int xadvance; |
90400 | 315 |
316 n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0; | |
317 | |
318 BLOCK_INPUT; | |
319 if (with_background) | |
320 ftxfont_draw_backgrond (f, font, s->gc, x, y, s->width); | |
321 code = alloca (sizeof (unsigned) * len); | |
322 for (i = 0; i < len; i++) | |
323 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8) | |
324 | XCHAR2B_BYTE2 (s->char2b + from + i)); | |
325 | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
326 if (face->gc == s->gc) |
90400 | 327 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
328 gcs = ftxfont_get_gcs (f, face->foreground, face->background); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
329 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
330 else |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
331 { |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
332 XGCValues xgcv; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
333 unsigned long mask = GCForeground | GCBackground; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
334 |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
335 XGetGCValues (FRAME_X_DISPLAY (f), s->gc, mask, &xgcv); |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
336 gcs = ftxfont_get_gcs (f, xgcv.foreground, xgcv.background); |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
337 } |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
338 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
339 if (gcs) |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
340 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
341 if (s->num_clips) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
342 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
343 XSetClipRectangles (FRAME_X_DISPLAY (f), gcs[i], 0, 0, |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
344 s->clip, s->num_clips, Unsorted); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
345 |
90400 | 346 for (i = 0; i < len; i++) |
92186
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
347 { |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
348 xadvance = ftxfont_draw_bitmap (f, s->gc, gcs, font, code[i], x, y, |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
349 p, 0x100, n, i + 1 == len); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
350 x += (s->padding_p ? 1 : xadvance); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
351 } |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
352 if (s->num_clips) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
353 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
354 XSetClipMask (FRAME_X_DISPLAY (f), gcs[i], None); |
90400 | 355 } |
356 else | |
357 { | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
358 /* We can't draw with antialiasing. |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
359 s->gc should already have a proper clipping setting. */ |
90400 | 360 for (i = 0; i < len; i++) |
92186
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
361 { |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
362 xadvance = ftxfont_draw_bitmap (f, s->gc, NULL, font, code[i], x, y, |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
363 p, 0x700, n, i + 1 == len); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
364 x += (s->padding_p ? 1 : xadvance); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
365 } |
90400 | 366 } |
367 | |
368 UNBLOCK_INPUT; | |
369 | |
370 return len; | |
371 } | |
372 | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
373 static int |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
374 ftxfont_end_for_frame (f) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
375 FRAME_PTR f; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
376 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
377 struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
378 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
379 BLOCK_INPUT; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
380 while (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
381 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
382 struct ftxfont_frame_data *next = data->next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
383 int i; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
384 |
91127
785637bd05d0
(ftxfont_end_for_frame): Fix array indexing error.
Kenichi Handa <handa@m17n.org>
parents:
91109
diff
changeset
|
385 for (i = 0; i < 6; i++) |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
386 XFreeGC (FRAME_X_DISPLAY (f), data->gcs[i]); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
387 free (data); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
388 data = next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
389 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
390 UNBLOCK_INPUT; |
91906
a18321dbb8fa
(ftxfont_default_fid): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
91605
diff
changeset
|
391 font_put_frame_data (f, &ftxfont_driver, NULL); |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
392 return 0; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
393 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
394 |
90400 | 395 |
396 | |
397 void | |
398 syms_of_ftxfont () | |
399 { | |
400 DEFSYM (Qftx, "ftx"); | |
401 | |
402 ftxfont_driver = ftfont_driver; | |
403 ftxfont_driver.type = Qftx; | |
404 ftxfont_driver.list = ftxfont_list; | |
90560
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
405 ftxfont_driver.match = ftxfont_match; |
90400 | 406 ftxfont_driver.open = ftxfont_open; |
407 ftxfont_driver.close = ftxfont_close; | |
408 ftxfont_driver.draw = ftxfont_draw; | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
409 ftxfont_driver.end_for_frame = ftxfont_end_for_frame; |
90400 | 410 register_font_driver (&ftxfont_driver, NULL); |
411 } | |
90427 | 412 |
413 /* arch-tag: 59bd3469-5330-413f-b29d-1aa36492abe8 | |
414 (do not change this comment) */ |