<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EvoTalk &#187; font</title>
	<atom:link href="http://evotalk.net/blog/tag/font/feed" rel="self" type="application/rss+xml" />
	<link>http://evotalk.net/blog</link>
	<description></description>
	<lastBuildDate>Mon, 07 Jun 2010 03:01:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MFC: Set Font From File or Resource</title>
		<link>http://evotalk.net/blog/2007/07/mfc-set-font-from-file-or-resource.html</link>
		<comments>http://evotalk.net/blog/2007/07/mfc-set-font-from-file-or-resource.html#comments</comments>
		<pubDate>Thu, 05 Jul 2007 06:17:11 +0000</pubDate>
		<dc:creator>asd</dc:creator>
				<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[程式設計]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[mfc]]></category>

		<guid isPermaLink="false">http://evotalk.net/blog/?p=366</guid>
		<description><![CDATA[1. set font from file
Assume there is a font file "ladderkk.ttf" under work dir and declare member variable 「CFont m_font」 in class private section。
view plain

C++:




if &#40;AddFontResource&#40;"ladderkk.ttf"&#41; == 0&#41; &#123;


AfxMessageBox&#40;"add font fail"&#41;;


return FALSE;


&#125;


LOGFONT lf;


memset&#40;&#38;amp;lf, 0, sizeof&#40;LOGFONT&#41;&#41;;&#160; &#160;// Clear out structure.


lf.lfHeight = 20;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;// Request [...]]]></description>
			<content:encoded><![CDATA[<h4>1. set font from file</h4>
<p>Assume there is a font file "ladderkk.ttf" under work dir and declare member variable 「CFont m_font」 in class private section。</p>
<div class="igBar"><span id="lcpp-3"><a href="#" onclick="javascript:showCodeTxt('cpp-3'); return false;">view plain</a></span></div>
<div class="shadow">
<div class="syntax_hilite"><span class="langName">C++:</span>
<div id="cpp-3">
<div class="cpp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span>AddFontResource<span style="color: #000000;">&#40;</span><span style="color: #666666;">"ladderkk.ttf"</span><span style="color: #000000;">&#41;</span> == <span style="color: #0000dd;color:#800000;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">AfxMessageBox<span style="color: #000000;">&#40;</span><span style="color: #666666;">"add font fail"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">return</span> <span style="color: #0000ff;">FALSE</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">LOGFONT lf;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000dd;">memset</span><span style="color: #000000;">&#40;</span>&amp;amp;lf, <span style="color: #0000dd;color:#800000;">0</span>, <span style="color: #0000dd;">sizeof</span><span style="color: #000000;">&#40;</span>LOGFONT<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;&nbsp; &nbsp;<span style="color: #ff0000;">// Clear out structure.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">lf.<span style="color: #00eeff;">lfHeight</span> = <span style="color: #0000dd;color:#800000;">20</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">// Request a 20-pixel-high font</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000dd;">strcpy</span><span style="color: #000000;">&#40;</span>lf.<span style="color: #00eeff;">lfFaceName</span>, <span style="color: #666666;">"LadderKK"</span><span style="color: #000000;">&#41;</span>;&nbsp; &nbsp; <span style="color: #ff0000;">//&nbsp; &nbsp; with face name &quot;Arial&quot;.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">m_font.<span style="color: #00eeff;">CreateFontIndirect</span><span style="color: #000000;">&#40;</span>&amp;amp;lf<span style="color: #000000;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">// Create the font.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GetDlgItem<span style="color: #000000;">&#40;</span>IDC_EDIT1<span style="color: #000000;">&#41;</span>-&amp;gt;SetFont<span style="color: #000000;">&#40;</span>&amp;amp;m_font<span style="color: #000000;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<h4>2. set font from resource</h4>
<p>in your rc file , add</p>
<blockquote><p>4 FONT "ladderkk.ttf"</p></blockquote>
<p>in your stdafx.h add</p>
<blockquote><p>＃define _WIN32_WINNT 0x0500<br />
＃define WINVER 0x0500</p></blockquote>
<p>in your cpp file</p>
<div class="igBar"><span id="lcpp-4"><a href="#" onclick="javascript:showCodeTxt('cpp-4'); return false;">view plain</a></span></div>
<div class="shadow">
<div class="syntax_hilite"><span class="langName">C++:</span>
<div id="cpp-4">
<div class="cpp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">HINSTANCE h=AfxGetInstanceHandle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ULONG nFont = <span style="color: #0000dd;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">HRSRC hr=FindResource<span style="color: #000000;">&#40;</span>h, <span style="color: #666666;">"#4"</span> , RT_FONT<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">HGLOBAL hg=LoadResource<span style="color: #000000;">&#40;</span>h,hr<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">LPSTR lp=<span style="color: #000000;">&#40;</span>LPSTR<span style="color: #000000;">&#41;</span>LockResource<span style="color: #000000;">&#40;</span>hg<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DWORD dwSize = SizeofResource<span style="color: #000000;">&#40;</span>h, hr<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">HANDLE handle = AddFontMemResourceEx<span style="color: #000000;">&#40;</span>lp, dwSize, <span style="color: #0000dd;color:#800000;">0</span>, &amp;amp;nFont<span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">// TODO: Add extra initialization here</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">LOGFONT lf;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000dd;">memset</span><span style="color: #000000;">&#40;</span>&amp;amp;lf, <span style="color: #0000dd;color:#800000;">0</span>, <span style="color: #0000dd;">sizeof</span><span style="color: #000000;">&#40;</span>LOGFONT<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;&nbsp; &nbsp;<span style="color: #ff0000;">// Clear out structure.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">lf.<span style="color: #00eeff;">lfHeight</span> = <span style="color: #0000dd;color:#800000;">20</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">// Request a 20-pixel-high font</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000dd;">strcpy</span><span style="color: #000000;">&#40;</span>lf.<span style="color: #00eeff;">lfFaceName</span>, <span style="color: #666666;">"LadderKK"</span><span style="color: #000000;">&#41;</span>;&nbsp; &nbsp; <span style="color: #ff0000;">//&nbsp; &nbsp; with face name &quot;Arial&quot;.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">m_font.<span style="color: #00eeff;">CreateFontIndirect</span><span style="color: #000000;">&#40;</span>&amp;amp;lf<span style="color: #000000;">&#41;</span>;&nbsp; &nbsp; <span style="color: #ff0000;">// Create the font.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GetDlgItem<span style="color: #000000;">&#40;</span>IDC_EDIT1<span style="color: #000000;">&#41;</span>-&amp;gt;SetFont<span style="color: #000000;">&#40;</span>&amp;amp;m_font<span style="color: #000000;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<h4>Attension</h4>
<ol>
<li>if no define 「_WIN32_WINNT」and 「WINVER」, vc6 compiler can't find 「AddFontMemResourceEx」</li>
<li>When exiting the app, call 「RemoveFontResource」or 「RemoveFontMemResourceEx」</li>
</ol>
<dl>
<dt>
<h4>Reference</h4>
</dt>
<dd><a href="http://support.microsoft.com/kb/q85518/">使用正確的 MFC 中 SetFont() 函式</a></p>
</dd>
<dd><a href="http://msdn2.microsoft.com/en-us/library/aa383745.aspx">Using the Windows Headers</a></dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://evotalk.net/blog/2007/07/mfc-set-font-from-file-or-resource.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KK 音標字型</title>
		<link>http://evotalk.net/blog/2007/07/kk-phonetic-fonts.html</link>
		<comments>http://evotalk.net/blog/2007/07/kk-phonetic-fonts.html#comments</comments>
		<pubDate>Tue, 03 Jul 2007 08:54:24 +0000</pubDate>
		<dc:creator>asd</dc:creator>
				<category><![CDATA[科技新知]]></category>
		<category><![CDATA[軟體使用]]></category>
		<category><![CDATA[font]]></category>

		<guid isPermaLink="false">http://evotalk.net/blog/?p=365</guid>
		<description><![CDATA[想打出 kk 音標，下載並安裝 kk 音標字型 即可。
KK 音標符號表
]]></description>
			<content:encoded><![CDATA[<p>想打出 kk 音標，下載並安裝 <a href="http://new.ladder100.com/downloadcenter/FileMessage.aspx?FileID=107">kk 音標字型</a> 即可。</p>
<p><a href="http://www.wretch.cc/blog/cdsheen&amp;article_id=2300718">KK 音標符號表</a></p>
]]></content:encoded>
			<wfw:commentRss>http://evotalk.net/blog/2007/07/kk-phonetic-fonts.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>適合閱讀的字型</title>
		<link>http://evotalk.net/blog/2005/11/fit-read-font.html</link>
		<comments>http://evotalk.net/blog/2005/11/fit-read-font.html#comments</comments>
		<pubDate>Sun, 06 Nov 2005 18:28:34 +0000</pubDate>
		<dc:creator>asd</dc:creator>
				<category><![CDATA[科技新知]]></category>
		<category><![CDATA[軟體使用]]></category>
		<category><![CDATA[font]]></category>

		<guid isPermaLink="false">http://evotalk.net/blog/?p=16</guid>
		<description><![CDATA[適合閱讀的字型有以下條件

Crisp clear characters.
Extended characterset.
Good use of whitespace.
'l', '1' and 'i' are easily distinguished
'0', 'o' and 'O' are easily distinguished
forward quotes from back quotes are easily distinguished -prefer mirrored appearance
Clear punctuation characters, especially braces, parenthesis and brackets

參考 Monospace/Fixed Width Programmer's Fonts 網站，找到這個字型 Bitstream Vera Sans Mono (View Sample) 覺得不錯用。

8, 9, 10, 11, 12, 14, 16, 18, [...]]]></description>
			<content:encoded><![CDATA[<p>適合閱讀的字型有以下條件</p>
<ul>
<li>Crisp clear characters.</li>
<li>Extended characterset.</li>
<li>Good use of whitespace.</li>
<li>'l', '1' and 'i' are easily distinguished</li>
<li>'0', 'o' and 'O' are easily distinguished</li>
<li>forward quotes from back quotes are easily distinguished -prefer mirrored appearance</li>
<li>Clear punctuation characters, especially braces, parenthesis and brackets</li>
</ul>
<p>參考 <a href="http://www.lowing.org/fonts/"><span style="color: #0066cc;">Monospace/Fixed Width Programmer's Fonts</span></a> 網站，找到這個字型 <strong>Bitstream Vera Sans Mono</strong> (<a href="http://www.dafont.com/en/font.php?file=bitstream_vera_mono"><span style="color: #0066cc;">View Sample</span></a>) 覺得不錯用。</p>
<ul>
<li>8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72</li>
<li>TrueType</li>
<li>Plenty of space between lines, dotted zeros, clean.</li>
<li><a href="http://www.gnome.org/fonts/"><span style="color: #0066cc;">http://www.gnome.org/fonts/</span></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://evotalk.net/blog/2005/11/fit-read-font.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
