Mercurial > emacs
annotate src/ftxfont.c @ 92998:98176f05203c
*** empty log message ***
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sun, 16 Mar 2008 01:53:42 +0000 |
parents | 919240e47747 |
children | 4ac20761f264 |
rev | line source |
---|---|
90400 | 1 /* ftxfont.c -- FreeType font driver on X (without using XFT). |
91557
b5ae11e33e41
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
91127
diff
changeset
|
2 Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. |
b5ae11e33e41
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
91127
diff
changeset
|
3 Copyright (C) 2006, 2007, 2008 |
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 | |
9 GNU Emacs is free software; you can redistribute it and/or modify | |
10 it under the terms of the GNU General Public License as published by | |
91557
b5ae11e33e41
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
91127
diff
changeset
|
11 the Free Software Foundation; either version 3, or (at your option) |
90400 | 12 any later version. |
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 | |
20 along with GNU Emacs; see the file COPYING. If not, write to | |
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
22 Boston, MA 02110-1301, USA. */ | |
23 | |
24 #include <config.h> | |
25 #include <stdio.h> | |
26 #include <X11/Xlib.h> | |
27 | |
28 #include "lisp.h" | |
29 #include "dispextern.h" | |
30 #include "xterm.h" | |
31 #include "frame.h" | |
32 #include "blockinput.h" | |
33 #include "character.h" | |
34 #include "charset.h" | |
35 #include "fontset.h" | |
36 #include "font.h" | |
37 | |
38 /* FTX font driver. */ | |
39 | |
40 static Lisp_Object Qftx; | |
41 | |
42 /* Prototypes for helper function. */ | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
43 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
|
44 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
|
45 unsigned, int, int, XPoint *, int, int *, |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
46 int)); |
90400 | 47 static void ftxfont_draw_backgrond P_ ((FRAME_PTR, struct font *, GC, |
48 int, int, int)); | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
49 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
50 struct ftxfont_frame_data |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
51 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
52 /* Background and foreground colors. */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
53 XColor colors[2]; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
54 /* 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
|
55 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
|
56 FOREGROUND. */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
57 GC gcs[6]; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
58 struct ftxfont_frame_data *next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
59 }; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
60 |
91109
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 /* 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
|
63 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
64 static GC * |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
65 ftxfont_get_gcs (f, foreground, background) |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
66 FRAME_PTR f; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
67 unsigned long foreground, background; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
68 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
69 XColor color; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
70 XGCValues xgcv; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
71 int i; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
72 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
|
73 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
|
74 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
75 if (data) |
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 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
|
78 { |
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 continue; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
81 if (this->colors[0].pixel > background) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
82 break; |
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 continue; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
85 if (this->colors[1].pixel > foreground) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
86 break; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
87 return this->gcs; |
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 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
91 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
|
92 if (! new) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
93 return NULL; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
94 new->next = this; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
95 if (prev) |
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 prev->next = new; |
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 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
|
100 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
101 free (new); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
102 return NULL; |
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 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
105 new->colors[0].pixel = background; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
106 new->colors[1].pixel = foreground; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
107 |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
108 BLOCK_INPUT; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
109 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
|
110 for (i = 1; i < 7; i++) |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
111 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
112 /* Interpolate colors linearly. Any better algorithm? */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
113 color.red |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
114 = (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
|
115 color.green |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
116 = (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
|
117 color.blue |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
118 = (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
|
119 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
|
120 break; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
121 xgcv.foreground = color.pixel; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
122 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
|
123 GCForeground, &xgcv); |
90554
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 UNBLOCK_INPUT; |
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 if (i < 7) |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
128 { |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
129 BLOCK_INPUT; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
130 for (i--; i >= 0; i--) |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
131 XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]); |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
132 UNBLOCK_INPUT; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
133 if (prev) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
134 prev->next = new->next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
135 else if (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
136 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
|
137 free (new); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
138 return NULL; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
139 } |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
140 return new->gcs; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
141 } |
90400 | 142 |
143 static int | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
144 ftxfont_draw_bitmap (f, gc_fore, gcs, font, code, x, y, p, size, n, flush) |
90400 | 145 FRAME_PTR f; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
146 GC gc_fore, *gcs; |
90400 | 147 struct font *font; |
148 unsigned code; | |
149 int x, y; | |
150 XPoint *p; | |
151 int size, *n; | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
152 int flush; |
90400 | 153 { |
154 struct font_bitmap bitmap; | |
155 unsigned char *b; | |
156 int i, j; | |
157 | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
158 if (ftfont_driver.get_bitmap (font, code, &bitmap, size > 0x100 ? 1 : 8) < 0) |
90400 | 159 return 0; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
160 if (size > 0x100) |
90400 | 161 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
162 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
|
163 i++, b += bitmap.pitch) |
90400 | 164 { |
165 for (j = 0; j < bitmap.width; j++) | |
166 if (b[j / 8] & (1 << (7 - (j % 8)))) | |
167 { | |
168 p[n[0]].x = x + bitmap.left + j; | |
169 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
|
170 if (++n[0] == size) |
90400 | 171 { |
172 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
|
173 gc_fore, p, size, CoordModeOrigin); |
90400 | 174 n[0] = 0; |
175 } | |
176 } | |
177 } | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
178 if (flush && n[0] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
179 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
|
180 gc_fore, p, n[0], CoordModeOrigin); |
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 else |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
183 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
184 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
|
185 i++, b += bitmap.pitch) |
90400 | 186 { |
187 for (j = 0; j < bitmap.width; j++) | |
188 { | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
189 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
|
190 ? ((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
|
191 : (b[j] >> 5) - 1); |
90400 | 192 |
193 if (idx >= 0) | |
194 { | |
195 XPoint *pp = p + size * idx; | |
196 | |
197 pp[n[idx]].x = x + bitmap.left + j; | |
198 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
|
199 if (++(n[idx]) == size) |
90400 | 200 { |
201 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
|
202 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
|
203 CoordModeOrigin); |
90400 | 204 n[idx] = 0; |
205 } | |
206 } | |
207 } | |
208 } | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
209 if (flush) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
210 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
211 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
212 if (n[i] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
213 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
|
214 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
|
215 if (n[6] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
216 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
|
217 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
|
218 } |
90400 | 219 } |
220 | |
221 if (ftfont_driver.free_bitmap) | |
222 ftfont_driver.free_bitmap (font, &bitmap); | |
223 | |
224 return bitmap.advance; | |
225 } | |
226 | |
227 static void | |
228 ftxfont_draw_backgrond (f, font, gc, x, y, width) | |
229 FRAME_PTR f; | |
230 struct font *font; | |
231 GC gc; | |
232 int x, y, width; | |
233 { | |
234 XGCValues xgcv; | |
235 | |
236 XGetGCValues (FRAME_X_DISPLAY (f), gc, | |
237 GCForeground | GCBackground, &xgcv); | |
238 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.background); | |
239 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
|
240 x, y - font->ascent, width, y + font->descent); |
90400 | 241 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground); |
242 } | |
243 | |
244 /* Prototypes for font-driver methods. */ | |
245 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
|
246 static Lisp_Object ftxfont_match P_ ((Lisp_Object, Lisp_Object)); |
90400 | 247 static struct font *ftxfont_open P_ ((FRAME_PTR, Lisp_Object, int)); |
248 static void ftxfont_close P_ ((FRAME_PTR, struct font *)); | |
249 static int ftxfont_draw P_ ((struct glyph_string *, int, int, int, int, int)); | |
250 | |
251 struct font_driver ftxfont_driver; | |
252 | |
253 static Lisp_Object | |
254 ftxfont_list (frame, spec) | |
255 Lisp_Object frame; | |
256 Lisp_Object spec; | |
257 { | |
258 Lisp_Object val = ftfont_driver.list (frame, spec); | |
259 | |
260 if (! NILP (val)) | |
261 { | |
262 int i; | |
263 | |
264 for (i = 0; i < ASIZE (val); i++) | |
265 ASET (AREF (val, i), FONT_TYPE_INDEX, Qftx); | |
266 } | |
267 return val; | |
268 } | |
269 | |
90560
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
270 static Lisp_Object |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
271 ftxfont_match (frame, spec) |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
272 Lisp_Object frame; |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
273 Lisp_Object spec; |
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 Lisp_Object entity = ftfont_driver.match (frame, spec); |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
276 |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
277 if (VECTORP (entity)) |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
278 ASET (entity, FONT_TYPE_INDEX, Qftx); |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
279 return entity; |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
280 } |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
281 |
90400 | 282 static struct font * |
283 ftxfont_open (f, entity, pixel_size) | |
284 FRAME_PTR f; | |
285 Lisp_Object entity; | |
286 int pixel_size; | |
287 { | |
288 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | |
289 struct font *font; | |
290 XFontStruct *xfont = malloc (sizeof (XFontStruct)); | |
291 | |
292 if (! xfont) | |
293 return NULL; | |
294 font = ftfont_driver.open (f, entity, pixel_size); | |
295 if (! font) | |
296 { | |
297 free (xfont); | |
298 return NULL; | |
299 } | |
91906
a18321dbb8fa
(ftxfont_default_fid): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
91605
diff
changeset
|
300 xfont->fid = (Font) 0; |
90400 | 301 xfont->ascent = font->ascent; |
302 xfont->descent = font->descent; | |
303 xfont->max_bounds.width = font->font.size; | |
304 xfont->min_bounds.width = font->min_width; | |
305 font->font.font = xfont; | |
306 font->driver = &ftxfont_driver; | |
307 | |
308 dpyinfo->n_fonts++; | |
309 | |
310 /* Set global flag fonts_changed_p to non-zero if the font loaded | |
311 has a character with a smaller width than any other character | |
312 before, or if the font loaded has a smaller height than any other | |
313 font loaded before. If this happens, it will make a glyph matrix | |
314 reallocation necessary. */ | |
315 if (dpyinfo->n_fonts == 1) | |
316 { | |
317 dpyinfo->smallest_font_height = font->font.height; | |
318 dpyinfo->smallest_char_width = font->min_width; | |
319 fonts_changed_p = 1; | |
320 } | |
321 else | |
322 { | |
323 if (dpyinfo->smallest_font_height > font->font.height) | |
324 dpyinfo->smallest_font_height = font->font.height, fonts_changed_p |= 1; | |
325 if (dpyinfo->smallest_char_width > font->min_width) | |
326 dpyinfo->smallest_char_width = font->min_width, fonts_changed_p |= 1; | |
327 } | |
328 | |
91605 | 329 if (fonts_changed_p) |
330 { | |
331 if (dpyinfo->smallest_font_height == 0) | |
332 dpyinfo->smallest_font_height = 1; | |
333 if (dpyinfo->smallest_char_width == 0) | |
334 dpyinfo->smallest_char_width = 1; | |
335 } | |
336 | |
90400 | 337 return font; |
338 } | |
339 | |
340 static void | |
341 ftxfont_close (f, font) | |
342 FRAME_PTR f; | |
343 struct font *font; | |
344 { | |
345 ftfont_driver.close (f, font); | |
346 FRAME_X_DISPLAY_INFO (f)->n_fonts--; | |
347 } | |
348 | |
349 static int | |
350 ftxfont_draw (s, from, to, x, y, with_background) | |
351 struct glyph_string *s; | |
352 int from, to, x, y, with_background; | |
353 { | |
354 FRAME_PTR f = s->f; | |
355 struct face *face = s->face; | |
91579
d6609d967fc0
(ftxfont_draw): Use s->font_info, not face->font_info.
Kenichi Handa <handa@m17n.org>
parents:
91557
diff
changeset
|
356 struct font *font = (struct font *) s->font_info; |
90400 | 357 XPoint p[0x700]; |
358 int n[7]; | |
359 unsigned *code; | |
360 int len = to - from; | |
361 int i; | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
362 GC *gcs; |
92186
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
363 int xadvance; |
90400 | 364 |
365 n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0; | |
366 | |
367 BLOCK_INPUT; | |
368 if (with_background) | |
369 ftxfont_draw_backgrond (f, font, s->gc, x, y, s->width); | |
370 code = alloca (sizeof (unsigned) * len); | |
371 for (i = 0; i < len; i++) | |
372 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8) | |
373 | XCHAR2B_BYTE2 (s->char2b + from + i)); | |
374 | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
375 if (face->gc == s->gc) |
90400 | 376 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
377 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
|
378 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
379 else |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
380 { |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
381 XGCValues xgcv; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
382 unsigned long mask = GCForeground | GCBackground; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
383 |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
384 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
|
385 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
|
386 } |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
387 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
388 if (gcs) |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
389 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
390 if (s->num_clips) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
391 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
392 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
|
393 s->clip, s->num_clips, Unsorted); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
394 |
90400 | 395 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
|
396 { |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
397 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
|
398 p, 0x100, n, i + 1 == len); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
399 x += (s->padding_p ? 1 : xadvance); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
400 } |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
401 if (s->num_clips) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
402 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
403 XSetClipMask (FRAME_X_DISPLAY (f), gcs[i], None); |
90400 | 404 } |
405 else | |
406 { | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
407 /* We can't draw with antialiasing. |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
408 s->gc should already have a proper clipping setting. */ |
90400 | 409 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
|
410 { |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
411 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
|
412 p, 0x700, n, i + 1 == len); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
413 x += (s->padding_p ? 1 : xadvance); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
414 } |
90400 | 415 } |
416 | |
417 UNBLOCK_INPUT; | |
418 | |
419 return len; | |
420 } | |
421 | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
422 static int |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
423 ftxfont_end_for_frame (f) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
424 FRAME_PTR f; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
425 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
426 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
|
427 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
428 BLOCK_INPUT; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
429 while (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
430 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
431 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
|
432 int i; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
433 |
91127
785637bd05d0
(ftxfont_end_for_frame): Fix array indexing error.
Kenichi Handa <handa@m17n.org>
parents:
91109
diff
changeset
|
434 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
|
435 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
|
436 free (data); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
437 data = next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
438 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
439 UNBLOCK_INPUT; |
91906
a18321dbb8fa
(ftxfont_default_fid): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
91605
diff
changeset
|
440 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
|
441 return 0; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
442 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
443 |
90400 | 444 |
445 | |
446 void | |
447 syms_of_ftxfont () | |
448 { | |
449 DEFSYM (Qftx, "ftx"); | |
450 | |
451 ftxfont_driver = ftfont_driver; | |
452 ftxfont_driver.type = Qftx; | |
453 ftxfont_driver.list = ftxfont_list; | |
90560
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
454 ftxfont_driver.match = ftxfont_match; |
90400 | 455 ftxfont_driver.open = ftxfont_open; |
456 ftxfont_driver.close = ftxfont_close; | |
457 ftxfont_driver.draw = ftxfont_draw; | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
458 ftxfont_driver.end_for_frame = ftxfont_end_for_frame; |
90400 | 459 register_font_driver (&ftxfont_driver, NULL); |
460 } | |
90427 | 461 |
462 /* arch-tag: 59bd3469-5330-413f-b29d-1aa36492abe8 | |
463 (do not change this comment) */ |