]> code.delx.au - gnu-emacs/blobdiff - src/ftcrfont.c
* test/lisp/help-fns-tests.el: Add several tests for 'describe-function'.
[gnu-emacs] / src / ftcrfont.c
index d60c1202b9d161d136f0a0c121e34d37e66450d3..2676502705d6cfd026e12193a3f045dc1126ff0c 100644 (file)
@@ -1,12 +1,12 @@
 /* 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
@@ -22,20 +22,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #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
 {
@@ -70,19 +65,6 @@ enum metrics_status
 #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
@@ -246,6 +228,7 @@ ftcrfont_draw (struct glyph_string *s,
   cairo_t *cr;
   cairo_glyph_t *glyphs;
   cairo_surface_t *surface;
+  cairo_surface_type_t surface_type;
   int len = to - from;
   int i;
 
@@ -282,7 +265,12 @@ ftcrfont_draw (struct glyph_string *s,
   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);