]>
git.ipfire.org Git - thirdparty/cups.git/blob - pdftops/SplashFont.h
1 //========================================================================
5 //========================================================================
12 #ifdef USE_GCC_PRAGMAS
17 #include "SplashTypes.h"
19 struct SplashGlyphBitmap
;
20 struct SplashFontCacheTag
;
24 //------------------------------------------------------------------------
26 // Fractional positioning uses this many bits to the right of the
28 #define splashFontFractionBits 2
29 #define splashFontFraction (1 << splashFontFractionBits)
30 #define splashFontFractionMul \
31 ((SplashCoord)1 / (SplashCoord)splashFontFraction)
33 //------------------------------------------------------------------------
35 //------------------------------------------------------------------------
40 SplashFont(SplashFontFile
*fontFileA
, SplashCoord
*matA
, GBool aaA
);
42 // This must be called after the constructor, so that the subclass
43 // constructor has a chance to compute the bbox.
46 virtual ~SplashFont();
48 SplashFontFile
*getFontFile() { return fontFile
; }
50 // Return true if <this> matches the specified font file and matrix.
51 GBool
matches(SplashFontFile
*fontFileA
, SplashCoord
*matA
) {
52 return fontFileA
== fontFile
&&
53 matA
[0] == mat
[0] && matA
[1] == mat
[1] &&
54 matA
[2] == mat
[2] && matA
[3] == mat
[3];
57 // Get a glyph - this does a cache lookup first, and if not found,
58 // creates a new bitmap and adds it to the cache. The <xFrac> and
59 // <yFrac> values are splashFontFractionBits bits each, representing
60 // the numerators of fractions in [0, 1), where the denominator is
61 // splashFontFraction = 1 << splashFontFractionBits. Subclasses
62 // should override this to zero out xFrac and/or yFrac if they don't
63 // support fractional coordinates.
64 virtual GBool
getGlyph(int c
, int xFrac
, int yFrac
,
65 SplashGlyphBitmap
*bitmap
);
67 // Rasterize a glyph. The <xFrac> and <yFrac> values are the same
68 // as described for getGlyph.
69 virtual GBool
makeGlyph(int c
, int xFrac
, int yFrac
,
70 SplashGlyphBitmap
*bitmap
) = 0;
72 // Return the path for a glyph.
73 virtual SplashPath
*getGlyphPath(int c
) = 0;
75 // Return the font transform matrix.
76 SplashCoord
*getMatrix() { return mat
; }
78 // Return the glyph bounding box.
79 void getBBox(int *xMinA
, int *yMinA
, int *xMaxA
, int *yMaxA
)
80 { *xMinA
= xMin
; *yMinA
= yMin
; *xMaxA
= xMax
; *yMaxA
= yMax
; }
84 SplashFontFile
*fontFile
;
85 SplashCoord mat
[4]; // font transform matrix
86 GBool aa
; // anti-aliasing
87 int xMin
, yMin
, xMax
, yMax
; // glyph bounding box
88 Guchar
*cache
; // glyph bitmap cache
89 SplashFontCacheTag
* // cache tags
91 int glyphW
, glyphH
; // size of glyph bitmaps
92 int glyphSize
; // size of glyph bitmaps, in bytes
93 int cacheSets
; // number of sets in cache
94 int cacheAssoc
; // cache associativity (glyphs per set)