changeset 91114:ce50ee0149be

(struct font_bitmap): New member bits_per_pixel. (struct font_driver): New members start_for_frame and end_for_frame. (struct font_data_list): New struct. (font_put_frame_data, font_get_frame_data): Extern them.
author Kenichi Handa <handa@m17n.org>
date Mon, 19 Nov 2007 05:16:48 +0000
parents 1b739acb7b7c
children c8c995a127bc
files src/font.h
diffstat 1 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/font.h	Mon Nov 19 05:15:30 2007 +0000
+++ b/src/font.h	Mon Nov 19 05:16:48 2007 +0000
@@ -197,6 +197,7 @@
 
 struct font_bitmap
 {
+  int bits_per_pixel;
   int rows;
   int width;
   int pitch;
@@ -407,17 +408,49 @@
   int (*otf_drive) P_ ((struct font *font, Lisp_Object features,
 		       Lisp_Object gstring_in, int from, int to,
 		       Lisp_Object gstring_out, int idx, int alternate_subst));
+
+  /* Optional.
+     Make the font driver ready for frame F.  Usually this function
+     makes some data specific to F and store it in F by calling
+     font_put_frame_data ().  */
+  int (*start_for_frame) P_ ((FRAME_PTR f));
+  
+  /* Optional.
+     End using the driver for frame F.  Usually this function free
+     some data stored for F.  */
+  int (*end_for_frame) P_ ((FRAME_PTR f));
 };
 
 
+/* Chain of font drivers.  There's one global font driver list
+   (font_driver_list in font.c).  In addition, each frame has it's own
+   font driver list at FRAME_PTR->font_driver_list.  */
+
 struct font_driver_list
 {
-  /* 1 iff this driver is currently used.  */
+  /* 1 iff this driver is currently used.  It is igonred in the global
+     font driver list.*/
   int on;
+  /* Pointer to the font driver.  */
   struct font_driver *driver;
+  /* Pointer to the next element of the chain.  */
   struct font_driver_list *next;
 };
 
+
+/* Chain of arbitrary data specific to each font driver.  Each frame
+   has it's own font data list at FRAME_PTR->font_data_list.  */
+
+struct font_data_list
+{
+  /* Pointer to the font driver.  */
+  struct font_driver *driver;
+  /* Data specific to the font driver.  */
+  void *data;
+  /* Pointer to the next element of the chain.  */
+  struct font_data_list *next;
+};
+
 extern int enable_font_backend;
 
 EXFUN (Ffont_spec, MANY);
@@ -486,6 +519,13 @@
 			       int alternate_subst));
 #endif	/* HAVE_LIBOTF */
 
+extern int font_put_frame_data P_ ((FRAME_PTR f,
+				    struct font_driver *driver,
+				    void *data));
+extern void *font_get_frame_data P_ ((FRAME_PTR f,
+				      struct font_driver *driver));
+
+
 #ifdef HAVE_FREETYPE
 extern struct font_driver ftfont_driver;
 #endif	/* HAVE_FREETYPE */