summaryrefslogtreecommitdiff
path: root/glcdgraphics/font.h
diff options
context:
space:
mode:
authormrwastl <mrwastl@users.sourceforge.net>2011-05-01 22:22:32 +0200
committermrwastl <mrwastl@users.sourceforge.net>2011-05-01 22:22:32 +0200
commit46e597df44402086edd010b69702c2de52b75fc8 (patch)
treefa9528f19f951b765b071c239b09547cf69bd169 /glcdgraphics/font.h
parent57729cf285b058d192a60bd7fce1b2d29bdd9650 (diff)
downloadgraphlcd-base-46e597df44402086edd010b69702c2de52b75fc8.tar.gz
graphlcd-base-46e597df44402086edd010b69702c2de52b75fc8.tar.bz2
initial upload to branch 'touchcol'. see file 'HISTORY' for changes
Diffstat (limited to 'glcdgraphics/font.h')
-rw-r--r--glcdgraphics/font.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/glcdgraphics/font.h b/glcdgraphics/font.h
index b36d5ac..1315123 100644
--- a/glcdgraphics/font.h
+++ b/glcdgraphics/font.h
@@ -9,7 +9,9 @@
* This file is released under the GNU General Public License. Refer
* to the COPYING file distributed with this package.
*
- * (c) 2004 Andreas Regel <andreas.regel AT powarman.de>
+ * (c) 2004-2010 Andreas Regel <andreas.regel AT powarman.de>
+ * (c) 2010-2011 Wolfgang Astleitner <mrwastl AT users sourceforge net>
+ * Andreas 'randy' Weinberger
*/
#ifndef _GLCDGRAPHICS_FONT_H_
@@ -23,6 +25,8 @@
namespace GLCD
{
+class cBitmapCache;
+
class cFont
{
private:
@@ -33,6 +37,14 @@ private:
int lineHeight;
cBitmap * characters[256];
+ int fontType; //original or FT2 font, 1-original, 2-ft2
+
+ bool isutf8;
+ wchar_t iconv_lut[256]; // lookup table needed if encoding != UTF-8
+
+ cBitmapCache *characters_cache;
+ void *ft2_library; //FT_Library
+ void *ft2_face; //FT_Face
protected:
void Init();
void Unload();
@@ -40,7 +52,7 @@ public:
cFont();
~cFont();
- bool LoadFNT(const std::string & fileName);
+ bool LoadFNT(const std::string & fileName, const std::string & encoding = "UTF-8");
bool SaveFNT(const std::string & fileName) const;
bool LoadFT2(const std::string & fileName, const std::string & encoding,
int size, bool dingBats = false);
@@ -56,18 +68,19 @@ public:
void SetSpaceBetween(int width) { spaceBetween = width; };
void SetLineHeight(int height) { lineHeight = height; };
- int Width(char ch) const;
+ int Width(uint32_t ch) const;
int Width(const std::string & str) const;
int Width(const std::string & str, unsigned int len) const;
- int Height(char ch) const;
+ int Height(uint32_t ch) const;
int Height(const std::string & str) const;
int Height(const std::string & str, unsigned int len) const;
- const cBitmap * GetCharacter(char ch) const;
+ const cBitmap * GetCharacter(uint32_t ch) const;
void SetCharacter(char ch, cBitmap * bitmapChar);
void WrapText(int Width, int Height, std::string & Text,
std::vector <std::string> & Lines, int * TextWidth = NULL) const;
+ bool IsUTF8(void) const { return isutf8; }
};
} // end of namespace