1 /* vim:expandtab:ts=2 sw=2: 2 */ 3 /* Grafx2 - The Ultimate 256-color bitmap paint program 4 5 Copyright owned by various GrafX2 authors, see COPYRIGHT.txt for details. 6 7 Grafx2 is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public License 9 as published by the Free Software Foundation; version 2 10 of the License. 11 12 Grafx2 is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with Grafx2; if not, see <http://www.gnu.org/licenses/> 19 */ 20 21 ////////////////////////////////////////////////////////////////////////////// 22 ///@file text.h 23 /// Functions related to rendering text as a brush, using TrueType or SFont. 24 ////////////////////////////////////////////////////////////////////////////// 25 26 /// Initialization of text settings, needs to be called once on program startup. 27 void Init_text(void); 28 /// text settings cleanup. called on program shutdown 29 void Uninit_text(void); 30 /// Returns true if text.c was compiled with TrueType support. 31 int TrueType_is_supported(void); 32 /// Add a new font to the list to propose to the user. 33 void Add_font(const char *name); 34 /// 35 /// Creates a brush, from the parameters given: 36 /// @param str The text to render 37 /// @param font_number The index of the font to use. Pass 0 for the first font you declared with ::Add_font(), 1 for the second etc. 38 /// @param size The size in points (unused for bitmap fonts) 39 /// @param antialias Boolean, true to use antialiasing in TrueType 40 /// @param bold Boolean, true to use bold rendering in TrueType 41 /// @param italic Boolean, true to use italic rendering in TrueType 42 /// @param width Returns the width of the created brush, in pixels. 43 /// @param height Returns the height of the created brush, in pixels. 44 /// @param palette Returns the custom palette for the brush. 45 /// Returns true on success. 46 byte *Render_text(const char *str, int font_number, int size, int antialias, int bold, int italic, int *width, int *height, T_Palette palette); 47 48 /// Finds a label to display for a font declared with ::Add_font(). 49 const char * Font_label(int index); 50 /// Finds the filename of a font declared with ::Add_font(). 51 const char * Font_name(int index); 52 /// Returns true if the font of this number is TrueType, false if it's a SFont bitmap. 53 int TrueType_font(int index); 54 /// 55 /// Number of fonts declared with a series of ::Add_font() 56 int Font_count(void); 57