3 * \brief Bitmap font renderer header file.
6 * (c) 2009 Technische Universität Dresden
7 * This file is part of TUD:OS and distributed under the terms of the
8 * GNU Lesser General Public License 2.1.
9 * Please see the COPYING-LGPL-2.1 file for details.
13 #include <l4/sys/compiler.h>
14 #include <l4/re/c/video/view.h>
15 #include <l4/libgfxbitmap/bitmap.h>
18 * \defgroup api_gfxbitmap_font Functions for rendering bitmap fonts to frame buffers
19 * \ingroup api_gfxbitmap
23 * \addtogroup api_gfxbitmap_font
28 * \brief Constant to use for the default font.
30 enum { GFXBITMAP_DEFAULT_FONT = 0 };
33 * \brief Constant for length field.
35 * Use this if the function should call strlen on the text argument itself.
37 enum { GFXBITMAP_USE_STRLEN = ~0U };
42 typedef void *gfxbitmap_font_t;
45 * \brief Initialize the library.
47 * This function must be called before any other font function of this
50 L4_CV int gfxbitmap_font_init(void);
53 * \brief Get the font width.
56 * \return Font width, 0 if font width could not be retrieved.
59 gfxbitmap_font_width(gfxbitmap_font_t font);
62 * \brief Get the font height.
65 * \return Font height, 0 if font height could not be retrieved.
68 gfxbitmap_font_height(gfxbitmap_font_t font);
71 * \brief Get bitmap font data for a specific character.
75 * \return Pointer to bmap data, NULL on error.
78 gfxbitmap_font_data(gfxbitmap_font_t font, unsigned c);
81 * \brief Render a string to a framebuffer.
83 * \param fb Pointer to frame buffer.
84 * \param fbi Frame buffer info structure.
86 * \param text Text string.
87 * \param len Length of the text string.
88 * \param x Horizontal position in the frame buffer.
89 * \param y Vertical position in the frame buffer.
90 * \param fg Foreground color.
91 * \param bg Background color.
94 gfxbitmap_font_text(void *fb, l4re_video_view_info_t *vi,
95 gfxbitmap_font_t font, const char *text, unsigned len,
96 unsigned x, unsigned y,
97 gfxbitmap_color_pix_t fg, gfxbitmap_color_pix_t bg);
100 * \brief Render a string to a framebuffer, including scaling.
102 * \param fb Pointer to frame buffer.
103 * \param fbi Frame buffer info structure.
105 * \param text Text string.
106 * \param len Length of the text string.
107 * \param x Horizontal position in the frame buffer.
108 * \param y Vertical position in the frame buffer.
109 * \param fg Foreground color.
110 * \param bg Background color.
111 * \param scale_x Horizonal scale factor.
112 * \param scale_y Vertical scale factor.
115 gfxbitmap_font_text_scale(void *fb, l4re_video_view_info_t *vi,
116 gfxbitmap_font_t font, const char *text, unsigned len,
117 unsigned x, unsigned y,
118 gfxbitmap_color_pix_t fg, gfxbitmap_color_pix_t bg,
119 int scale_x, int scale_y);