Qt 4.8
Public Functions | Public Variables | Private Functions | List of all members
QPFGlyphTree Class Reference

Public Functions

void dump (int indent=0)
 
QPFGlyphget (glyph_t g)
 
bool inFont (glyph_t g) const
 
 QPFGlyphTree (uchar *&data)
 
int totalChars () const
 
int weight () const
 
 ~QPFGlyphTree ()
 

Public Variables

QPFGlyphglyph
 
QPFGlyphTreeless
 
glyph_t max
 
glyph_t min
 
QPFGlyphTreemore
 

Private Functions

 QPFGlyphTree ()
 
void read (uchar *&data)
 
void readData (uchar *&data)
 
void readMetrics (uchar *&data)
 
void readNode (uchar *&data)
 

Detailed Description

Definition at line 141 of file qfontengine_qws.cpp.

Constructors and Destructors

◆ QPFGlyphTree() [1/2]

QPFGlyphTree::QPFGlyphTree ( uchar *&  data)
inline

Definition at line 157 of file qfontengine_qws.cpp.

158  {
159  read(data);
160  }
void read(uchar *&data)
static const char * data(const QByteArray &arr)

◆ ~QPFGlyphTree()

QPFGlyphTree::~QPFGlyphTree ( )
inline

Definition at line 162 of file qfontengine_qws.cpp.

163  {
164  // NOTE: does not delete glyph[*].metrics or .data.
165  // the caller does this (only they know who owns
166  // the data). See clear().
167  delete less;
168  delete more;
169  delete [] glyph;
170  }
QPFGlyphTree * less
QPFGlyph * glyph
QPFGlyphTree * more

◆ QPFGlyphTree() [2/2]

QPFGlyphTree::QPFGlyphTree ( )
inlineprivate

Definition at line 222 of file qfontengine_qws.cpp.

223  {
224  }

Functions

◆ dump()

void QPFGlyphTree::dump ( int  indent = 0)
inline

Definition at line 210 of file qfontengine_qws.cpp.

Referenced by dump().

211  {
212  for (int i=0; i<indent; i++) printf(" ");
213  printf("%d..%d",min,max);
214  //if ( indent == 0 )
215  printf(" (total %d)",totalChars());
216  printf("\n");
217  if ( less ) less->dump(indent+1);
218  if ( more ) more->dump(indent+1);
219  }
QPFGlyphTree * less
int totalChars() const
void dump(int indent=0)
QPFGlyphTree * more

◆ get()

QPFGlyph* QPFGlyphTree::get ( glyph_t  g)
inline

Definition at line 186 of file qfontengine_qws.cpp.

Referenced by get().

187  {
188  if ( g < min ) {
189  if ( !less )
190  return 0;
191  return less->get(g);
192  } else if ( g > max ) {
193  if ( !more )
194  return 0;
195  return more->get(g);
196  }
197  return &glyph[g - min];
198  }
QPFGlyph * get(glyph_t g)
QPFGlyphTree * less
QPFGlyph * glyph
QPFGlyphTree * more

◆ inFont()

bool QPFGlyphTree::inFont ( glyph_t  g) const
inline

Definition at line 172 of file qfontengine_qws.cpp.

Referenced by inFont().

173  {
174  if ( g < min ) {
175  if ( !less )
176  return false;
177  return less->inFont(g);
178  } else if ( g > max ) {
179  if ( !more )
180  return false;
181  return more->inFont(g);
182  }
183  return true;
184  }
QPFGlyphTree * less
bool inFont(glyph_t g) const
QPFGlyphTree * more

◆ read()

void QPFGlyphTree::read ( uchar *&  data)
inlineprivate

Definition at line 226 of file qfontengine_qws.cpp.

227  {
228  // All node data first
229  readNode(data);
230  // Then all non-video data
231  readMetrics(data);
232  // Then all video data
233  readData(data);
234  }
void readMetrics(uchar *&data)
void readData(uchar *&data)
static const char * data(const QByteArray &arr)
void readNode(uchar *&data)

◆ readData()

void QPFGlyphTree::readData ( uchar *&  data)
inlineprivate

Definition at line 275 of file qfontengine_qws.cpp.

Referenced by readData().

276  {
277  int n = max-min+1;
278  for (int i=0; i<n; i++) {
279  QSize s( glyph[i].metrics->width, glyph[i].metrics->height );
280  //######### s = qt_screen->mapToDevice( s );
281  uint datasize = glyph[i].metrics->linestep * s.height();
282  glyph[i].data = data; data += datasize;
283  }
284  if ( less )
285  less->readData(data);
286  if ( more )
287  more->readData(data);
288  }
QPFGlyphTree * less
void readData(uchar *&data)
QPFGlyph * glyph
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
QPFGlyphTree * more
QPFGlyphMetrics * metrics
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ readMetrics()

void QPFGlyphTree::readMetrics ( uchar *&  data)
inlineprivate

Definition at line 262 of file qfontengine_qws.cpp.

Referenced by readMetrics().

263  {
264  int n = max-min+1;
265  for (int i=0; i<n; i++) {
267  data += sizeof(QPFGlyphMetrics);
268  }
269  if ( less )
271  if ( more )
273  }
QPFGlyphTree * less
void readMetrics(uchar *&data)
QPFGlyph * glyph
static const char * data(const QByteArray &arr)
QPFGlyphTree * more
QPFGlyphMetrics * metrics

◆ readNode()

void QPFGlyphTree::readNode ( uchar *&  data)
inlineprivate

Definition at line 236 of file qfontengine_qws.cpp.

Referenced by readNode().

237  {
238  uchar rw = *data++;
239  uchar cl = *data++;
240  min = (rw << 8) | cl;
241  rw = *data++;
242  cl = *data++;
243  max = (rw << 8) | cl;
244  int flags = *data++;
245  if ( flags & 1 )
246  less = new QPFGlyphTree;
247  else
248  less = 0;
249  if ( flags & 2 )
250  more = new QPFGlyphTree;
251  else
252  more = 0;
253  int n = max-min+1;
254  glyph = new QPFGlyph[n];
255 
256  if ( less )
257  less->readNode(data);
258  if ( more )
259  more->readNode(data);
260  }
QPFGlyphTree * less
unsigned char uchar
Definition: qglobal.h:994
QPFGlyph * glyph
static const char * data(const QByteArray &arr)
void readNode(uchar *&data)
QPFGlyphTree * more

◆ totalChars()

int QPFGlyphTree::totalChars ( ) const
inline

Definition at line 199 of file qfontengine_qws.cpp.

Referenced by totalChars().

200  {
201  if ( !this ) return 0;
202  return max-min+1 + less->totalChars() + more->totalChars();
203  }
QPFGlyphTree * less
int totalChars() const
QPFGlyphTree * more

◆ weight()

int QPFGlyphTree::weight ( ) const
inline

Definition at line 204 of file qfontengine_qws.cpp.

Referenced by weight().

205  {
206  if ( !this ) return 0;
207  return 1 + less->weight() + more->weight();
208  }
QPFGlyphTree * less
int weight() const
QPFGlyphTree * more

Properties

◆ glyph

QPFGlyph* QPFGlyphTree::glyph

Definition at line 155 of file qfontengine_qws.cpp.

◆ less

QPFGlyphTree* QPFGlyphTree::less

Definition at line 153 of file qfontengine_qws.cpp.

◆ max

glyph_t QPFGlyphTree::max

Definition at line 152 of file qfontengine_qws.cpp.

◆ min

glyph_t QPFGlyphTree::min

Definition at line 152 of file qfontengine_qws.cpp.

◆ more

QPFGlyphTree* QPFGlyphTree::more

Definition at line 154 of file qfontengine_qws.cpp.


The documentation for this class was generated from the following file: