- This wiki is out of date, use the continuation of this wiki instead
Load ttfaa
From FenixWiki
Revision as of 12:57, 29 February 2008 (edit) Sandman (Talk | contribs) (New page: Category:functions Category:ttfdll Category:dll '''Up to TTF.DLL Functions''' ---- ==Definition== '''INT''' load_ttfaa ( <'''STRING''' filename> ...) ← Previous diff |
Current revision (00:54, 1 March 2008) (edit) (undo) Sandman (Talk | contribs) m |
||
Line 11: | Line 11: | ||
Loads a [[TTF]] file as a [[font]] into memory. | Loads a [[TTF]] file as a [[font]] into memory. | ||
+ | |||
+ | Also called '''TTF_LoadAA'''() (if TTF.fh is included). | ||
== Parameters == | == Parameters == |
Current revision
Contents |
[edit] Definition
INT load_ttfaa ( <STRING filename> , <INT height> , <INT colordepth> , <INT backgroundcolor> , <INT textcolor> )
Loads a TTF file as a font into memory.
Also called TTF_LoadAA() (if TTF.fh is included).
[edit] Parameters
STRING filename | - The filename of the TTF file that you wish to load (including extension and possible path). |
INT height | - The height in pixels of the to be created font, a size indication. |
INT colordepth | - The colordepth of the to be created font (1,8 or 16). |
INT backgroundcolor | - The background color of the to be created font. |
INT textcolor | - The text color of the to be created font. |
[edit] Returns
INT : FontID
-1 | - Error: file does not exist; insufficient memory; failed to init freetype.dll; error while loading file; error creating new font. |
0 | - Invalid filename. |
>0 | - The FontID. |
[edit] Errors
Insufficient memory | - There is insufficient memory available. This error doesn't occur often. |
Failed to init freetype.dll | - There was an error initializing freetype.dll |
Error loading file | - There occurred an error while trying to load the file. |
Error creating new font | - There occurred an error while trying to create a new font. |
[edit] Notes
This function gets a TrueType font and creates a new font with generated glyphs based on the recovered font in the standard characters set (ISO-8859-1). These glyphs are generated with two colours, being the specified colours.
It's possible to save the loaded font as FNT with save_fnt(). This way the font can be reused on platforms not supporting TTF.DLL. Note that a FNT file only has information about the font for one size, while a TTF file has information for any size.
The specified size is only an indication; some characters may be a little higher in fact.
The parameters backgroundcolor and textcolor only matter for 8 and 16 bit colordepths. If you specify a colordepth of 1, then the returned font will be black (background) and white (textcolour). The advantage of this, is that you can use change the colour any time, even after loading, with set_text_color().
[edit] Example
include "TTF.fh"; Process Main() Private int fontID; Begin fontID = load_ttfaa("myttf.ttf",20,1,0,0); // 1bit colordepth set_text_color(rgb(255,0,255)); // set_text_color() after load_ttfaa() write(fontID,160,100,4,"Look at my TTF font!"); Repeat frame; Until(key(_ESC)) unload_fnt(fontID); End
Used in example: load_ttfaa(), set_text_color(), rgb(), write(), key(), unload_fnt()
TTF.DLL Functions | |
• Load_ttf() • Load_ttfaa() • |
Categories: Functions | Ttfdll | Dll