/* Font driver on Mac OSX Core text.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "composite.h"
#include "fontset.h"
#include "font.h"
+#include "termchar.h"
#include "nsgui.h"
#include "nsterm.h"
#include "macfont.h"
struct macfont_metrics;
-/* The actual structure for Mac font that can be casted to struct font. */
+/* The actual structure for Mac font that can be cast to struct font. */
struct macfont_info
{
struct macfont_cache *cache;
struct macfont_metrics **metrics;
short metrics_nrows;
- unsigned synthetic_italic_p : 1;
- unsigned synthetic_bold_p : 1;
+ bool_bf synthetic_italic_p : 1;
+ bool_bf synthetic_bold_p : 1;
unsigned spacing : 2;
unsigned antialias : 2;
- unsigned color_bitmap_p : 1;
+ bool_bf color_bitmap_p : 1;
};
/* Values for the `spacing' member in `struct macfont_info'. */
return cgColor;
}
-#define CG_SET_FILL_COLOR_WITH_GC_FOREGROUND(context, s) \
+#define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face, f) \
do { \
- CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (s->face), \
- s->f); \
+ CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f); \
CGContextSetFillColorWithColor (context, refcol_) ; \
CGColorRelease (refcol_); \
} while (0)
-#define CG_SET_FILL_COLOR_WITH_GC_BACKGROUND(context, s) \
+#define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face, f) \
do { \
- CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (s->face),\
- s->f); \
+ CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face), f); \
CGContextSetFillColorWithColor (context, refcol_); \
CGColorRelease (refcol_); \
} while (0)
-#define CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND(context, s) \
+#define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face, f) \
do { \
- CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (s->face),\
- s->f); \
+ CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f); \
CGContextSetStrokeColorWithColor (context, refcol_); \
CGColorRelease (refcol_); \
} while (0)
CFStringRef name;
entity = font_make_entity ();
- XFONT_ENTITY (entity)->driver = &macfont_driver;
ASET (entity, FONT_TYPE_INDEX, macfont_driver.type);
ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1);
ASET (font_object, FONT_FULLNAME_INDEX,
AREF (font_object, FONT_NAME_INDEX));
font = XFONT_OBJECT (font_object);
- font->frame = f;
font->pixel_size = size;
font->driver = &macfont_driver;
font->encoding_charset = font->repertory_charset = -1;
BOOL isComposite = s->first_glyph->type == COMPOSITE_GLYPH;
int end = isComposite ? s->cmp_to : s->nchars;
int len = end - s->cmp_from;
+ struct face *face = s->face;
int i;
block_input ();
if (with_background)
{
- CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, s);
+ if (s->hl == DRAW_MOUSE_FACE)
+ {
+ face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+ if (!face)
+ face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
+ }
+
+ CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face, f);
CGContextFillRect (context,
CGRectMake (x, y,
s->width, FONT_HEIGHT (s->font)));
}
CGContextScaleCTM (context, 1, -1);
- CG_SET_FILL_COLOR_WITH_GC_FOREGROUND (context, s);
+ CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face, s->f);
if (macfont_info->synthetic_italic_p)
atfm = synthetic_italic_atfm;
else
{
CGContextSetTextDrawingMode (context, kCGTextFillStroke);
CGContextSetLineWidth (context, synthetic_bold_factor * font_size);
- CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND (context, s);
+ CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face, f);
}
if (no_antialias_p)
CGContextSetShouldAntialias (context, false);