annotate src/ftxfont.c @ 91634:69cda6392921

(USAGE3): Add --parent-id (standard_args): Ditto.
author Jan Djärv <jan.h.d@swipnet.se>
date Thu, 07 Feb 2008 14:08:20 +0000
parents ffe8367d4bdc
children a18321dbb8fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
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
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
4 National Institute of Advanced Industrial Science and Technology (AIST)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
5 Registration Number H13PRO009
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
6
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
7 This file is part of GNU Emacs.
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
8
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
9 GNU Emacs is free software; you can redistribute it and/or modify
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
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
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
12 any later version.
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
13
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
14 GNU Emacs is distributed in the hope that it will be useful,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
17 GNU General Public License for more details.
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
18
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
20 along with GNU Emacs; see the file COPYING. If not, write to
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
22 Boston, MA 02110-1301, USA. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
23
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
24 #include <config.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
25 #include <stdio.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
26 #include <X11/Xlib.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
27
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
28 #include "lisp.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
29 #include "dispextern.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
30 #include "xterm.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
31 #include "frame.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
32 #include "blockinput.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
33 #include "character.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
34 #include "charset.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
35 #include "fontset.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
36 #include "font.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
37
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
38 /* FTX font driver. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
39
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
40 static Lisp_Object Qftx;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
41
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
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
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
47 static void ftxfont_draw_backgrond P_ ((FRAME_PTR, struct font *, GC,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
48 int, int, int));
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
49 static Font ftxfont_default_fid P_ ((FRAME_PTR));
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
50
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
51 struct ftxfont_frame_data
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
52 {
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
53 /* Background and foreground colors. */
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
54 XColor colors[2];
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
55 /* 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
56 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
57 FOREGROUND. */
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
58 GC gcs[6];
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
59 struct ftxfont_frame_data *next;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
60 };
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
61
91109
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 /* 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
64
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
65 static GC *
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
66 ftxfont_get_gcs (f, foreground, background)
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
67 FRAME_PTR f;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
68 unsigned long foreground, background;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
69 {
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
70 XColor color;
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
71 XGCValues xgcv;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
72 int i;
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
73 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
74 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
75
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
76 if (data)
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 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
79 {
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 continue;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
82 if (this->colors[0].pixel > background)
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 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 continue;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
86 if (this->colors[1].pixel > foreground)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
87 break;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
88 return this->gcs;
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
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
92 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
93 if (! new)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
94 return NULL;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
95 new->next = this;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
96 if (prev)
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 prev->next = new;
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 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
101 {
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
102 free (new);
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
103 return NULL;
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
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
106 new->colors[0].pixel = background;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
107 new->colors[1].pixel = foreground;
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
108
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
109 BLOCK_INPUT;
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
110 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
111 for (i = 1; i < 7; i++)
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
112 {
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
113 /* Interpolate colors linearly. Any better algorithm? */
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
114 color.red
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
115 = (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
116 color.green
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
117 = (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
118 color.blue
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
119 = (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
120 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
121 break;
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
122 xgcv.foreground = color.pixel;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
123 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
124 GCForeground, &xgcv);
90554
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 UNBLOCK_INPUT;
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 if (i < 7)
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
129 {
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
130 BLOCK_INPUT;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
131 for (i--; i >= 0; i--)
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
132 XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]);
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
133 UNBLOCK_INPUT;
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
134 if (prev)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
135 prev->next = new->next;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
136 else if (data)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
137 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
138 free (new);
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
139 return NULL;
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
140 }
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
141 return new->gcs;
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
142 }
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
143
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
144 static int
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
145 ftxfont_draw_bitmap (f, gc_fore, gcs, font, code, x, y, p, size, n, flush)
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
146 FRAME_PTR f;
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
147 GC gc_fore, *gcs;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
148 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
149 unsigned code;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
150 int x, y;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
151 XPoint *p;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
152 int size, *n;
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
153 int flush;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
154 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
155 struct font_bitmap bitmap;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
156 unsigned char *b;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
157 int i, j;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
158
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
159 if (ftfont_driver.get_bitmap (font, code, &bitmap, size > 0x100 ? 1 : 8) < 0)
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
160 return 0;
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
161 if (size > 0x100)
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
162 {
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
163 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
164 i++, b += bitmap.pitch)
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
165 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
166 for (j = 0; j < bitmap.width; j++)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
167 if (b[j / 8] & (1 << (7 - (j % 8))))
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
168 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
169 p[n[0]].x = x + bitmap.left + j;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
170 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
171 if (++n[0] == size)
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
172 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
173 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
174 gc_fore, p, size, CoordModeOrigin);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
175 n[0] = 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
176 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
177 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
178 }
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
179 if (flush && n[0] > 0)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
180 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
181 gc_fore, p, n[0], CoordModeOrigin);
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 else
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
184 {
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
185 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
186 i++, b += bitmap.pitch)
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
187 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
188 for (j = 0; j < bitmap.width; j++)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
189 {
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
190 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
191 ? ((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
192 : (b[j] >> 5) - 1);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
193
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
194 if (idx >= 0)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
195 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
196 XPoint *pp = p + size * idx;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
197
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
198 pp[n[idx]].x = x + bitmap.left + j;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
199 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
200 if (++(n[idx]) == size)
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
201 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
202 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
203 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
204 CoordModeOrigin);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
205 n[idx] = 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
206 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
207 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
208 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
209 }
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
210 if (flush)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
211 {
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
212 for (i = 0; i < 6; i++)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
213 if (n[i] > 0)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
214 XDrawPoints (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
215 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
216 if (n[6] > 0)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
217 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
218 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
219 }
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
220 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
221
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
222 if (ftfont_driver.free_bitmap)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
223 ftfont_driver.free_bitmap (font, &bitmap);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
224
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
225 return bitmap.advance;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
226 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
227
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
228 static void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
229 ftxfont_draw_backgrond (f, font, gc, x, y, width)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
230 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
231 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
232 GC gc;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
233 int x, y, width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
234 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
235 XGCValues xgcv;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
236
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
237 XGetGCValues (FRAME_X_DISPLAY (f), gc,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
238 GCForeground | GCBackground, &xgcv);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
239 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.background);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
240 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
241 x, y - font->ascent, width, y + font->descent);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
242 XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
243 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
244
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
245 /* Return the default Font ID on frame F. */
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
246
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
247 static Font
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
248 ftxfont_default_fid (f)
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
249 FRAME_PTR f;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
250 {
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
251 static int fid_known;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
252 static Font fid;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
253
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
254 if (! fid_known)
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
255 {
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
256 fid = XLoadFont (FRAME_X_DISPLAY (f), "fixed");
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
257 if (! fid)
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
258 {
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
259 fid = XLoadFont (FRAME_X_DISPLAY (f), "*");
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
260 if (! fid)
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
261 abort ();
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
262 }
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
263 fid_known = 1;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
264 }
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
265 return fid;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
266 }
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
267
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
268 /* Prototypes for font-driver methods. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
269 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
270 static Lisp_Object ftxfont_match P_ ((Lisp_Object, Lisp_Object));
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
271 static struct font *ftxfont_open P_ ((FRAME_PTR, Lisp_Object, int));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
272 static void ftxfont_close P_ ((FRAME_PTR, struct font *));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
273 static int ftxfont_draw P_ ((struct glyph_string *, int, int, int, int, int));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
274
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
275 struct font_driver ftxfont_driver;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
276
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
277 static Lisp_Object
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
278 ftxfont_list (frame, spec)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
279 Lisp_Object frame;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
280 Lisp_Object spec;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
281 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
282 Lisp_Object val = ftfont_driver.list (frame, spec);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
283
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
284 if (! NILP (val))
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
285 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
286 int i;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
287
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
288 for (i = 0; i < ASIZE (val); i++)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
289 ASET (AREF (val, i), FONT_TYPE_INDEX, Qftx);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
290 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
291 return val;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
292 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
293
90560
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
294 static Lisp_Object
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
295 ftxfont_match (frame, spec)
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
296 Lisp_Object frame;
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
297 Lisp_Object spec;
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
298 {
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
299 Lisp_Object entity = ftfont_driver.match (frame, spec);
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
300
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
301 if (VECTORP (entity))
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
302 ASET (entity, FONT_TYPE_INDEX, Qftx);
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
303 return entity;
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
304 }
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
305
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
306 static struct font *
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
307 ftxfont_open (f, entity, pixel_size)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
308 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
309 Lisp_Object entity;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
310 int pixel_size;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
311 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
312 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
313 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
314 XFontStruct *xfont = malloc (sizeof (XFontStruct));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
315
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
316 if (! xfont)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
317 return NULL;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
318 font = ftfont_driver.open (f, entity, pixel_size);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
319 if (! font)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
320 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
321 free (xfont);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
322 return NULL;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
323 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
324
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
325 xfont->fid = ftxfont_default_fid (f);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
326 xfont->ascent = font->ascent;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
327 xfont->descent = font->descent;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
328 xfont->max_bounds.width = font->font.size;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
329 xfont->min_bounds.width = font->min_width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
330 font->font.font = xfont;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
331 font->driver = &ftxfont_driver;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
332
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
333 dpyinfo->n_fonts++;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
334
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
335 /* Set global flag fonts_changed_p to non-zero if the font loaded
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
336 has a character with a smaller width than any other character
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
337 before, or if the font loaded has a smaller height than any other
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
338 font loaded before. If this happens, it will make a glyph matrix
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
339 reallocation necessary. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
340 if (dpyinfo->n_fonts == 1)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
341 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
342 dpyinfo->smallest_font_height = font->font.height;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
343 dpyinfo->smallest_char_width = font->min_width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
344 fonts_changed_p = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
345 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
346 else
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
347 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
348 if (dpyinfo->smallest_font_height > font->font.height)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
349 dpyinfo->smallest_font_height = font->font.height, fonts_changed_p |= 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
350 if (dpyinfo->smallest_char_width > font->min_width)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
351 dpyinfo->smallest_char_width = font->min_width, fonts_changed_p |= 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
352 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
353
91605
ffe8367d4bdc (ftxfont_open): Don't set
Kenichi Handa <handa@m17n.org>
parents: 91579
diff changeset
354 if (fonts_changed_p)
ffe8367d4bdc (ftxfont_open): Don't set
Kenichi Handa <handa@m17n.org>
parents: 91579
diff changeset
355 {
ffe8367d4bdc (ftxfont_open): Don't set
Kenichi Handa <handa@m17n.org>
parents: 91579
diff changeset
356 if (dpyinfo->smallest_font_height == 0)
ffe8367d4bdc (ftxfont_open): Don't set
Kenichi Handa <handa@m17n.org>
parents: 91579
diff changeset
357 dpyinfo->smallest_font_height = 1;
ffe8367d4bdc (ftxfont_open): Don't set
Kenichi Handa <handa@m17n.org>
parents: 91579
diff changeset
358 if (dpyinfo->smallest_char_width == 0)
ffe8367d4bdc (ftxfont_open): Don't set
Kenichi Handa <handa@m17n.org>
parents: 91579
diff changeset
359 dpyinfo->smallest_char_width = 1;
ffe8367d4bdc (ftxfont_open): Don't set
Kenichi Handa <handa@m17n.org>
parents: 91579
diff changeset
360 }
ffe8367d4bdc (ftxfont_open): Don't set
Kenichi Handa <handa@m17n.org>
parents: 91579
diff changeset
361
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
362 return font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
363 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
364
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
365 static void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
366 ftxfont_close (f, font)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
367 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
368 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
369 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
370 ftfont_driver.close (f, font);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
371 FRAME_X_DISPLAY_INFO (f)->n_fonts--;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
372 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
373
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
374 static int
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
375 ftxfont_draw (s, from, to, x, y, with_background)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
376 struct glyph_string *s;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
377 int from, to, x, y, with_background;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
378 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
379 FRAME_PTR f = s->f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
380 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
381 struct font *font = (struct font *) s->font_info;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
382 XPoint p[0x700];
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
383 int n[7];
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
384 unsigned *code;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
385 int len = to - from;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
386 int i;
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
387 GC *gcs;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
388
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
389 n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
390
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
391 BLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
392 if (with_background)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
393 ftxfont_draw_backgrond (f, font, s->gc, x, y, s->width);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
394 code = alloca (sizeof (unsigned) * len);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
395 for (i = 0; i < len; i++)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
396 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
397 | XCHAR2B_BYTE2 (s->char2b + from + i));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
398
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
399 if (face->gc == s->gc)
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
400 {
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
401 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
402 }
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
403 else
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
404 {
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
405 XGCValues xgcv;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
406 unsigned long mask = GCForeground | GCBackground;
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
407
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
408 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
409 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
410 }
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
411
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
412 if (gcs)
90554
d0351223b22a (ftxfont_create_gcs): New function.
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
413 {
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
414 if (s->num_clips)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
415 for (i = 0; i < 6; i++)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
416 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
417 s->clip, s->num_clips, Unsorted);
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
418
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
419 for (i = 0; i < len; i++)
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
420 x += ftxfont_draw_bitmap (f, s->gc, gcs, font, code[i], x, y,
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
421 p, 0x100, n, i + 1 == len);
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
422 if (s->num_clips)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
423 for (i = 0; i < 6; i++)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
424 XSetClipMask (FRAME_X_DISPLAY (f), gcs[i], None);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
425 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
426 else
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
427 {
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
428 /* We can't draw with antialiasing.
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
429 s->gc should already have a proper clipping setting. */
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
430 for (i = 0; i < len; i++)
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
431 x += ftxfont_draw_bitmap (f, s->gc, NULL, font, code[i], x, y,
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
432 p, 0x700, n, i + 1 == len);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
433 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
434
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
435 UNBLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
436
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
437 return len;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
438 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
439
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
440 static int
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
441 ftxfont_end_for_frame (f)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
442 FRAME_PTR f;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
443 {
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
444 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
445
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
446 BLOCK_INPUT;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
447 while (data)
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
448 {
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
449 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
450 int i;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
451
91127
785637bd05d0 (ftxfont_end_for_frame): Fix array indexing error.
Kenichi Handa <handa@m17n.org>
parents: 91109
diff changeset
452 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
453 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
454 free (data);
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
455 data = next;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
456 }
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
457 UNBLOCK_INPUT;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
458 return 0;
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
459 }
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
460
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
461
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
462
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
463 void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
464 syms_of_ftxfont ()
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
465 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
466 DEFSYM (Qftx, "ftx");
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
467
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
468 ftxfont_driver = ftfont_driver;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
469 ftxfont_driver.type = Qftx;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
470 ftxfont_driver.list = ftxfont_list;
90560
c443c8a56b84 (ftxfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90554
diff changeset
471 ftxfont_driver.match = ftxfont_match;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
472 ftxfont_driver.open = ftxfont_open;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
473 ftxfont_driver.close = ftxfont_close;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
474 ftxfont_driver.draw = ftxfont_draw;
91109
5ed0717083a1 (ftxfont_get_gcs): Renamed from ftxfont_create_gcs.
Kenichi Handa <handa@m17n.org>
parents: 90560
diff changeset
475 ftxfont_driver.end_for_frame = ftxfont_end_for_frame;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
476 register_font_driver (&ftxfont_driver, NULL);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
477 }
90427
ddb25860d044 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 90400
diff changeset
478
ddb25860d044 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 90400
diff changeset
479 /* arch-tag: 59bd3469-5330-413f-b29d-1aa36492abe8
ddb25860d044 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 90400
diff changeset
480 (do not change this comment) */