skins2: fix RadialSlider
[vlc/asuraparaju-public.git] / modules / gui / skins2 / src / bitmap_font.hpp
blob15f2bcd0fa3661fff41f3b0f9390e76b809464ad
1 /*****************************************************************************
2 * bitmap_font.hpp
3 *****************************************************************************
4 * Copyright (C) 2004 the VideoLAN team
5 * $Id$
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"
28 #include <string>
30 class GenericBitmap;
33 /// Class to handle bitmap fonts
34 class BitmapFont: public GenericFont
36 public:
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;
48 /// Get the font size
49 virtual int getSize() const { return m_height; }
51 private:
52 /// Description of a glyph
53 struct Glyph_t
55 Glyph_t(): m_xPos( -1 ), m_yPos( 0 ) { }
56 int m_xPos, m_yPos;
59 /// Bitmap
60 const GenericBitmap &m_rBitmap;
61 /// Glyph size
62 int m_width, m_height;
63 /// Horizontal advance between two characters
64 int m_advance;
65 /// Horizontal advance for non-displayable characters
66 int m_skip;
67 /// Character table
68 Glyph_t m_table[256];
71 #endif