File: VectorFont.h

package info (click to toggle)
vipec 3.0.3-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,648 kB
  • ctags: 1,899
  • sloc: cpp: 13,609; makefile: 93; perl: 36; ansic: 20; sh: 6
file content (45 lines) | stat: -rw-r--r-- 781 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef VECTORFONT_H
#define VECTORFONT_H

#include <qmap.h>
#include <qlist.h>
#include <qpointarray.h>

class QPoint;
class QPainter;

class VectorChar
{
public:
  VectorChar();
  ~VectorChar();
private:
  void addPoly( int size, int firstx, int firsty, ... );
  void draw(QPainter* p);
private:
  QList<QPointArray> polyList_;
  friend class VectorFont;
};

class VectorFont
{
public:
  static VectorFont* instance();
  ~VectorFont();

  void draw(const QChar& character, QPainter* p, QPoint& point);
  void drawText(const QString& text, QPainter* p, QPoint point);

  static int textWidth(const QString& text);

private:
  VectorFont();
  void initialize();

private:
  static VectorFont* instance_;
  static const int charWidth_;
  QMap<char, VectorChar> charMap_;
};

#endif