Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

ft2_font.hpp

00001 /*****************************************************************************
00002  * ft2_font.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: ft2_font.hpp 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *          Olivier Teulière <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef FT2_FONT_HPP
00026 #define FT2_FONT_HPP
00027 
00028 #include <ft2build.h>
00029 #include FT_FREETYPE_H
00030 #include FT_GLYPH_H
00031 #include <string>
00032 #include <map>
00033 
00034 #include "generic_font.hpp"
00035 
00036 class UString;
00037 
00038 
00040 class FT2Font: public GenericFont
00041 {
00042     public:
00043         FT2Font( intf_thread_t *pIntf, const string &rName, int size );
00044         virtual ~FT2Font();
00045 
00047         virtual bool init();
00048 
00051         virtual GenericBitmap *drawString( const UString &rString,
00052             uint32_t color, int maxWidth = -1 ) const;
00053 
00055         virtual int getSize() const { return m_height; }
00056 
00057     private:
00058         typedef struct
00059         {
00060             FT_Glyph m_glyph;
00061             FT_BBox m_size;
00062             int m_index;
00063             int m_advance;
00064         } Glyph_t;
00065         typedef map<uint32_t,Glyph_t> GlyphMap_t;
00066 
00068         const string m_name;
00070         void *m_buffer;
00072         int m_size;
00074         FT_Library m_lib;
00076         FT_Face m_face;
00078         int m_height, m_ascender, m_descender;
00080         mutable GlyphMap_t m_glyphCache;
00081 
00083         Glyph_t &getGlyph( uint32_t code ) const;
00084 };
00085 
00086 
00087 #endif

Generated on Tue Dec 20 10:14:42 2005 for vlc-0.8.4a by  doxygen 1.4.2