Qt 4.8
Classes | Functions
qtextboundaryfinder.cpp File Reference
#include <QtCore/qtextboundaryfinder.h>
#include <QtCore/qvarlengtharray.h>
#include <private/qunicodetables_p.h>
#include <qdebug.h>
#include "private/qharfbuzz_p.h"

Go to the source code of this file.

Classes

class  QTextBoundaryFinderPrivate
 

Functions

static void init (QTextBoundaryFinder::BoundaryType type, const QChar *chars, int length, HB_CharAttributes *attributes)
 

Function Documentation

◆ init()

static void init ( QTextBoundaryFinder::BoundaryType  type,
const QChar chars,
int  length,
HB_CharAttributes *  attributes 
)
static

Definition at line 55 of file qtextboundaryfinder.cpp.

Referenced by QTextBoundaryFinder::QTextBoundaryFinder().

56 {
58 
59  const ushort *string = reinterpret_cast<const ushort *>(chars);
60  const ushort *unicode = string;
61  // correctly assign script, isTab and isObject to the script analysis
62  const ushort *uc = unicode;
63  const ushort *e = uc + length;
65  int lastScript = QUnicodeTables::Common;
66  const ushort *start = uc;
67  while (uc < e) {
68  int s = QUnicodeTables::script(*uc);
70  script = s;
71  if (*uc == QChar::ObjectReplacementCharacter || *uc == QChar::LineSeparator || *uc == 9)
72  script = QUnicodeTables::Common;
73  if (script != lastScript) {
74  if (uc != start) {
75  HB_ScriptItem item;
76  item.pos = start - string;
77  item.length = uc - start;
78  item.script = (HB_Script)lastScript;
79  item.bidiLevel = 0; // ### what's the proper value?
80  scriptItems.append(item);
81  start = uc;
82  }
83  lastScript = script;
84  }
85  ++uc;
86  }
87  if (uc != start) {
88  HB_ScriptItem item;
89  item.pos = start - string;
90  item.length = uc - start;
91  item.script = (HB_Script)lastScript;
92  item.bidiLevel = 0; // ### what's the proper value?
93  scriptItems.append(item);
94  }
95 
96  qGetCharAttributes(string, length, scriptItems.data(), scriptItems.count(), attributes);
98  HB_GetWordBoundaries(string, length, scriptItems.data(), scriptItems.count(), attributes);
100  HB_GetSentenceBoundaries(string, length, scriptItems.data(), scriptItems.count(), attributes);
101 }
int type
Definition: qmetatype.cpp:239
void append(const T &t)
int count() const
Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4)
unsigned short ushort
Definition: qglobal.h:995
void qGetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, const HB_ScriptItem *items, hb_uint32 numItems, HB_CharAttributes *attributes)
Definition: qharfbuzz.cpp:133