4
4
<title>Castle Game Engine: CastleWinFontConvert</title>
5
<meta name="generator" content="PasDoc 0.12.1">
5
<meta name="generator" content="PasDoc 0.13.0">
6
6
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
7
7
<link rel="StyleSheet" type="text/css" href="pasdoc.css">
23
23
<a name="PasDoc-FuncsProcs"></a><h3 class="summary">Functions and Procedures</h3>
24
24
<table class="summary wide_list">
26
<td class="itemcode"><code>function <b><a href="CastleWinFontConvert.html#Font2BitmapChar_HDc">Font2BitmapChar_HDc</a></b>(dc: HDc; c: char): <a href="CastleBitmapFonts.html#PBitmapChar">PBitmapChar</a>;</code></td>
29
<td class="itemcode"><code>function <b><a href="CastleWinFontConvert.html#Font2OutlineChar_HDc">Font2OutlineChar_HDc</a></b>(dc: HDc; c: char): <a href="CastleOutlineFonts.html#POutlineChar">POutlineChar</a>;</code></td>
32
<td class="itemcode"><code>function <b><a href="CastleWinFontConvert.html#Font2BitmapFont_HDc">Font2BitmapFont_HDc</a></b>(dc: HDc): <a href="CastleBitmapFonts.TBitmapFont.html">TBitmapFont</a>;</code></td>
35
<td class="itemcode"><code>function <b><a href="CastleWinFontConvert.html#Font2OutlineFont_HDc">Font2OutlineFont_HDc</a></b>(dc: HDc): <a href="CastleOutlineFonts.TOutlineFont.html">TOutlineFont</a>;</code></td>
38
<td class="itemcode"><code>function <b><a href="CastleWinFontConvert.html#Font2BitmapChar">Font2BitmapChar</a></b>(WinFont: HFont; c: char): <a href="CastleBitmapFonts.html#PBitmapChar">PBitmapChar</a>;</code></td>
41
<td class="itemcode"><code>function <b><a href="CastleWinFontConvert.html#Font2OutlineChar">Font2OutlineChar</a></b>(WinFont: HFont; c: char): <a href="CastleOutlineFonts.html#POutlineChar">POutlineChar</a>;</code></td>
44
26
<td class="itemcode"><code>function <b><a href="CastleWinFontConvert.html#Font2BitmapFont">Font2BitmapFont</a></b>(WinFont: HFont): <a href="CastleBitmapFonts.TBitmapFont.html">TBitmapFont</a>;</code></td>
57
39
<h3 class="detail">Functions and Procedures</h3>
58
40
<table class="detail wide_list">
60
<td class="itemcode"><a name="Font2BitmapChar_HDc"></a><code>function <b>Font2BitmapChar_HDc</b>(dc: HDc; c: char): <a href="CastleBitmapFonts.html#PBitmapChar">PBitmapChar</a>;</code></td>
64
Both functions grab character c from Windows font currently selected on device context dc. Remeber to free resulting pointer by FreeMem.
66
<p>"Underline" and "strikeout" : I observed that it does not matter whether font is underline or strikeout (e.g. what values for fdwUnderline/StrikeOut you gave when calling CreateFont). Fonts converted by this function are always NOT underlined and not strikeout. On the other hand, "bold" (actually "weight") and "italic" matter, i.e. fonts created by this functions reflect the weight and italic state of the font. This is true both for <a class="normal" href="CastleWinFontConvert.html#Font2BitmapChar">Font2BitmapChar</a> and <a class="normal" href="CastleWinFontConvert.html#Font2OutlineChar">Font2OutlineChar</a>. This is an effect of how Windows.GetGlyphOutline works. However I didn't find any place documenting these details about GetGlyphOutline. This is not a result of the fact that TTF fonts are usually distributed with separate bold, italic, and bold+italic versions, because I checked this with fonts that are distributed without bold, italic, bold+italic versions (i.e. bold, italic, bold+italic versions must be automatically synthesized by Windows) and for such fonts it works the same : bold, italic, b+i versions can be constructed by Font2XxxChar versions below, and underline and strikeout properties of Windows font are ignored.
71
<table class="detail wide_list">
73
<td class="itemcode"><a name="Font2OutlineChar_HDc"></a><code>function <b>Font2OutlineChar_HDc</b>(dc: HDc; c: char): <a href="CastleOutlineFonts.html#POutlineChar">POutlineChar</a>;</code></td>
78
<table class="detail wide_list">
80
<td class="itemcode"><a name="Font2BitmapFont_HDc"></a><code>function <b>Font2BitmapFont_HDc</b>(dc: HDc): <a href="CastleBitmapFonts.TBitmapFont.html">TBitmapFont</a>;</code></td>
84
Grab currently selected Windows font on device context dc. Remeber to free resulting font later by <a class="normal" href="CastleWinFontConvert.html#FreeAndNilFont">FreeAndNilFont</a>. </p>
87
<table class="detail wide_list">
89
<td class="itemcode"><a name="Font2OutlineFont_HDc"></a><code>function <b>Font2OutlineFont_HDc</b>(dc: HDc): <a href="CastleOutlineFonts.TOutlineFont.html">TOutlineFont</a>;</code></td>
94
<table class="detail wide_list">
96
<td class="itemcode"><a name="Font2BitmapChar"></a><code>function <b>Font2BitmapChar</b>(WinFont: HFont; c: char): <a href="CastleBitmapFonts.html#PBitmapChar">PBitmapChar</a>;</code></td>
100
Usually much more comfortable versions of Font2XxxFont_HDc and Font2XxxChar_HDc. They take HFont, not HDc. This way they avoid some strangeness of GetGlyphOutline function (that requires as an argument HDc with selected font, not HFont)
105
<table class="detail wide_list">
107
<td class="itemcode"><a name="Font2OutlineChar"></a><code>function <b>Font2OutlineChar</b>(WinFont: HFont; c: char): <a href="CastleOutlineFonts.html#POutlineChar">POutlineChar</a>;</code></td>
112
<table class="detail wide_list">
114
42
<td class="itemcode"><a name="Font2BitmapFont"></a><code>function <b>Font2BitmapFont</b>(WinFont: HFont): <a href="CastleBitmapFonts.TBitmapFont.html">TBitmapFont</a>;</code></td>
116
44
<tr><td colspan="1">
46
Create our font from a Windows font handle. Remeber to free resulting font later by <a class="normal" href="CastleWinFontConvert.html#FreeAndNilFont">FreeAndNilFont</a>. </p>
119
49
<table class="detail wide_list">
130
60
<tr><td colspan="1">
132
Free and nil Font instance, freeing also all characters by FreeMem. Use this only on fonts with characters created by GetMem. </p>
62
Free and nil Font instance, freeing also all characters by FreeMem. Use this only on fonts with characters created by <a class="normal" href="CastleWinFontConvert.html#Font2BitmapFont">Font2BitmapFont</a> / <a class="normal" href="CastleWinFontConvert.html#Font2OutlineFont">Font2OutlineFont</a>. </p>
135
65
<table class="detail wide_list">