Qt 4.8
Functions
qrawfont.cpp File Reference
#include "qglobal.h"
#include "qrawfont.h"
#include "qrawfont_p.h"
#include <QtCore/qendian.h>

Go to the source code of this file.

Functions

QList< QFontDatabase::WritingSystemqt_determine_writing_systems_from_truetype_bits (quint32 unicodeRange[4], quint32 codePageRange[2])
 
int qt_script_for_writing_system (QFontDatabase::WritingSystem writingSystem)
 

Function Documentation

◆ qt_determine_writing_systems_from_truetype_bits()

QList<QFontDatabase::WritingSystem> qt_determine_writing_systems_from_truetype_bits ( quint32  unicodeRange[4],
quint32  codePageRange[2] 
)

Definition at line 587 of file qfontdatabase.cpp.

Referenced by addFontToDatabase(), QFontDatabasePrivate::addTTFile(), QRawFont::fontTable(), initWritingSystems(), and QRawFont::supportedWritingSystems().

588 {
590  bool hasScript = false;
591 
592  int i;
593  for(i = 0; i < QFontDatabase::WritingSystemsCount; i++) {
594  int bit = requiredUnicodeBits[i][0];
595  int index = bit/32;
596  int flag = 1 << (bit&31);
597  if (bit != 126 && unicodeRange[index] & flag) {
598  bit = requiredUnicodeBits[i][1];
599  index = bit/32;
600 
601  flag = 1 << (bit&31);
602  if (bit == 127 || unicodeRange[index] & flag) {
603  writingSystems.append(QFontDatabase::WritingSystem(i));
604  hasScript = true;
605  // qDebug("font %s: index=%d, flag=%8x supports script %d", familyName.latin1(), index, flag, i);
606  }
607  }
608  }
609  if(codePageRange[0] & (1 << SimplifiedChineseCsbBit)) {
611  hasScript = true;
612  //qDebug("font %s supports Simplified Chinese", familyName.latin1());
613  }
614  if(codePageRange[0] & (1 << TraditionalChineseCsbBit)) {
616  hasScript = true;
617  //qDebug("font %s supports Traditional Chinese", familyName.latin1());
618  }
619  if(codePageRange[0] & (1 << JapaneseCsbBit)) {
620  writingSystems.append(QFontDatabase::Japanese);
621  hasScript = true;
622  //qDebug("font %s supports Japanese", familyName.latin1());
623  }
624  if(codePageRange[0] & (1 << KoreanCsbBit)) {
625  writingSystems.append(QFontDatabase::Korean);
626  hasScript = true;
627  //qDebug("font %s supports Korean", familyName.latin1());
628  }
629  if (!hasScript)
630  writingSystems.append(QFontDatabase::Symbol);
631 
632  return writingSystems;
633 }
static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2]
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
#define SimplifiedChineseCsbBit
quint16 index
#define JapaneseCsbBit
#define KoreanCsbBit
#define TraditionalChineseCsbBit

◆ qt_script_for_writing_system()

int qt_script_for_writing_system ( QFontDatabase::WritingSystem  writingSystem)

Definition at line 938 of file qfontdatabase.cpp.

Referenced by QRawFont::fromFont(), and QRawFont::supportsCharacter().

939 {
940  return scriptForWritingSystem[writingSystem];
941 }
static const int scriptForWritingSystem[]