1 //========================================================================
5 // Base class for font rasterizers.
7 //========================================================================
17 #include <X11/Xutil.h>
20 //------------------------------------------------------------------------
25 SFontEngine(Display *display, Visual *visual, int depth,
27 virtual ~SFontEngine();
29 // Use a TrueColor visual. Pixel values are computed as:
31 // (r << rShift) + (g << gShift) + (b << bShift)
33 // where r, g, and b are scaled to the ranges [0,rMax], [0,gMax],
34 // and [0,bMax], respectively.
35 virtual void useTrueColor(int rMax, int rShift, int gMax, int gShift,
36 int bMax, int bShift);
38 // Use an RGB color cube. <colors> is an array containing
39 // <nRGB>*<nRGB>*<nRGB> pixel values in red,green,blue order, e.g.,
40 // for <nRGB>=2, there will be 8 entries:
42 // |--- colors[i] ---|
44 // - ----- ----- -----
54 // The <colors> array is not copied and must remain valid for the
55 // lifetime of this SFont object.
56 virtual void useColorCube(Gulong *colors, int nRGB);
60 // Find the closest match to (<r>,<g>,<b>).
61 Gulong findColor(int r, int g, int b);
69 GBool trueColor; // true for TrueColor, false for RGB cube
71 //----- TrueColor parameters
73 int rShift, gShift, bShift;
75 //----- RGB color cube parameters
80 //------------------------------------------------------------------------
85 // A typical subclass will provide a constructor along the lines of:
87 // SomeFontFile(SomeFontEngine *engine, char *fontFileName);
95 //------------------------------------------------------------------------
100 // A typical subclass will provide a constructor along the lines of:
102 // SomeFont(SomeFontFile *fontFile, double *m);
104 // where <m> is a transform matrix consisting of four elements,
105 // using the PostScript ordering conventions (without any
108 // [x' y'] = [x y] * [m0 m1]
111 // This is the level at which fonts are cached, and so the font
112 // cannot be transformed after it is created.
117 // Draw a character <c> at <x>,<y> in color (<r>,<g>,<b>). The RGB
118 // values should each be in the range [0,65535]. Draws into <d>,
119 // clipped to the rectangle (0,0)-(<w>-1,<h>-1). Returns true if
120 // the character was drawn successfully.
121 virtual GBool drawChar(Drawable d, int w, int h, GC gc,
122 int x, int y, int r, int g, int b, Gushort c) = 0;