00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STELFONT_HPP_
00021 #define _STELFONT_HPP_
00022
00023 #ifdef HAVE_CONFIG_H
00024 # include <config.h>
00025 #endif
00026
00027 #include <QString>
00028 #include <QChar>
00029 #include "typeface.h"
00030
00031
00032
00033
00034 class StelFont
00035 {
00036 public:
00037 StelFont(float sizeI, const QString& ttfFileName);
00038 ~StelFont() {;}
00039
00040 void print(float x, float y, const QString& s, int upsidedown = 1) const
00041 {
00042 typeFace.render(s, Vec2f(x, y), upsidedown==1);
00043 }
00044
00045 void printChar(const QChar c) const
00046 {
00047 typeFace.renderGlyphs(c);
00048 }
00049
00050 void printCharOutlined(const QChar c) const;
00051 float getStrLen(const QString& s) const {return typeFace.width(s);}
00052 float getLineHeight(void) const {return typeFace.lineHeight();}
00053 float getAscent(void) const {return typeFace.ascent();}
00054 float getDescent(void) const {return typeFace.descent();}
00055 float getSize(void) const {return typeFace.pointSize();}
00056
00057 mutable TypeFace typeFace;
00058 };
00059
00060 #endif // _STELFONT_HPP_