Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure

core/StelFont.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2002 Fabien Chereau
00004  * 
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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  * Wrapper class on the TypeFace class used to display fonts in openGL
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_

Generated on Mon Feb 2 17:23:47 2009 for Stellarium by  doxygen 1.5.5