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
12
* modify it under the terms of the GNU General Public
13
* License version 2 as published by the Free Software Foundation.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
* General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; see the file COPYING. If not, write to
22
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23
* Boston, MA 02110-1301, USA.
26
#include <config-workspace.h>
27
#include <fontconfig/fontconfig.h>
29
#if (FC_VERSION>=20402)
30
#define HAVE_FcFreeTypeQueryFace
31
#include <fontconfig/fcfreetype.h>
35
#include FT_FREETYPE_H
37
#include <strigi/streambase.h>
75
static EType getType(const char *fileName, Strigi::InputStream *in);
76
static EType getType(const char *fileName);
77
static EType getType(const char *fileName, const unsigned char *header);
78
static double decodeFixed(long v) { return (v>>16)+(((double)(v&0xFFFF))/0xFFFF); }
79
static QString & fixFoundry(QString &foundry);
82
~CFontEngine() { closeFont(); }
85
// General functions - these should be used instead of specific ones below...
87
bool openFont(EType type, QByteArray &in, const char *fileName, int face=0);
91
// These are only for non-bitmap fonts...
92
const QString & getFamilyName() { return itsFamily; }
93
int getWeight() { return itsWeight; }
94
int getWidth() { return itsWidth; }
95
int getItalic() { return itsItalic; }
96
int getSpacing() { return itsSpacing; }
97
const QString & getFoundry() { return itsFoundry; }
98
const QString & getVersion() { return itsVersion; }
99
int getNumFaces() { return itsFt.open ? itsFt.face->num_faces : 1; }
103
bool openFontFt(QByteArray &in, const char *fileName, int face, bool type1);
104
bool openFontAfm(QByteArray &in);
105
#ifndef HAVE_FcFreeTypeQueryFace
106
void parseXlfdBmp(const QString &lfd);
107
bool openFontBdf(QByteArray &in);
108
bool openFontPcf(QByteArray &in);