2
// --------------------------------------------------------------------
3
// A wrapper for the FreeType font rasterizer.
5
// Copyright 2001-2002 Glyph & Cog, LLC
6
// Modified by Otfried Cheong
7
// --------------------------------------------------------------------
10
This file is part of the extensible drawing editor Ipe.
11
Copyright (C) 1993-2004 Otfried Cheong
13
Ipe is free software; you can redistribute it and/or modify it
14
under the terms of the GNU General Public License as published by
15
the Free Software Foundation; either version 2 of the License, or
16
(at your option) any later version.
18
As a special exception, you have permission to link Ipe with the
19
CGAL library and distribute executables, as long as you follow the
20
requirements of the Gnu General Public License in regard to all of
21
the software in the executable aside from CGAL.
23
Ipe is distributed in the hope that it will be useful, but WITHOUT
24
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
26
License for more details.
28
You should have received a copy of the GNU General Public License
29
along with Ipe; if not, you can find it at
30
"http://www.gnu.org/copyleft/gpl.html", or write to the Free
31
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
38
#include "ipepdflib_p.h"
43
#include FT_FREETYPE_H
45
//------------------------------------------------------------------------
51
FTFontEngine(bool aa);
52
bool IsOk() { return iOk; }
53
virtual ~FTFontEngine();
64
//------------------------------------------------------------------------
66
enum FTFontIndexMode {
69
ftFontModeCharCodeOffset,
71
ftFontModeCodeMapDirect,
72
ftFontModeCIDToGIDMap,
78
FTFace(Ref *id, FTFontEngine *engine, char *fontFileName);
79
FTFace(Ref *id, FTFontEngine *engine,
80
const char *buffer, int bufsize);
83
void SetMode(char **fontEnc, bool pdfFontHasEncoding, bool type1);
84
void SetMode(Gushort *cidToGID, int cidToGIDLen);
87
//! Check whether it was loaded okay.
88
bool IsOk() { return iOk; }
90
//! Does this font match the ID?
91
bool IsID(Ref *id) const {return (iId.num == id->num &&
96
FTFontEngine *iEngine;
98
FTFontIndexMode iMode;
108
//------------------------------------------------------------------------
110
struct FTFontCacheTag {
112
Gushort mru; // valid bit (0x8000) and MRU index
113
int x, y, w, h; // offset and size of glyph
118
FTFont(const FTFace *face,
119
double m11, double m12,
120
double m21, double m22);
123
//! Was font created okay?
124
bool IsOk() { return iOk; }
126
//! Does this font match the ID and transform?
127
bool Matches(Ref *id, double m11, double m12, double m21, double m22)
128
{ return iFace->IsID(id) && iM11 == m11 && iM12 == m12 &&
129
iM21 == m21 && iM22 == m22; }
131
bool DrawChar(QPixmap *pixmap, int x, int y,
132
QRgb rgb, CharCode c, Unicode u);
135
Guchar *GetGlyphPixmap(CharCode c, Unicode u,
136
int *x, int *y, int *w, int *h);
137
FT_UInt GetGlyphIndex(CharCode c, Unicode u);
141
double iM11, iM12, iM21, iM22;
143
int iGlyphW, iGlyphH; // size of glyph pixmaps
144
int iGlyphSize; // size of glyph pixmaps, in bytes
145
Guchar *iCache; // glyph pixmap cache
146
FTFontCacheTag *iCacheTags; // cache tags, i.e., char codes
147
int iCacheSets; // number of sets in cache
148
int iCacheAssoc; // cache associativity (glyphs per set)
152
// --------------------------------------------------------------------