1 #ifndef __FONT_ENGINE_H__
2 #define __FONT_ENGINE_H__
5 * KFontInst - KDE Font Installer
7 * Copyright 2003-2007 Craig Drummond <craig@kde.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; see the file COPYING. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
27 #include <config-workspace.h>
28 #include <fontconfig/fontconfig.h>
30 #if (FC_VERSION>=20402)
31 #define HAVE_FcFreeTypeQueryFace
32 #include <fontconfig/fcfreetype.h>
36 #include FT_FREETYPE_H
37 #include <QtCore/QString>
38 #include <strigi/streambase.h>
76 static EType
getType(const char *fileName
, Strigi::InputStream
*in
);
77 static EType
getType(const char *fileName
);
78 static EType
getType(const char *fileName
, const unsigned char *header
);
79 static double decodeFixed(long v
) { return (v
>>16)+(((double)(v
&0xFFFF))/0xFFFF); }
80 static QString
& fixFoundry(QString
&foundry
);
83 ~CFontEngine() { closeFont(); }
86 // General functions - these should be used instead of specific ones below...
88 bool openFont(EType type
, QByteArray
&in
, const char *fileName
, int face
=0);
92 // These are only for non-bitmap fonts...
93 const QString
& getFamilyName() { return itsFamily
; }
94 int getWeight() { return itsWeight
; }
95 int getWidth() { return itsWidth
; }
96 int getItalic() { return itsItalic
; }
97 int getSpacing() { return itsSpacing
; }
98 const QString
& getFoundry() { return itsFoundry
; }
99 const QString
& getVersion() { return itsVersion
; }
100 int getNumFaces() { return itsFt
.open
? itsFt
.face
->num_faces
: 1; }
104 bool openFontFt(QByteArray
&in
, const char *fileName
, int face
, bool type1
);
105 bool openFontAfm(QByteArray
&in
);
106 #ifndef HAVE_FcFreeTypeQueryFace
107 void parseXlfdBmp(const QString
&lfd
);
108 bool openFontBdf(QByteArray
&in
);
109 bool openFontPcf(QByteArray
&in
);