File: ttf.html

package info (click to toggle)
libsdl-sge 020904-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 928 kB
  • ctags: 775
  • sloc: cpp: 8,049; makefile: 163; ansic: 44
file content (114 lines) | stat: -rw-r--r-- 5,084 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<html>
<!--------------------------------------------------->
<!--               Docs/ttf - SGE                  -->
<!--------------------------------------------------->
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>SGE Documentation - TTF</title>
</head>

<body bgcolor=#DED7A0>

<H1>TrueType font rendering</H1>

<P>
<UL>
<LI><A HREF="#ttstructure">The TT font structure</A>
<LI><A HREF="#sge_TTF_Init">sge_TTF_Init</A>
<LI><A HREF="#sge_TTF_OpenFont">sge_TTF_OpenFont</A>
<LI><A HREF="#sge_TTF_OpenFontIndex">sge_TTF_OpenFontIndex</A>
<LI><A HREF="#sge_TTF_CloseFont">sge_TTF_CloseFont</A>
<LI><A HREF="#sge_TTF_FontHeight">sge_TTF_FontHeight</A>
<LI><A HREF="#sge_TTF_SetFontSize">sge_TTF_SetFontSize</A>
<LI><A HREF="#sge_TTF_TextSize">sge_TTF_TextSize</A>
<LI><A HREF="#sge_TTF_FontAscent">sge_TTF_FontAscent</A>
<LI><A HREF="#sge_TTF_FontDescent">sge_TTF_FontDescent</A>
<LI><A HREF="#sge_TTF_FontLineSkip">sge_TTF_FontLineSkip</A>
<LI><A HREF="#sge_TTF_FontFaces">sge_TTF_FontFaces</A>
<LI><A HREF="#sge_TTF_FontFaceIsFixedWidth">sge_TTF_FontFaceIsFixedWidth</A>
<LI><A HREF="#sge_TTF_FontFaceFamilyName">sge_TTF_FontFaceFamilyName</A>
<LI><A HREF="#sge_TTF_FontFaceStyleName">sge_TTF_FontFaceStyleName</A>
<LI><A HREF="#sge_TTF_AAOn">sge_TTF_AAOn/Off/_Alpha</A>
<LI><A HREF="#sge_TTF_SetFontStyle">sge_TTF_SetFontStyle</A>
<LI><A HREF="#sge_TTF_GetFontStyle">sge_TTF_GetFontStyle</A>
</UL>

<B><a name="ttstructure">The TT font structure</a></B><BR>
<PRE>typedef struct{
  ...
} sge_TTFont;</PRE>

When working with TTF functions you must give a pointer to the font structure. To open a new font (structure) use sge_TTF_OpenFont() and when finished use sge_TTF_CloseFont().<BR><BR><BR>


<B>int <a name="sge_TTF_Init">sge_TTF_Init</a>(void)</B><BR>
Starts the FreeType engine, must be called before any of the other TTF functions. Returns 0 on success.<BR><BR>

<B>sge_TTFont *<a name="sge_TTF_OpenFont">sge_TTF_OpenFont</a>(char *file, int ptsize)</B><BR>
Opens the given ttf file and sets the font size to ptsize. Returns a pointer to the new font.<BR><BR>

<B>sge_TTFont *<a name="sge_TTF_OpenFontIndex">sge_TTF_OpenFontIndex</a>(char *file, int ptsize, long index, int xdpi, int ydpi)</B><BR>
Same as sge_TTF_OpenFont() but you can also set the font face index and the dpi used. Font face #0 and 96x96dpi is used 
with sge_TTF_OpenFont().<BR><BR>

<B>void <a name="sge_TTF_CloseFont">sge_TTF_CloseFont</a>(sge_TTFont *font)</B><BR>
Removes font from memory.<BR><BR>

<B>int <a name="sge_TTF_FontHeight">sge_TTF_FontHeight</a>(sge_TTFont *font)</B><BR>
Returns the distance between the fonts baseline and the top of the highest character.<BR><BR>

<B>int <a name="sge_TTF_SetFontSize">sge_TTF_SetFontSize</a>(sge_TTFont *font, int ptsize)</B><BR>
Change the size of the given font. Returns 0 on success.<BR><BR>

<B>SDL_Rect <a name="sge_TTF_TextSize">sge_TTF_TextSize</a>(sge_TTFont *Font, char *Text)</B><BR>
Returns the width (.w) and height (.h) of the text with the given font.<BR><BR>

<B>int <a name="sge_TTF_FontAscent">sge_TTF_FontAscent</a>(sge_TTFont *font)</B><BR>
Returns the ascent of the font.<BR><BR>

<B>int <a name="sge_TTF_FontDescent">sge_TTF_FontDescent</a>(sge_TTFont *font)</B><BR>
Returns the descent of the font.<BR><BR>

<B>int <a name="sge_TTF_FontLineSkip">sge_TTF_FontLineSkip</a>(sge_TTFont *font)</B><BR>
Returns the recommended line skip for this font.<BR><BR>

<B>long <a name="sge_TTF_FontFaces">sge_TTF_FontFaces</a>(sge_TTFont *font)</B><BR>
Returns the number of font faces available for this font.<BR><BR>

<B>int <a name="sge_TTF_FontFaceIsFixedWidth">sge_TTF_FontFaceIsFixedWidth</a>(sge_TTFont *font)</B><BR>
Returns true if the used font face is fixed width.<BR><BR>

<B>char *<a name="sge_TTF_FontFaceFamilyName">sge_TTF_FontFaceFamilyName</a>(sge_TTFont *font)</B><BR>
Returns the family name of the selected font face.<BR><BR>

<B>char *<a name="sge_TTF_FontFaceStyleName">sge_TTF_FontFaceStyleName</a>(sge_TTFont *font)</B><BR>
Returns the style name of this font face.<BR><BR>

<B>void <a name="sge_TTF_AAOn">sge_TTF_AAOn</a>(void)<BR>
void sge_TTF_AAOff(void)<BR>
void sge_TTF_AA_Alpha(void)</B><BR>
Turns anti-aliasing for truetype output on/off. Defaults to ON. You can also enable alpha blending support (very nice but slow).<BR><BR>

<B>void <a name="sge_TTF_SetFontStyle">sge_TTF_SetFontStyle</a>(sge_TTFont *font, Uint8 style)</B><BR>
Sets the font style.<BR>
<B>Flags:</B> (may be ORed, eg. SGE_TTF_BOLD|SGE_TTF_ITALIC)<BR>
<I>SGE_TTF_NORMAL</I> - The default style.<BR>
<I>SGE_TTF_BOLD</I> - Bold.<BR>
<I>SGE_TTF_ITALIC</I> - Italic.<BR>
<I>SGE_TTF_UNDERLINE</I> - Underlined.
<BR><BR>

<B>Uint8 <a name="sge_TTF_GetFontStyle">sge_TTF_GetFontStyle</a>(sge_TTFont *font)</B><BR>
Returns the current font style.<BR><BR>

</P>

	
<BR><BR><BR><HR>
<P><I><SMALL>
Copyright &copy; 1999-2002 Anders Lindstrm<BR>
Last updated 020821
</SMALL></I></P>

</body>
</html>