Mercurial > emacs
comparison src/font.h @ 91549:4f94f3794026
(enum lgstring_indices, enum lglyph_indices): New enums.
(LGSTRING_SLOT, LGSTRING_SET_SLOT): New macros.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 06 Feb 2008 03:12:57 +0000 |
parents | 8e67cd1b2741 |
children | 1ab24b8a7398 |
comparison
equal
deleted
inserted
replaced
91548:63d4513550f9 | 91549:4f94f3794026 |
---|---|
1 /* font.h -- Interface definition for font handling. | 1 /* font.h -- Interface definition for font handling. |
2 Copyright (C) 2006 Free Software Foundation, Inc. | 2 Copyright (C) 2006, 2008 Free Software Foundation, Inc. |
3 Copyright (C) 2006 | 3 Copyright (C) 2006 |
4 National Institute of Advanced Industrial Science and Technology (AIST) | 4 National Institute of Advanced Industrial Science and Technology (AIST) |
5 Registration Number H13PRO009 | 5 Registration Number H13PRO009 |
6 | 6 |
7 This file is part of GNU Emacs. | 7 This file is part of GNU Emacs. |
8 | 8 |
9 GNU Emacs is free software; you can redistribute it and/or modify | 9 GNU Emacs is free software; you can redistribute it and/or modify |
10 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
11 the Free Software Foundation; either version 2, or (at your option) | 11 the Free Software Foundation; either version 3, or (at your option) |
12 any later version. | 12 any later version. |
13 | 13 |
14 GNU Emacs is distributed in the hope that it will be useful, | 14 GNU Emacs is distributed in the hope that it will be useful, |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
254 | 254 |
255 struct face; | 255 struct face; |
256 struct composition; | 256 struct composition; |
257 | 257 |
258 /* Macros for lispy glyph-string. */ | 258 /* Macros for lispy glyph-string. */ |
259 #define LGSTRING_FONT(lgs) AREF (AREF ((lgs), 0), 0) | 259 enum lgstring_indices |
260 #define LGSTRING_WIDTH(lgs) XINT (AREF (AREF ((lgs), 0), 1)) | 260 { |
261 #define LGSTRING_LBEARING(lgs) XINT (AREF (AREF ((lgs), 0), 2)) | 261 LGSTRING_IX_FONT, LGSTRING_IX_WIDTH, |
262 #define LGSTRING_RBEARING(lgs) XINT (AREF (AREF ((lgs), 0), 3)) | 262 LGSTRING_IX_LBEARING, LGSTRING_IX_RBEARING, |
263 #define LGSTRING_ASCENT(lgs) XINT (AREF (AREF ((lgs), 0), 4)) | 263 LGSTRING_IX_ASCENT, LGSTRING_IX_DESCENT |
264 #define LGSTRING_DESCENT(lgs) XINT (AREF (AREF ((lgs), 0), 5)) | 264 }; |
265 #define LGSTRING_SET_FONT(lgs, val) \ | 265 #define LGSTRING_SLOT(lgs, ix) AREF (AREF ((lgs), 0), ix) |
266 ASET (AREF ((lgs), 0), 0, (val)) | 266 #define LGSTRING_FONT(lgs) LGSTRING_SLOT (lgs, LGSTRING_IX_FONT) |
267 #define LGSTRING_WIDTH(lgs) XINT (LGSTRING_SLOT (lgs, LGSTRING_IX_WIDTH)) | |
268 #define LGSTRING_LBEARING(lgs) XINT (LGSTRING_SLOT (lgs, LGSTRING_IX_LBEARING)) | |
269 #define LGSTRING_RBEARING(lgs) XINT (LGSTRING_SLOT (lgs, LGSTRING_IX_RBEARING)) | |
270 #define LGSTRING_ASCENT(lgs) XINT (LGSTRING_SLOT (lgs, LGSTRING_IX_ASCENT)) | |
271 #define LGSTRING_DESCENT(lgs) XINT (LGSTRING_SLOT (lgs, LGSTRING_IX_DESCENT)) | |
272 #define LGSTRING_SET_SLOT(lgs, ix, val) ASET (AREF ((lgs), 0), ix, (val)) | |
273 #define LGSTRING_SET_FONT(lgs, val) \ | |
274 LGSTRING_SET_SLOT(lgs, LGSTRING_IX_FONT, (val)) | |
267 #define LGSTRING_SET_WIDTH(lgs, val) \ | 275 #define LGSTRING_SET_WIDTH(lgs, val) \ |
268 ASET (AREF ((lgs), 0), 1, make_number (val)) | 276 LGSTRING_SET_SLOT(lgs, LGSTRING_IX_WIDTH, make_number (val)) |
269 #define LGSTRING_SET_LBEARING(lgs, val) \ | 277 #define LGSTRING_SET_LBEARING(lgs, val) \ |
270 ASET (AREF ((lgs), 0), 2, make_number (val)) | 278 LGSTRING_SET_SLOT(lgs, LGSTRING_IX_LBEARING, make_number (val)) |
271 #define LGSTRING_SET_RBEARING(lgs, val) \ | 279 #define LGSTRING_SET_RBEARING(lgs, val) \ |
272 ASET (AREF ((lgs), 0), 3, make_number (val)) | 280 LGSTRING_SET_SLOT(lgs, LGSTRING_IX_RBEARING, make_number (val)) |
273 #define LGSTRING_SET_ASCENT(lgs, val) \ | 281 #define LGSTRING_SET_ASCENT(lgs, val) \ |
274 ASET (AREF ((lgs), 0), 4, make_number (val)) | 282 LGSTRING_SET_SLOT(lgs, LGSTRING_IX_ASCENT, make_number (val)) |
275 #define LGSTRING_SET_DESCENT(lgs, val) \ | 283 #define LGSTRING_SET_DESCENT(lgs, val) \ |
276 ASET (AREF ((lgs), 0), 5, make_number (val)) | 284 LGSTRING_SET_SLOT(lgs, LGSTRING_IX_DESCENT, make_number (val)) |
277 | 285 |
278 #define LGSTRING_LENGTH(lgs) (ASIZE ((lgs)) - 1) | 286 #define LGSTRING_LENGTH(lgs) (ASIZE ((lgs)) - 1) |
279 #define LGSTRING_GLYPH(lgs, idx) AREF ((lgs), (idx) + 1) | 287 #define LGSTRING_GLYPH(lgs, idx) AREF ((lgs), (idx) + 1) |
280 #define LGSTRING_SET_GLYPH(lgs, idx, val) ASET ((lgs), (idx) + 1, (val)) | 288 #define LGSTRING_SET_GLYPH(lgs, idx, val) ASET ((lgs), (idx) + 1, (val)) |
281 | 289 |
282 /* Vector size of Lispy glyph. */ | 290 /* Vector size of Lispy glyph. */ |
283 #define LGLYPH_SIZE 10 | 291 enum lglyph_indices |
284 #define LGLYPH_FROM(g) XINT (AREF ((g), 0)) | 292 { |
285 #define LGLYPH_TO(g) XINT (AREF ((g), 1)) | 293 LGLYPH_IX_FROM, LGLYPH_IX_TO, LGLYPH_IX_CHAR, LGLYPH_IX_CODE, |
286 #define LGLYPH_CHAR(g) XINT (AREF ((g), 2)) | 294 LGLYPH_IX_WIDTH, LGLYPH_IX_LBEARING, LGLYPH_IX_RBEARING, |
287 #define LGLYPH_CODE(g) XINT (AREF ((g), 3)) | 295 LGLYPH_IX_ASCENT, LGLYPH_IX_DESCENT, LGLYPH_IX_ADJUSTMENT, |
288 #define LGLYPH_WIDTH(g) XINT (AREF ((g), 4)) | 296 /* Not an index. */ |
289 #define LGLYPH_LBEARING(g) XINT (AREF ((g), 5)) | 297 LGLYPH_SIZE |
290 #define LGLYPH_RBEARING(g) XINT (AREF ((g), 6)) | 298 }; |
291 #define LGLYPH_ASCENT(g) XINT (AREF ((g), 7)) | 299 #define LGLYPH_FROM(g) XINT (AREF ((g), LGLYPH_IX_FROM)) |
292 #define LGLYPH_DESCENT(g) XINT (AREF ((g), 8)) | 300 #define LGLYPH_TO(g) XINT (AREF ((g), LGLYPH_IX_TO)) |
293 #define LGLYPH_ADJUSTMENT(g) AREF ((g), 9) | 301 #define LGLYPH_CHAR(g) XINT (AREF ((g), LGLYPH_IX_CHAR)) |
294 #define LGLYPH_SET_FROM(g, val) ASET ((g), 0, make_number (val)) | 302 #define LGLYPH_CODE(g) XUINT (AREF ((g), LGLYPH_IX_CODE)) |
295 #define LGLYPH_SET_TO(g, val) ASET ((g), 1, make_number (val)) | 303 #define LGLYPH_WIDTH(g) XINT (AREF ((g), LGLYPH_IX_WIDTH)) |
296 #define LGLYPH_SET_CHAR(g, val) ASET ((g), 2, make_number (val)) | 304 #define LGLYPH_LBEARING(g) XINT (AREF ((g), LGLYPH_IX_LBEARING)) |
297 #define LGLYPH_SET_CODE(g, val) ASET ((g), 3, make_number (val)) | 305 #define LGLYPH_RBEARING(g) XINT (AREF ((g), LGLYPH_IX_RBEARING)) |
298 #define LGLYPH_SET_WIDTH(g, val) ASET ((g), 4, make_number (val)) | 306 #define LGLYPH_ASCENT(g) XINT (AREF ((g), LGLYPH_IX_ASCENT)) |
299 #define LGLYPH_SET_LBEARING(g, val) ASET ((g), 5, make_number (val)) | 307 #define LGLYPH_DESCENT(g) XINT (AREF ((g), LGLYPH_IX_DESCENT)) |
300 #define LGLYPH_SET_RBEARING(g, val) ASET ((g), 6, make_number (val)) | 308 #define LGLYPH_ADJUSTMENT(g) AREF ((g), LGLYPH_IX_ADJUSTMENT) |
301 #define LGLYPH_SET_ASCENT(g, val) ASET ((g), 7, make_number (val)) | 309 #define LGLYPH_SET_FROM(g, val) ASET ((g), LGLYPH_IX_FROM, make_number (val)) |
302 #define LGLYPH_SET_DESCENT(g, val) ASET ((g), 8, make_number (val)) | 310 #define LGLYPH_SET_TO(g, val) ASET ((g), LGLYPH_IX_TO, make_number (val)) |
303 #define LGLYPH_SET_ADJUSTMENT(g, val) ASET ((g), 9, (val)) | 311 #define LGLYPH_SET_CHAR(g, val) ASET ((g), LGLYPH_IX_CHAR, make_number (val)) |
312 /* FIXME: we should use make_uint_number here. */ | |
313 #define LGLYPH_SET_CODE(g, val) ASET ((g), LGLYPH_IX_CODE, make_number (val)) | |
314 #define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_number (val)) | |
315 #define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_RBEARING, make_number (val)) | |
316 #define LGLYPH_SET_RBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_number (val)) | |
317 #define LGLYPH_SET_ASCENT(g, val) ASET ((g), LGLYPH_IX_ASCENT, make_number (val)) | |
318 #define LGLYPH_SET_DESCENT(g, val) ASET ((g), LGLYPH_IX_DESCENT, make_number (val)) | |
319 #define LGLYPH_SET_ADJUSTMENT(g, val) ASET ((g), LGLYPH_IX_ADJUSTMENT, (val)) | |
304 | 320 |
305 #define LGLYPH_XOFF(g) (VECTORP (LGLYPH_ADJUSTMENT (g)) \ | 321 #define LGLYPH_XOFF(g) (VECTORP (LGLYPH_ADJUSTMENT (g)) \ |
306 ? XINT (AREF (LGLYPH_ADJUSTMENT (g), 0)) : 0) | 322 ? XINT (AREF (LGLYPH_ADJUSTMENT (g), 0)) : 0) |
307 #define LGLYPH_YOFF(g) (VECTORP (LGLYPH_ADJUSTMENT (g)) \ | 323 #define LGLYPH_YOFF(g) (VECTORP (LGLYPH_ADJUSTMENT (g)) \ |
308 ? XINT (AREF (LGLYPH_ADJUSTMENT (g), 1)) : 0) | 324 ? XINT (AREF (LGLYPH_ADJUSTMENT (g), 1)) : 0) |