aboutsummaryrefslogtreecommitdiffstats
path: root/src/font.h
diff options
context:
space:
mode:
authorDmitry Antipov2015-01-16 15:15:32 +0300
committerDmitry Antipov2015-01-16 15:15:32 +0300
commit4303d11029cf204cbf4ddf917ee0d37b08130570 (patch)
tree5781c5e151aed74b7757a475de32190fdb58afcf /src/font.h
parent7ee2733f1ecd3d4f2bd782aa802b090c77fbb135 (diff)
downloademacs-4303d11029cf204cbf4ddf917ee0d37b08130570.tar.gz
emacs-4303d11029cf204cbf4ddf917ee0d37b08130570.zip
Prefer INLINE functions in font.h to match style used in lisp.h
* font.h (FONTP, FONT_SPEC_P, FONT_ENTITY_P, FONT_OBJECT_P) (CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY, CHECK_FONT_OBJECT) (XFONT_SPEC, XFONT_ENTITY, XFONT_OBJECT, CHECK_FONT_GET_OBJECT): Now functions. * font.c (Ffont_otf_alternates, Fquery_font, Ffont_get_glyphs): * ftfont.c (ftfont_shape): * macfont.m (macfont_shape): * w32uniscribe.c (uniscribe_shape): * xftfont.c (xftfont_shape): Adjust CHECK_FONT_GET_OBJECT users.
Diffstat (limited to 'src/font.h')
-rw-r--r--src/font.h113
1 files changed, 79 insertions, 34 deletions
diff --git a/src/font.h b/src/font.h
index 5a3e38a2a6e..efc184eef77 100644
--- a/src/font.h
+++ b/src/font.h
@@ -413,46 +413,91 @@ struct font_bitmap
413/* Predicates to check various font-related objects. */ 413/* Predicates to check various font-related objects. */
414 414
415/* True iff X is one of font-spec, font-entity, and font-object. */ 415/* True iff X is one of font-spec, font-entity, and font-object. */
416#define FONTP(x) PSEUDOVECTORP (x, PVEC_FONT) 416INLINE bool
417FONTP (Lisp_Object x)
418{
419 return PSEUDOVECTORP (x, PVEC_FONT);
420}
421
417/* True iff X is font-spec. */ 422/* True iff X is font-spec. */
418#define FONT_SPEC_P(x) \ 423INLINE bool
419 (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX) 424FONT_SPEC_P (Lisp_Object x)
425{
426 return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX;
427}
428
420/* True iff X is font-entity. */ 429/* True iff X is font-entity. */
421#define FONT_ENTITY_P(x) \ 430INLINE bool
422 (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX) 431FONT_ENTITY_P (Lisp_Object x)
432{
433 return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX;
434}
435
423/* True iff X is font-object. */ 436/* True iff X is font-object. */
424#define FONT_OBJECT_P(x) \ 437INLINE bool
425 (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX) 438FONT_OBJECT_P (Lisp_Object x)
426 439{
427/* Check macros for various font-related objects. */ 440 return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX;
428 441}
429#define CHECK_FONT(x) \ 442
430 do { if (! FONTP (x)) wrong_type_argument (Qfont, x); } while (false) 443/* Type checking functions for various font-related objects. */
431#define CHECK_FONT_SPEC(x) \ 444
432 do { if (! FONT_SPEC_P (x)) wrong_type_argument (Qfont_spec, x); } \ 445INLINE void
433 while (false) 446CHECK_FONT (Lisp_Object x)
434#define CHECK_FONT_ENTITY(x) \ 447{
435 do { if (! FONT_ENTITY_P (x)) wrong_type_argument (Qfont_entity, x); } \ 448 CHECK_TYPE (FONTP (x), Qfont, x);
436 while (false) 449}
437#define CHECK_FONT_OBJECT(x) \ 450
438 do { if (! FONT_OBJECT_P (x)) wrong_type_argument (Qfont_object, x); } \ 451INLINE void
439 while (false) 452CHECK_FONT_SPEC (Lisp_Object x)
440 453{
441#define CHECK_FONT_GET_OBJECT(x, font) \ 454 CHECK_TYPE (FONT_SPEC_P (x), Qfont_spec, x);
442 do { \ 455}
443 CHECK_FONT_OBJECT (x); \ 456
444 font = XFONT_OBJECT (x); \ 457INLINE void
445 } while (false) 458CHECK_FONT_ENTITY (Lisp_Object x)
459{
460 CHECK_TYPE (FONT_ENTITY_P (x), Qfont_entity, x);
461}
462
463INLINE void
464CHECK_FONT_OBJECT (Lisp_Object x)
465{
466 CHECK_TYPE (FONT_OBJECT_P (x), Qfont_object, x);
467}
468
469/* C pointer extraction functions for various font-related objects. */
470
471INLINE struct font_spec *
472XFONT_SPEC (Lisp_Object p)
473{
474 eassert (FONT_SPEC_P (p));
475 return XUNTAG (p, Lisp_Vectorlike);
476}
477
478INLINE struct font_entity *
479XFONT_ENTITY (Lisp_Object p)
480{
481 eassert (FONT_ENTITY_P (p));
482 return XUNTAG (p, Lisp_Vectorlike);
483}
484
485INLINE struct font *
486XFONT_OBJECT (Lisp_Object p)
487{
488 eassert (FONT_OBJECT_P (p));
489 return XUNTAG (p, Lisp_Vectorlike);
490}
446 491
447#define XFONT_SPEC(p) \
448 (eassert (FONT_SPEC_P (p)), (struct font_spec *) XUNTAG (p, Lisp_Vectorlike))
449#define XFONT_ENTITY(p) \
450 (eassert (FONT_ENTITY_P (p)), \
451 (struct font_entity *) XUNTAG (p, Lisp_Vectorlike))
452#define XFONT_OBJECT(p) \
453 (eassert (FONT_OBJECT_P (p)), (struct font *) XUNTAG (p, Lisp_Vectorlike))
454#define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT)) 492#define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT))
455 493
494INLINE struct font *
495CHECK_FONT_GET_OBJECT (Lisp_Object x)
496{
497 CHECK_FONT_OBJECT (x);
498 return XFONT_OBJECT (x);
499}
500
456/* Number of pt per inch (from the TeXbook). */ 501/* Number of pt per inch (from the TeXbook). */
457#define PT_PER_INCH 72.27 502#define PT_PER_INCH 72.27
458 503