Qt 4.8
Macros | Functions | Variables
qfontengine_qpa.cpp File Reference
#include "qfontengine_qpa_p.h"
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
#include <QtCore/QBuffer>
#include <QtGui/private/qapplication_p.h>
#include <QtGui/QPlatformFontDatabase>
#include <QtGui/private/qpaintengine_raster_p.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)
 
template<typename T >
readValue (const uchar *&data)
 
static const ucharverifyTag (const uchar *tagPtr, const uchar *endPtr)
 

Variables

static QFontEngineQPA::TagType tagTypes [QFontEngineQPA::NumTags]
 

Macro Definition Documentation

◆ DEBUG_VERIFY

#define DEBUG_VERIFY   if (0) qDebug

Definition at line 86 of file qfontengine_qpa.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 89 of file qfontengine_qpa.cpp.

Referenced by verifyTag().

◆ VERIFY

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

Definition at line 106 of file qfontengine_qpa.cpp.

Referenced by QFontEngineQPA::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 112 of file qfontengine_qpa.cpp.

Referenced by verifyTag().

Function Documentation

◆ getChar()

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

Definition at line 227 of file qfontengine_qpa.cpp.

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

228 {
229  uint ucs4 = str[i].unicode();
230  if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
231  ++i;
232  ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
233  }
234  return ucs4;
235 }
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

◆ readValue()

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

Definition at line 99 of file qfontengine_qpa.cpp.

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

◆ verifyTag()

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

Definition at line 118 of file qfontengine_qpa.cpp.

Referenced by QFontEngineQPA::verifyHeader().

119 {
120  quint16 tag, length;
121  READ_VERIFY(quint16, tag);
122  READ_VERIFY(quint16, length);
124  return endPtr;
125  if (tag < QFontEngineQPA::NumTags) {
126  switch (tagTypes[tag]) {
129  // can't do anything...
130  break;
132  VERIFY_TAG(length == sizeof(quint32));
133  break;
135  VERIFY_TAG(length == sizeof(quint32));
136  break;
138  VERIFY_TAG(length == sizeof(quint8));
139  break;
140  }
141 #if defined(DEBUG_HEADER)
142  if (length == 1)
143  qDebug() << "tag data" << hex << *tagPtr;
144  else if (length == 4)
145  qDebug() << "tag data" << hex << tagPtr[0] << tagPtr[1] << tagPtr[2] << tagPtr[3];
146 #endif
147  }
148  return tagPtr + length;
149 }
unsigned char quint8
Definition: qglobal.h:934
#define READ_VERIFY(type, variable)
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)

Variable Documentation

◆ tagTypes