Mercurial > emacs
annotate src/ftxfont.c @ 112066:4c862bc17cdb
merge emacs-23
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 24 Dec 2010 20:18:12 +0900 |
parents | 1d1d5d9bd884 |
children | 2bc9a0c04c87 376148b31b5e |
rev | line source |
---|---|
90400 | 1 /* ftxfont.c -- FreeType font driver on X (without using XFT). |
106815 | 2 Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
3 Copyright (C) 2006, 2007, 2008, 2009, 2010 | |
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> | |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
102862
diff
changeset
|
24 #include <setjmp.h> |
90400 | 25 #include <X11/Xlib.h> |
26 | |
27 #include "lisp.h" | |
28 #include "dispextern.h" | |
29 #include "xterm.h" | |
30 #include "frame.h" | |
31 #include "blockinput.h" | |
32 #include "character.h" | |
33 #include "charset.h" | |
34 #include "fontset.h" | |
35 #include "font.h" | |
36 | |
37 /* FTX font driver. */ | |
38 | |
39 static Lisp_Object Qftx; | |
40 | |
41 /* Prototypes for helper function. */ | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
42 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
|
43 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
|
44 unsigned, int, int, XPoint *, int, int *, |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
45 int)); |
90400 | 46 static void ftxfont_draw_backgrond P_ ((FRAME_PTR, struct font *, GC, |
47 int, int, int)); | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
48 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
49 struct ftxfont_frame_data |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
50 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
51 /* Background and foreground colors. */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
52 XColor colors[2]; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
53 /* 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
|
54 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
|
55 FOREGROUND. */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
56 GC gcs[6]; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
57 struct ftxfont_frame_data *next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
58 }; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
59 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
60 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
61 /* 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
|
62 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
63 static GC * |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
64 ftxfont_get_gcs (f, foreground, background) |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
65 FRAME_PTR f; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
66 unsigned long foreground, background; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
67 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
68 XColor color; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
69 XGCValues xgcv; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
70 int i; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
71 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
|
72 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
|
73 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
74 if (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
75 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
76 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
|
77 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
78 if (this->colors[0].pixel < background) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
79 continue; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
80 if (this->colors[0].pixel > background) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
81 break; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
82 if (this->colors[1].pixel < foreground) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
83 continue; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
84 if (this->colors[1].pixel > foreground) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
85 break; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
86 return this->gcs; |
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 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
90 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
|
91 if (! new) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
92 return NULL; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
93 new->next = this; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
94 if (prev) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
95 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
96 prev->next = new; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
97 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
98 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
|
99 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
100 free (new); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
101 return NULL; |
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 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
104 new->colors[0].pixel = background; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
105 new->colors[1].pixel = foreground; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
106 |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
107 BLOCK_INPUT; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
108 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
|
109 for (i = 1; i < 7; i++) |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
110 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
111 /* Interpolate colors linearly. Any better algorithm? */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
112 color.red |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
113 = (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
|
114 color.green |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
115 = (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
|
116 color.blue |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
117 = (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
|
118 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
|
119 break; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
120 xgcv.foreground = color.pixel; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
121 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
|
122 GCForeground, &xgcv); |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
123 } |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
124 UNBLOCK_INPUT; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
125 |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
126 if (i < 7) |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
127 { |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
128 BLOCK_INPUT; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
129 for (i--; i >= 0; i--) |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
130 XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]); |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
131 UNBLOCK_INPUT; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
132 if (prev) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
133 prev->next = new->next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
134 else if (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
135 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
|
136 free (new); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
137 return NULL; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
138 } |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
139 return new->gcs; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
140 } |
90400 | 141 |
142 static int | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
143 ftxfont_draw_bitmap (f, gc_fore, gcs, font, code, x, y, p, size, n, flush) |
90400 | 144 FRAME_PTR f; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
145 GC gc_fore, *gcs; |
90400 | 146 struct font *font; |
147 unsigned code; | |
148 int x, y; | |
149 XPoint *p; | |
150 int size, *n; | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
151 int flush; |
90400 | 152 { |
153 struct font_bitmap bitmap; | |
154 unsigned char *b; | |
155 int i, j; | |
156 | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
157 if (ftfont_driver.get_bitmap (font, code, &bitmap, size > 0x100 ? 1 : 8) < 0) |
90400 | 158 return 0; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
159 if (size > 0x100) |
90400 | 160 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
161 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
|
162 i++, b += bitmap.pitch) |
90400 | 163 { |
164 for (j = 0; j < bitmap.width; j++) | |
165 if (b[j / 8] & (1 << (7 - (j % 8)))) | |
166 { | |
167 p[n[0]].x = x + bitmap.left + j; | |
168 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
|
169 if (++n[0] == size) |
90400 | 170 { |
171 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
|
172 gc_fore, p, size, CoordModeOrigin); |
90400 | 173 n[0] = 0; |
174 } | |
175 } | |
176 } | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
177 if (flush && n[0] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
178 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
|
179 gc_fore, p, n[0], CoordModeOrigin); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
180 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
181 else |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
182 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
183 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
|
184 i++, b += bitmap.pitch) |
90400 | 185 { |
186 for (j = 0; j < bitmap.width; j++) | |
187 { | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
188 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
|
189 ? ((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
|
190 : (b[j] >> 5) - 1); |
90400 | 191 |
192 if (idx >= 0) | |
193 { | |
194 XPoint *pp = p + size * idx; | |
195 | |
196 pp[n[idx]].x = x + bitmap.left + j; | |
197 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
|
198 if (++(n[idx]) == size) |
90400 | 199 { |
200 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
|
201 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
|
202 CoordModeOrigin); |
90400 | 203 n[idx] = 0; |
204 } | |
205 } | |
206 } | |
207 } | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
208 if (flush) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
209 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
210 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
211 if (n[i] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
212 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
|
213 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
|
214 if (n[6] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
215 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
|
216 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
|
217 } |
90400 | 218 } |
219 | |
220 if (ftfont_driver.free_bitmap) | |
221 ftfont_driver.free_bitmap (font, &bitmap); | |
222 | |
223 return bitmap.advance; | |
224 } | |
225 | |
226 static void | |
227 ftxfont_draw_backgrond (f, font, gc, x, y, width) | |
228 FRAME_PTR f; | |
229 struct font *font; | |
230 GC gc; | |
231 int x, y, width; | |
232 { | |
233 XGCValues xgcv; | |
234 | |
235 XGetGCValues (FRAME_X_DISPLAY (f), gc, | |
236 GCForeground | GCBackground, &xgcv); | |
237 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.background); | |
238 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, | |
102862
edcf6efdc10a
(ftxfont_draw_backgrond): Fix args to XFillRectangle.
Kenichi Handa <handa@m17n.org>
parents:
100951
diff
changeset
|
239 x, y - FONT_BASE (font), width, FONT_HEIGHT (font)); |
90400 | 240 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground); |
241 } | |
242 | |
243 /* Prototypes for font-driver methods. */ | |
244 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
|
245 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
|
246 static Lisp_Object ftxfont_open P_ ((FRAME_PTR, Lisp_Object, int)); |
90400 | 247 static void ftxfont_close P_ ((FRAME_PTR, struct font *)); |
248 static int ftxfont_draw P_ ((struct glyph_string *, int, int, int, int, int)); | |
249 | |
250 struct font_driver ftxfont_driver; | |
251 | |
252 static Lisp_Object | |
253 ftxfont_list (frame, spec) | |
254 Lisp_Object frame; | |
255 Lisp_Object spec; | |
256 { | |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
257 Lisp_Object list = ftfont_driver.list (frame, spec), tail; |
90400 | 258 |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
259 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
|
260 ASET (XCAR (tail), FONT_TYPE_INDEX, Qftx); |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
261 return list; |
90400 | 262 } |
263 | |
90560
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
264 static Lisp_Object |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
265 ftxfont_match (frame, spec) |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
266 Lisp_Object frame; |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
267 Lisp_Object spec; |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
268 { |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
269 Lisp_Object entity = ftfont_driver.match (frame, spec); |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
270 |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
271 if (VECTORP (entity)) |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
272 ASET (entity, FONT_TYPE_INDEX, Qftx); |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
273 return entity; |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
274 } |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
275 |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
276 static Lisp_Object |
90400 | 277 ftxfont_open (f, entity, pixel_size) |
278 FRAME_PTR f; | |
279 Lisp_Object entity; | |
280 int pixel_size; | |
281 { | |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
282 Lisp_Object font_object; |
90400 | 283 struct font *font; |
284 | |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
285 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
|
286 if (NILP (font_object)) |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
287 return Qnil; |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
288 font = XFONT_OBJECT (font_object); |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
289 font->driver = &ftxfont_driver; |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
290 return font_object; |
90400 | 291 } |
292 | |
293 static void | |
294 ftxfont_close (f, font) | |
295 FRAME_PTR f; | |
296 struct font *font; | |
297 { | |
298 ftfont_driver.close (f, font); | |
299 } | |
300 | |
301 static int | |
302 ftxfont_draw (s, from, to, x, y, with_background) | |
303 struct glyph_string *s; | |
304 int from, to, x, y, with_background; | |
305 { | |
306 FRAME_PTR f = s->f; | |
307 struct face *face = s->face; | |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
308 struct font *font = s->font; |
90400 | 309 XPoint p[0x700]; |
310 int n[7]; | |
311 unsigned *code; | |
312 int len = to - from; | |
313 int i; | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
314 GC *gcs; |
92186
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
315 int xadvance; |
90400 | 316 |
317 n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0; | |
318 | |
319 BLOCK_INPUT; | |
320 if (with_background) | |
321 ftxfont_draw_backgrond (f, font, s->gc, x, y, s->width); | |
322 code = alloca (sizeof (unsigned) * len); | |
323 for (i = 0; i < len; i++) | |
324 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8) | |
325 | XCHAR2B_BYTE2 (s->char2b + from + i)); | |
326 | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
327 if (face->gc == s->gc) |
90400 | 328 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
329 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
|
330 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
331 else |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
332 { |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
333 XGCValues xgcv; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
334 unsigned long mask = GCForeground | GCBackground; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
335 |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
336 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
|
337 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
|
338 } |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
339 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
340 if (gcs) |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
341 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
342 if (s->num_clips) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
343 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
344 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
|
345 s->clip, s->num_clips, Unsorted); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
346 |
90400 | 347 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
|
348 { |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
349 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
|
350 p, 0x100, n, i + 1 == len); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
351 x += (s->padding_p ? 1 : xadvance); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
352 } |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
353 if (s->num_clips) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
354 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
355 XSetClipMask (FRAME_X_DISPLAY (f), gcs[i], None); |
90400 | 356 } |
357 else | |
358 { | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
359 /* We can't draw with antialiasing. |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
360 s->gc should already have a proper clipping setting. */ |
90400 | 361 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
|
362 { |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
363 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
|
364 p, 0x700, n, i + 1 == len); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
365 x += (s->padding_p ? 1 : xadvance); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
366 } |
90400 | 367 } |
368 | |
369 UNBLOCK_INPUT; | |
370 | |
371 return len; | |
372 } | |
373 | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
374 static int |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
375 ftxfont_end_for_frame (f) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
376 FRAME_PTR f; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
377 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
378 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
|
379 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
380 BLOCK_INPUT; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
381 while (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
382 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
383 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
|
384 int i; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
385 |
91127
785637bd05d0
(ftxfont_end_for_frame): Fix array indexing error.
Kenichi Handa <handa@m17n.org>
parents:
91109
diff
changeset
|
386 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
|
387 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
|
388 free (data); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
389 data = next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
390 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
391 UNBLOCK_INPUT; |
91906
a18321dbb8fa
(ftxfont_default_fid): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
91605
diff
changeset
|
392 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
|
393 return 0; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
394 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
395 |
90400 | 396 |
397 | |
398 void | |
399 syms_of_ftxfont () | |
400 { | |
401 DEFSYM (Qftx, "ftx"); | |
402 | |
403 ftxfont_driver = ftfont_driver; | |
404 ftxfont_driver.type = Qftx; | |
405 ftxfont_driver.list = ftxfont_list; | |
90560
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
406 ftxfont_driver.match = ftxfont_match; |
90400 | 407 ftxfont_driver.open = ftxfont_open; |
408 ftxfont_driver.close = ftxfont_close; | |
409 ftxfont_driver.draw = ftxfont_draw; | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
410 ftxfont_driver.end_for_frame = ftxfont_end_for_frame; |
90400 | 411 register_font_driver (&ftxfont_driver, NULL); |
412 } | |
90427 | 413 |
414 /* arch-tag: 59bd3469-5330-413f-b29d-1aa36492abe8 | |
415 (do not change this comment) */ |