Back to index

plt-scheme  4.2.1
plfreetype.h
Go to the documentation of this file.
00001 /* $Id: plfreetype.h,v 1.1 2004/03/01 20:54:51 cozmic Exp $
00002  *
00003  *    Header file for Support routines for freetype font engine
00004  *
00005  *    See plfreetype.c for more details
00006  */
00007 
00008 #ifndef __PLFREETY_H__
00009 #define __PLFREETY_H__
00010 
00011 #ifdef HAVE_FREETYPE
00012 
00013 #include <ft2build.h>
00014 #include FT_FREETYPE_H
00015 #include FT_GLYPH_H
00016 #include FT_OUTLINE_H
00017 
00018 #define FT_Data _FT_Data_
00019 
00020 typedef void (*plD_pixel_fp)     (PLStream *, PLINT, PLINT);
00021 
00022 /*--------------------------------------------------------------------------*\
00023  * Define the FT_Data data structure.
00024  *
00025  * These are the "globalish" variables used by Freetype
00026  * They are kept here so they are moderately thread safe, and stream specific
00027 \*--------------------------------------------------------------------------*/
00028 
00029 typedef struct FT_Data {
00030     short               x;
00031     short               y;
00032 
00033     char *textbuf;          /* temporary string buffer */
00034 
00035     PLFLT            scale;
00036 /*
00037  *  If set to 1, scale won't do anything, but this is an "arbitrary" scale
00038  *  factor for the transformation between virtual and real coordinates. This
00039  *  is included to fix up the problem with the "hidden line removal bug" of
00040  *  the 3D plots, which is fixed by providing a super-scaled image. This
00041  *  should be a mirror, for example, of dev->scale in the PNG driver. If I
00042  *  was thinking 12 months ahead, I would have put that scale factor in
00043  *  "pls", not "dev", but at this late stage, we can just live with it
00044  *  now...
00045  */
00046 
00047     unsigned char       greek;
00048 
00049     unsigned char       invert_y;
00050 /*
00051  *  Set "invert_y" to 1 if the y coordinates need to be inverted for
00052  *  plotting. Most bitmaps will need this.
00053  */
00054 
00055     short               ymax;
00056 /*
00057  *  ymax should be equal to, what it says - the maximum y coordinate of the
00058  *  bitmap. This is used in the process of calculating the inversion of the
00059  *  bitmap when invert_y is set to 1. If invert_y isn't set, this setting is
00060  *  ignored.
00061  */
00062 
00063 
00064     plD_pixel_fp        pixel;          /* pointer to a function which draws a single pixel */
00065 
00066 
00067     int want_smooth_text; /* flag to request text smoothing (won't */
00068                           /* necessarily get it though */
00069     int smooth_text;      /* Flag to indicate type of anti-aliasing used, if freetype text is active */
00070 
00071 
00072     char                font_name[5][1024];
00073 /*
00074  *  List of font names and paths corresponding to the "predefined" fonts of
00075  *  plplot. 1024 chars is presumably generous for each one's length, but at
00076  *  least we probably won't get in trouble this way.
00077  */
00078 
00079 
00080     PLINT               cfont;
00081 /*
00082  *  This is a mirror of pls->cfont and is basically used for detecting when
00083  *  fonts have been changed .
00084  */
00085 
00086 
00087     FT_Matrix           matrix;         /* used for rotating etc... the font. */
00088     FT_Vector           pos;            /* used for calculating offsets of text boxes/sizes */
00089 
00090 
00091 /*
00092  *  The next few variables hold the original size of CMAP0, the number of
00093  *  extra slots added for anti-aliasing, and the "width" of the table used
00094  *  for anti-aliasing.
00095  */
00096 
00097     PLINT ncol0_org;            /* Original number of colours in CMAP0 */
00098     PLINT ncol0_xtra;           /* number of extra colours defined in CMAP0 for anti-aliasing */
00099     PLINT ncol0_width;          /* Number of greyscale levels for each of the original colours */
00100     PLINT last_icol0;           /* Last colour in cmap0, which should be one of the originals */
00101 
00102 
00103 /*
00104  *  The rest of the variables should be considered very much PRIVATE, and
00105  *  more to the point, subject to change.
00106  *
00107  *  Don't rely on them existing in future versions of plplot's freetype
00108  *  support. If/when the Freetype cache manager is added to plplot, most, if
00109  *  not all, of these variables will move elsewhere.
00110  */
00111 
00112     FT_Library          library;        /* pointer to freetype library      */
00113     FT_Face             face;           /* pointer to a font face           */
00114     FT_GlyphSlot        slot;           /* pointer to a glyph slot          */
00115     FT_Glyph            image;          /* bitmap or outline image of font  */
00116 
00117     short               colour;         /* depreciated ?? must check code */
00118 
00119     PLINT shade, col_idx;          /* Used for antialiasing */
00120 
00121 } FT_Data;
00122 
00123 #endif
00124 
00125 
00126 #endif /* __PLFREETY_H__ */