Qt 4.8
Macros | Functions | Variables
qbasicunixfontdatabase.cpp File Reference
#include "qbasicunixfontdatabase.h"
#include <QtGui/private/qapplication_p.h>
#include <QtGui/QPlatformScreen>
#include <QtCore/QFile>
#include <QtCore/QLibraryInfo>
#include <QtCore/QDir>
#include <QtGui/private/qfontengine_ft_p.h>
#include <QtGui/private/qfontengine_p.h>
#include <ft2build.h>
#include <FT_TRUETYPE_TABLES_H>

Go to the source code of this file.

Macros

#define JapaneseCsbBit   17
 
#define KoreanCsbBit   21
 
#define SimplifiedChineseCsbBit   18
 
#define TraditionalChineseCsbBit   20
 

Functions

static QSupportedWritingSystems determineWritingSystemsFromTrueTypeBits (quint32 unicodeRange[4], quint32 codePageRange[2])
 
static bool scriptRequiresOpenType (int script)
 

Variables

static int requiredUnicodeBits [QFontDatabase::WritingSystemsCount][2]
 

Macro Definition Documentation

◆ JapaneseCsbBit

#define JapaneseCsbBit   17

Definition at line 60 of file qbasicunixfontdatabase.cpp.

Referenced by determineWritingSystemsFromTrueTypeBits().

◆ KoreanCsbBit

#define KoreanCsbBit   21

Definition at line 61 of file qbasicunixfontdatabase.cpp.

Referenced by determineWritingSystemsFromTrueTypeBits().

◆ SimplifiedChineseCsbBit

#define SimplifiedChineseCsbBit   18

Definition at line 58 of file qbasicunixfontdatabase.cpp.

Referenced by determineWritingSystemsFromTrueTypeBits().

◆ TraditionalChineseCsbBit

#define TraditionalChineseCsbBit   20

Definition at line 59 of file qbasicunixfontdatabase.cpp.

Referenced by determineWritingSystemsFromTrueTypeBits().

Function Documentation

◆ determineWritingSystemsFromTrueTypeBits()

static QSupportedWritingSystems determineWritingSystemsFromTrueTypeBits ( quint32  unicodeRange[4],
quint32  codePageRange[2] 
)
static

Definition at line 134 of file qbasicunixfontdatabase.cpp.

Referenced by QBasicUnixFontDatabase::addTTFile().

135 {
136  QSupportedWritingSystems writingSystems;
137  bool hasScript = false;
138 
139  int i;
140  for(i = 0; i < QFontDatabase::WritingSystemsCount; i++) {
141  int bit = requiredUnicodeBits[i][0];
142  int index = bit/32;
143  int flag = 1 << (bit&31);
144  if (bit != 126 && unicodeRange[index] & flag) {
145  bit = requiredUnicodeBits[i][1];
146  index = bit/32;
147 
148  flag = 1 << (bit&31);
149  if (bit == 127 || unicodeRange[index] & flag) {
150  writingSystems.setSupported(QFontDatabase::WritingSystem(i));
151  hasScript = true;
152  // qDebug("font %s: index=%d, flag=%8x supports script %d", familyName.latin1(), index, flag, i);
153  }
154  }
155  }
156  if(codePageRange[0] & (1 << SimplifiedChineseCsbBit)) {
158  hasScript = true;
159  //qDebug("font %s supports Simplified Chinese", familyName.latin1());
160  }
161  if(codePageRange[0] & (1 << TraditionalChineseCsbBit)) {
163  hasScript = true;
164  //qDebug("font %s supports Traditional Chinese", familyName.latin1());
165  }
166  if(codePageRange[0] & (1 << JapaneseCsbBit)) {
167  writingSystems.setSupported(QFontDatabase::Japanese);
168  hasScript = true;
169  //qDebug("font %s supports Japanese", familyName.latin1());
170  }
171  if(codePageRange[0] & (1 << KoreanCsbBit)) {
172  writingSystems.setSupported(QFontDatabase::Korean);
173  hasScript = true;
174  //qDebug("font %s supports Korean", familyName.latin1());
175  }
176  if (!hasScript)
177  writingSystems.setSupported(QFontDatabase::Symbol);
178 
179  return writingSystems;
180 }
void setSupported(QFontDatabase::WritingSystem, bool supported=true)
Sets the supported state of the writing system given by writingSystem to the value specified by suppo...
#define SimplifiedChineseCsbBit
The QSupportedWritingSystems class is used when registering fonts with the internal Qt fontdatabase...
#define JapaneseCsbBit
#define TraditionalChineseCsbBit
#define KoreanCsbBit
static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2]
quint16 index

◆ scriptRequiresOpenType()

static bool scriptRequiresOpenType ( int  script)
inlinestatic

Variable Documentation

◆ requiredUnicodeBits

int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2]
static

Definition at line 63 of file qbasicunixfontdatabase.cpp.

Referenced by determineWritingSystemsFromTrueTypeBits().