Qt 4.8
Macros | Functions
qfontengine_qpf.cpp File Reference
#include "qfontengine_qpf_p.h"
#include "private/qpaintengine_raster_p.h"
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qfile.h>
#include <QtCore/qdir.h>
#include <QtCore/qbuffer.h>
#include "private/qfontengine_ft_p.h"
#include "private/qcore_unix_p.h"
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <errno.h>
#include "qpfutil.cpp"
#include "private/qwscommand_qws_p.h"
#include "qwsdisplay_qws.h"
#include "qabstractfontengine_p.h"
#include "qplatformdefs.h"

Go to the source code of this file.

Macros

#define DEBUG_VERIFY   if (0) qDebug
 
#define READ_VERIFY(type, variable)
 
#define VERIFY(condition)
 
#define VERIFY_TAG(condition)
 

Functions

static unsigned int getChar (const QChar *str, int &i, const int len)
 
QString qws_fontCacheDir ()
 
template<typename T >
readValue (const uchar *&data)
 
static const ucharverifyTag (const uchar *tagPtr, const uchar *endPtr)
 

Macro Definition Documentation

◆ DEBUG_VERIFY

#define DEBUG_VERIFY   if (0) qDebug

Definition at line 87 of file qfontengine_qpf.cpp.

◆ READ_VERIFY

#define READ_VERIFY (   type,
  variable 
)
Value:
if (tagPtr + sizeof(type) > endPtr) { \
DEBUG_VERIFY() << "read verify failed in line" << __LINE__; \
return 0; \
} \
variable = qFromBigEndian<type>(tagPtr); \
DEBUG_VERIFY() << "read value" << variable << "of type " #type; \
tagPtr += sizeof(type)
int type
Definition: qmetatype.cpp:239

Definition at line 90 of file qfontengine_qpf.cpp.

Referenced by verifyTag().

◆ VERIFY

#define VERIFY (   condition)
Value:
if (!(condition)) { \
DEBUG_VERIFY() << "condition " #condition " failed in line" << __LINE__; \
return 0; \
}

Definition at line 107 of file qfontengine_qpf.cpp.

Referenced by QFontEngineQPF::verifyHeader().

◆ VERIFY_TAG

#define VERIFY_TAG (   condition)
Value:
if (!(condition)) { \
DEBUG_VERIFY() << "verifying tag condition " #condition " failed in line" << __LINE__ << "with tag" << tag; \
return 0; \
}

Definition at line 113 of file qfontengine_qpf.cpp.

Referenced by verifyTag().

Function Documentation

◆ getChar()

static unsigned int getChar ( const QChar str,
int &  i,
const int  len 
)
inlinestatic

Definition at line 279 of file qfontengine_qpf.cpp.

Referenced by QFontEngineQPF::canRender(), and QFontEngineQPF::stringToCMap().

280 {
281  uint ucs4 = str[i].unicode();
282  if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
283  ++i;
284  ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
285  }
286  return ucs4;
287 }
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
unsigned int uint
Definition: qglobal.h:996
static uint surrogateToUcs4(ushort high, ushort low)
Converts a UTF16 surrogate pair with the given high and low values to its UCS-4 code point...
Definition: qchar.h:297

◆ qws_fontCacheDir()

QString qws_fontCacheDir ( )

Definition at line 231 of file qfontengine_qpf.cpp.

Referenced by QFontDatabasePrivate::addQPF2File(), QFontEngineQPF::cleanUpAfterClientCrash(), cleanupFontsDir(), initializeDb(), QFontDatabasePrivate::loadFromCache(), and QFontEngineQPF::QFontEngineQPF().

232 {
233  QString dir;
234 #if defined(Q_WS_QWS)
235  extern QString qws_dataDir();
236  dir = qws_dataDir();
237 #else
238  dir = QDir::tempPath();
239 #endif
240  dir.append(QLatin1String("/fonts/"));
241  QDir qd(dir);
242  if (!qd.exists() && !qd.mkpath(dir))
243  dir = QDir::tempPath();
244  return dir;
245 }
The QDir class provides access to directory structures and their contents.
Definition: qdir.h:58
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QString tempPath()
Returns the absolute path of the system&#39;s temporary directory.
Definition: qdir.cpp:1987
QString & append(QChar c)
Definition: qstring.cpp:1777
QString qws_dataDir()

◆ readValue()

template<typename T >
T readValue ( const uchar *&  data)

Definition at line 100 of file qfontengine_qpf.cpp.

101 {
102  T value = qFromBigEndian<T>(data);
103  data += sizeof(T);
104  return value;
105 }
static const char * data(const QByteArray &arr)

◆ verifyTag()

static const uchar* verifyTag ( const uchar tagPtr,
const uchar endPtr 
)
inlinestatic

Definition at line 119 of file qfontengine_qpf.cpp.

Referenced by QFontEngineQPF::verifyHeader().

120 {
121  quint16 tag, length;
122  READ_VERIFY(quint16, tag);
123  READ_VERIFY(quint16, length);
125  return endPtr;
126  if (tag < QFontEngineQPF::NumTags) {
127  switch (tagTypes[tag]) {
130  // can't do anything...
131  break;
133  VERIFY_TAG(length == sizeof(quint32));
134  break;
136  VERIFY_TAG(length == sizeof(quint32));
137  break;
139  VERIFY_TAG(length == sizeof(quint8));
140  break;
141  }
142 #if defined(DEBUG_HEADER)
143  if (length == 1)
144  qDebug() << "tag data" << hex << *tagPtr;
145  else if (length == 4)
146  qDebug() << "tag data" << hex << tagPtr[0] << tagPtr[1] << tagPtr[2] << tagPtr[3];
147 #endif
148  }
149  return tagPtr + length;
150 }
#define READ_VERIFY(type, variable)
unsigned char quint8
Definition: qglobal.h:934
Q_CORE_EXPORT void qDebug(const char *,...)
unsigned short quint16
Definition: qglobal.h:936
static QFontEngineQPA::TagType tagTypes[QFontEngineQPA::NumTags]
unsigned int quint32
Definition: qglobal.h:938
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
#define VERIFY_TAG(condition)