1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2004 the VideoLAN team
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef BITMAP_FONT_HPP
25 #define BITMAP_FONT_HPP
27 #include "generic_font.hpp"
33 /// Class to handle bitmap fonts
34 class BitmapFont
: public GenericFont
37 BitmapFont( intf_thread_t
*pIntf
, const GenericBitmap
&rBitmap
,
38 const string
&rType
);
39 virtual ~BitmapFont() { }
41 virtual bool init() { return true; }
43 /// Render a string on a bitmap.
44 /// If maxWidth != -1, the text is truncated with '...'
45 virtual GenericBitmap
*drawString( const UString
&rString
,
46 uint32_t color
, int maxWidth
= -1 ) const;
49 virtual int getSize() const { return m_height
; }
52 /// Description of a glyph
55 Glyph_t(): m_xPos( -1 ), m_yPos( 0 ) { }
60 const GenericBitmap
&m_rBitmap
;
62 int m_width
, m_height
;
63 /// Horizontal advance between two characters
65 /// Horizontal advance for non-displayable characters