3 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version. The Blender
9 * Foundation also sells licenses for use in proprietary software under
10 * the Blender License. See http://www.blender.org/BL/ for information
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): none yet.
29 * ***** END GPL/BL DUAL LICENSE BLOCK *****
35 * Copyright (C) 2001 NaN Technologies B.V.
37 * API of the OpenGL bitmap font library.
38 * Currently draws fonts using the glBitmap routine.
39 * This implies that drawing speed is heavyly dependant on
40 * the 2D capabilities of the graphics card.
50 #include "BMF_Fonts.h"
53 * Returns the font for a given font type.
54 * @param font The font to retrieve.
55 * @return The font (or nil if not found).
57 BMF_Font* BMF_GetFont(BMF_FontType font);
60 * Draws a character at the current raster position.
61 * @param font The font to use.
62 * @param c The character to draw.
63 * @return Indication of success (0 == error).
65 int BMF_DrawCharacter(BMF_Font* font, char c);
68 * Draws a string at the current raster position.
69 * @param font The font to use.
70 * @param str The string to draw.
71 * @return Indication of success (0 == error).
73 int BMF_DrawString(BMF_Font* font, char* str);
76 * Returns the width of a character in pixels.
77 * @param font The font to use.
78 * @param c The character.
81 int BMF_GetCharacterWidth(BMF_Font* font, char c);
84 * Returns the width of a string of characters.
85 * @param font The font to use.
86 * @param str The string.
89 int BMF_GetStringWidth(BMF_Font* font, char* str);
92 * Returns the bounding box of a string of characters.
93 * @param font The font to use.
94 * @param str The string.
95 * @param llx Lower left x coord
96 * @param lly Lower left y coord
97 * @param urx Upper right x coord
98 * @param ury Upper right y coord
100 void BMF_GetStringBoundingBox(BMF_Font* font, char* str, float*llx, float *lly, float *urx, float *ury);
104 * Returns the bounding box of the font. The width and
105 * height represent the bounding box of the union of
106 * all glyps. The minimum and maximum values of the
107 * box represent the extent of the font and its positioning
110 void BMF_GetFontBoundingBox(BMF_Font* font, int *xmin_r, int *ymin_r, int *xmax_r, int *ymax_r);
113 * Convert the given @a font to a texture, and return the GL texture
114 * ID of the texture. If the texture ID is bound, text can
115 * be drawn using the texture by calling DrawStringTexture.
117 * @param font The font to create the texture from.
118 * @return The GL texture ID of the new texture, or -1 if unable
121 int BMF_GetFontTexture(BMF_Font* font);
124 * Draw the given @a str at the point @a x, @a y, @a z, using
125 * texture coordinates. This assumes that an appropriate texture
126 * has been bound, see BMF_BitmapFont::GetTexture(). The string
127 * is drawn along the positive X axis.
129 * @param font The font to draw with.
130 * @param string The c-string to draw.
131 * @param x The x coordinate to start drawing at.
132 * @param y The y coordinate to start drawing at.
133 * @param z The z coordinate to start drawing at.
135 void BMF_DrawStringTexture(BMF_Font* font, char* string, float x, float y, float z);
141 #endif /* __BMF_API_H */