/* ftcrfont.c -- FreeType font driver on cairo.
- Copyright (C) 2015 Free Software Foundation, Inc.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <cairo-ft.h>
#include "lisp.h"
-#include "dispextern.h"
#include "xterm.h"
-#include "frame.h"
#include "blockinput.h"
-#include "character.h"
-#include "charset.h"
-#include "fontset.h"
#include "font.h"
#include "ftfont.h"
/* FTCR font driver. */
-/* The actual structure for ftcr font that can be casted to struct
- font. */
+/* The actual structure for FTCR font. A pointer to this structure
+ can be cast to struct font *. */
struct ftcrfont_info
{
#define METRICS_SET_STATUS(metrics, status) \
((metrics)->ascent = 0, (metrics)->descent = (status))
-/* Prototypes for helper function. */
-static int ftcrfont_glyph_extents (struct font *, unsigned,
- struct font_metrics *);
-
-/* Prototypes for font-driver methods. */
-static Lisp_Object ftcrfont_list (struct frame*, Lisp_Object);
-static Lisp_Object ftcrfont_match (struct frame*, Lisp_Object);
-static Lisp_Object ftcrfont_open (struct frame*, Lisp_Object, int);
-static void ftcrfont_close (struct font *);
-static void ftcrfont_text_extents (struct font *, unsigned *, int,
- struct font_metrics *);
-static int ftcrfont_draw (struct glyph_string *, int, int, int, int, bool);
-
struct font_driver ftcrfont_driver;
static int
cairo_t *cr;
cairo_glyph_t *glyphs;
cairo_surface_t *surface;
+ cairo_surface_type_t surface_type;
int len = to - from;
int i;
FT_Activate_Size (ftcrfont_info->ft_size_draw);
cairo_show_glyphs (cr, glyphs, len);
surface = cairo_get_target (cr);
- if (cairo_surface_get_type (surface) != CAIRO_SURFACE_TYPE_XLIB)
+ /* XXX: It used to be necessary to flush when exporting. It might
+ be the case that this is no longer necessary. */
+ surface_type = cairo_surface_get_type (surface);
+ if (surface_type != CAIRO_SURFACE_TYPE_XLIB
+ && (surface_type != CAIRO_SURFACE_TYPE_IMAGE
+ || cairo_image_surface_get_format (surface) != CAIRO_FORMAT_ARGB32))
cairo_surface_flush (surface);
x_end_cr_clip (f);