Mercurial > emacs
annotate src/ftxfont.c @ 112429:6e50030da731
Some copyright.el updates.
* lisp/emacs-lisp/copyright.el (copyright-find-copyright): New function,
split out from copyright-update-year.
(copyright-update): Don't mess with the GPL version if we don't own the
copyright. Update license regexp, and remove no longer needed
Esperanto stuff.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 22 Jan 2011 14:09:09 -0800 |
parents | ef719132ddfa |
children |
rev | line source |
---|---|
90400 | 1 /* ftxfont.c -- FreeType font driver on X (without using XFT). |
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
3 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 |
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. */ | |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
42 static GC *ftxfont_get_gcs (FRAME_PTR, unsigned long, unsigned long); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
43 static int ftxfont_draw_bitmap (FRAME_PTR, GC, GC *, struct font *, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
44 unsigned, int, int, XPoint *, int, int *, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
45 int); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
46 static void ftxfont_draw_backgrond (FRAME_PTR, struct font *, GC, |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
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 * |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
64 ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int background) |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
65 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
66 XColor color; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
67 XGCValues xgcv; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
68 int i; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
69 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
|
70 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
|
71 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
72 if (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
73 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
74 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
|
75 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
76 if (this->colors[0].pixel < background) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
77 continue; |
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 break; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
80 if (this->colors[1].pixel < foreground) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
81 continue; |
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 break; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
84 return this->gcs; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
85 } |
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 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
|
89 if (! new) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
90 return NULL; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
91 new->next = this; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
92 if (prev) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
93 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
94 prev->next = new; |
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 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
|
97 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
98 free (new); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
99 return NULL; |
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 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
102 new->colors[0].pixel = background; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
103 new->colors[1].pixel = foreground; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
104 |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
105 BLOCK_INPUT; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
106 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
|
107 for (i = 1; i < 7; i++) |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
108 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
109 /* Interpolate colors linearly. Any better algorithm? */ |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
110 color.red |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
111 = (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
|
112 color.green |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
113 = (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
|
114 color.blue |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
115 = (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
|
116 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
|
117 break; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
118 xgcv.foreground = color.pixel; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
119 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
|
120 GCForeground, &xgcv); |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
121 } |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
122 UNBLOCK_INPUT; |
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 if (i < 7) |
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 BLOCK_INPUT; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
127 for (i--; i >= 0; i--) |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
128 XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]); |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
129 UNBLOCK_INPUT; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
130 if (prev) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
131 prev->next = new->next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
132 else if (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
133 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
|
134 free (new); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
135 return NULL; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
136 } |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
137 return new->gcs; |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
138 } |
90400 | 139 |
140 static int | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
141 ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, unsigned int code, int x, int y, XPoint *p, int size, int *n, int flush) |
90400 | 142 { |
143 struct font_bitmap bitmap; | |
144 unsigned char *b; | |
145 int i, j; | |
146 | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
147 if (ftfont_driver.get_bitmap (font, code, &bitmap, size > 0x100 ? 1 : 8) < 0) |
90400 | 148 return 0; |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
149 if (size > 0x100) |
90400 | 150 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
151 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
|
152 i++, b += bitmap.pitch) |
90400 | 153 { |
154 for (j = 0; j < bitmap.width; j++) | |
155 if (b[j / 8] & (1 << (7 - (j % 8)))) | |
156 { | |
157 p[n[0]].x = x + bitmap.left + j; | |
158 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
|
159 if (++n[0] == size) |
90400 | 160 { |
161 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
|
162 gc_fore, p, size, CoordModeOrigin); |
90400 | 163 n[0] = 0; |
164 } | |
165 } | |
166 } | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
167 if (flush && n[0] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
168 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
|
169 gc_fore, p, n[0], CoordModeOrigin); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
170 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
171 else |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
172 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
173 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
|
174 i++, b += bitmap.pitch) |
90400 | 175 { |
176 for (j = 0; j < bitmap.width; j++) | |
177 { | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
178 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
|
179 ? ((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
|
180 : (b[j] >> 5) - 1); |
90400 | 181 |
182 if (idx >= 0) | |
183 { | |
184 XPoint *pp = p + size * idx; | |
185 | |
186 pp[n[idx]].x = x + bitmap.left + j; | |
187 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
|
188 if (++(n[idx]) == size) |
90400 | 189 { |
190 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
|
191 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
|
192 CoordModeOrigin); |
90400 | 193 n[idx] = 0; |
194 } | |
195 } | |
196 } | |
197 } | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
198 if (flush) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
199 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
200 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
201 if (n[i] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
202 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
|
203 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
|
204 if (n[6] > 0) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
205 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
|
206 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
|
207 } |
90400 | 208 } |
209 | |
210 if (ftfont_driver.free_bitmap) | |
211 ftfont_driver.free_bitmap (font, &bitmap); | |
212 | |
213 return bitmap.advance; | |
214 } | |
215 | |
216 static void | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
217 ftxfont_draw_backgrond (FRAME_PTR f, struct font *font, GC gc, int x, int y, int width) |
90400 | 218 { |
219 XGCValues xgcv; | |
220 | |
221 XGetGCValues (FRAME_X_DISPLAY (f), gc, | |
222 GCForeground | GCBackground, &xgcv); | |
223 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.background); | |
224 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
|
225 x, y - FONT_BASE (font), width, FONT_HEIGHT (font)); |
90400 | 226 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground); |
227 } | |
228 | |
229 /* Prototypes for font-driver methods. */ | |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
230 static Lisp_Object ftxfont_list (Lisp_Object, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
231 static Lisp_Object ftxfont_match (Lisp_Object, Lisp_Object); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
232 static Lisp_Object ftxfont_open (FRAME_PTR, Lisp_Object, int); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
233 static void ftxfont_close (FRAME_PTR, struct font *); |
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
234 static int ftxfont_draw (struct glyph_string *, int, int, int, int, int); |
90400 | 235 |
236 struct font_driver ftxfont_driver; | |
237 | |
238 static Lisp_Object | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
239 ftxfont_list (Lisp_Object frame, Lisp_Object spec) |
90400 | 240 { |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
241 Lisp_Object list = ftfont_driver.list (frame, spec), tail; |
90400 | 242 |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
243 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
|
244 ASET (XCAR (tail), FONT_TYPE_INDEX, Qftx); |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
245 return list; |
90400 | 246 } |
247 | |
90560
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
248 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
249 ftxfont_match (Lisp_Object frame, Lisp_Object spec) |
90560
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
250 { |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
251 Lisp_Object entity = ftfont_driver.match (frame, spec); |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
252 |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
253 if (VECTORP (entity)) |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
254 ASET (entity, FONT_TYPE_INDEX, Qftx); |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
255 return entity; |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
256 } |
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
257 |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
258 static Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
259 ftxfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) |
90400 | 260 { |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
261 Lisp_Object font_object; |
90400 | 262 struct font *font; |
263 | |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
264 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
|
265 if (NILP (font_object)) |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
266 return Qnil; |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
267 font = XFONT_OBJECT (font_object); |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
268 font->driver = &ftxfont_driver; |
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
269 return font_object; |
90400 | 270 } |
271 | |
272 static void | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
273 ftxfont_close (FRAME_PTR f, struct font *font) |
90400 | 274 { |
275 ftfont_driver.close (f, font); | |
276 } | |
277 | |
278 static int | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
279 ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) |
90400 | 280 { |
281 FRAME_PTR f = s->f; | |
282 struct face *face = s->face; | |
94932
4ac20761f264
(ftxfont_list): Return a list, not vector.
Kenichi Handa <handa@m17n.org>
parents:
92186
diff
changeset
|
283 struct font *font = s->font; |
90400 | 284 XPoint p[0x700]; |
285 int n[7]; | |
286 unsigned *code; | |
287 int len = to - from; | |
288 int i; | |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
289 GC *gcs; |
92186
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
290 int xadvance; |
90400 | 291 |
292 n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0; | |
293 | |
294 BLOCK_INPUT; | |
295 if (with_background) | |
296 ftxfont_draw_backgrond (f, font, s->gc, x, y, s->width); | |
297 code = alloca (sizeof (unsigned) * len); | |
298 for (i = 0; i < len; i++) | |
299 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8) | |
300 | XCHAR2B_BYTE2 (s->char2b + from + i)); | |
301 | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
302 if (face->gc == s->gc) |
90400 | 303 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
304 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
|
305 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
306 else |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
307 { |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
308 XGCValues xgcv; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
309 unsigned long mask = GCForeground | GCBackground; |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
310 |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
311 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
|
312 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
|
313 } |
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
314 |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
315 if (gcs) |
90554
d0351223b22a
(ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
316 { |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
317 if (s->num_clips) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
318 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
319 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
|
320 s->clip, s->num_clips, Unsorted); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
321 |
90400 | 322 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
|
323 { |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
324 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
|
325 p, 0x100, n, i + 1 == len); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
326 x += (s->padding_p ? 1 : xadvance); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
327 } |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
328 if (s->num_clips) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
329 for (i = 0; i < 6; i++) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
330 XSetClipMask (FRAME_X_DISPLAY (f), gcs[i], None); |
90400 | 331 } |
332 else | |
333 { | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
334 /* We can't draw with antialiasing. |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
335 s->gc should already have a proper clipping setting. */ |
90400 | 336 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
|
337 { |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
338 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
|
339 p, 0x700, n, i + 1 == len); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
340 x += (s->padding_p ? 1 : xadvance); |
919240e47747
(ftxfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91906
diff
changeset
|
341 } |
90400 | 342 } |
343 | |
344 UNBLOCK_INPUT; | |
345 | |
346 return len; | |
347 } | |
348 | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
349 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
350 ftxfont_end_for_frame (FRAME_PTR f) |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
351 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
352 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
|
353 |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
354 BLOCK_INPUT; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
355 while (data) |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
356 { |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
357 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
|
358 int i; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
359 |
91127
785637bd05d0
(ftxfont_end_for_frame): Fix array indexing error.
Kenichi Handa <handa@m17n.org>
parents:
91109
diff
changeset
|
360 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
|
361 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
|
362 free (data); |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
363 data = next; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
364 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
365 UNBLOCK_INPUT; |
91906
a18321dbb8fa
(ftxfont_default_fid): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
91605
diff
changeset
|
366 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
|
367 return 0; |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
368 } |
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
369 |
90400 | 370 |
371 | |
372 void | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
373 syms_of_ftxfont (void) |
90400 | 374 { |
375 DEFSYM (Qftx, "ftx"); | |
376 | |
377 ftxfont_driver = ftfont_driver; | |
378 ftxfont_driver.type = Qftx; | |
379 ftxfont_driver.list = ftxfont_list; | |
90560
c443c8a56b84
(ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90554
diff
changeset
|
380 ftxfont_driver.match = ftxfont_match; |
90400 | 381 ftxfont_driver.open = ftxfont_open; |
382 ftxfont_driver.close = ftxfont_close; | |
383 ftxfont_driver.draw = ftxfont_draw; | |
91109
5ed0717083a1
(ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents:
90560
diff
changeset
|
384 ftxfont_driver.end_for_frame = ftxfont_end_for_frame; |
90400 | 385 register_font_driver (&ftxfont_driver, NULL); |
386 } | |
90427 | 387 |