You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
3.2 KiB
119 lines
3.2 KiB
15 years ago
|
#ifndef __FC_ENGINE_H__
|
||
|
#define __FC_ENGINE_H__
|
||
|
|
||
|
#ifdef HAVE_CONFIG_H
|
||
|
#include "config.h"
|
||
|
#endif
|
||
|
|
||
15 years ago
|
#include <tqstring.h>
|
||
|
#include <tqvaluevector.h>
|
||
|
#include <tqfont.h>
|
||
15 years ago
|
#include <kurl.h>
|
||
13 years ago
|
#include <tdeversion.h>
|
||
15 years ago
|
#include <fontconfig/fontconfig.h>
|
||
|
|
||
|
#if (FC_VERSION<20200)
|
||
|
|
||
|
#define KFI_FC_NO_WIDTHS
|
||
|
#define KFI_FC_LIMITED_WEIGHTS
|
||
|
|
||
|
#endif
|
||
|
|
||
|
#ifdef KFI_FC_LIMITED_WEIGHTS
|
||
|
|
||
|
#undef FC_WEIGHT_LIGHT
|
||
|
#define FC_WEIGHT_THIN 0
|
||
|
#define FC_WEIGHT_EXTRALIGHT 40
|
||
|
#define FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT
|
||
|
#define FC_WEIGHT_LIGHT 50
|
||
|
#define FC_WEIGHT_BOOK 75
|
||
|
#define FC_WEIGHT_REGULAR 80
|
||
|
#define FC_WEIGHT_NORMAL FC_WEIGHT_REGULAR
|
||
|
#define FC_WEIGHT_SEMIBOLD FC_WEIGHT_DEMIBOLD
|
||
|
#define FC_WEIGHT_EXTRABOLD 205
|
||
|
#define FC_WEIGHT_ULTRABOLD FC_WEIGHT_EXTRABOLD
|
||
|
#define FC_WEIGHT_HEAVY FC_WEIGHT_BLACK
|
||
|
|
||
|
#endif
|
||
|
|
||
14 years ago
|
class TQPixmap;
|
||
15 years ago
|
|
||
|
#ifdef HAVE_XFT
|
||
|
typedef struct _XftFont XftFont;
|
||
|
#endif
|
||
|
|
||
|
namespace KFI
|
||
|
{
|
||
|
|
||
|
class KDE_EXPORT CFcEngine
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
CFcEngine();
|
||
|
~CFcEngine();
|
||
|
|
||
|
#ifdef HAVE_XFT
|
||
15 years ago
|
bool draw(const KURL &url, int w, int h, TQPixmap &pix, int faceNo, bool thumb);
|
||
15 years ago
|
#endif
|
||
|
int getNumIndexes() { return itsIndexCount; } // Only valid after draw has been called!
|
||
15 years ago
|
TQString getName(const KURL &url, int faceNo=0);
|
||
|
bool getInfo(const KURL &url, int faceNo, TQString &full, TQString &family, TQString &foundry, TQString &weight,
|
||
15 years ago
|
#ifndef KFI_FC_NO_WIDTHS
|
||
15 years ago
|
TQString &width,
|
||
15 years ago
|
#endif
|
||
15 years ago
|
TQString &spacing, TQString &slant);
|
||
|
TQFont getQFont(const TQString &name, int size);
|
||
15 years ago
|
|
||
15 years ago
|
const TQValueVector<int> & sizes() const { return itsSizes; }
|
||
15 years ago
|
int alphaSize() const { return itsAlphaSize; }
|
||
|
|
||
15 years ago
|
static TQString getPreviewString();
|
||
|
static void setPreviewString(const TQString &str);
|
||
|
static TQString getUppercaseLetters();
|
||
|
static TQString getLowercaseLetters();
|
||
|
static TQString getPunctuation();
|
||
|
static TQString getFcString(FcPattern *pat, const char *val, int faceNo=0);
|
||
|
static TQString createName(FcPattern *pat, int faceNo=0);
|
||
|
static TQString weightStr(int weight, bool emptyNormal=true);
|
||
15 years ago
|
#ifndef KFI_FC_NO_WIDTHS
|
||
15 years ago
|
static TQString widthStr(int width, bool emptyNormal=true);
|
||
15 years ago
|
#endif
|
||
15 years ago
|
static TQString slantStr(int slant, bool emptyNormal=true);
|
||
|
static TQString spacingStr(int spacing);
|
||
15 years ago
|
|
||
|
static const int constScalableSizes[];
|
||
|
static const int constDefaultAlphaSize;
|
||
|
|
||
|
private:
|
||
|
|
||
|
bool parseUrl(const KURL &url, int faceNo, bool all=false);
|
||
15 years ago
|
void parseName(const TQString &name, int faceNo, bool all=false);
|
||
15 years ago
|
#ifdef HAVE_XFT
|
||
15 years ago
|
XftFont * getFont(int size, TQPixmap *pix=NULL);
|
||
|
void getSizes(TQPixmap *pix=NULL);
|
||
15 years ago
|
#endif
|
||
|
|
||
|
private:
|
||
|
|
||
|
bool itsInstalled;
|
||
15 years ago
|
TQString itsName,
|
||
15 years ago
|
itsDescriptiveName,
|
||
|
itsFoundry;
|
||
|
int itsIndex,
|
||
|
itsIndexCount,
|
||
|
itsWeight,
|
||
|
#ifndef KFI_FC_NO_WIDTHS
|
||
|
itsWidth,
|
||
|
#endif
|
||
|
itsSlant,
|
||
|
itsSpacing,
|
||
|
itsAlphaSize;
|
||
15 years ago
|
TQValueVector<int> itsSizes;
|
||
15 years ago
|
KURL itsLastUrl;
|
||
|
FcBool itsScalable;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|