<?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>Anthony Wong &#187; font</title>
	<atom:link href="http://blog.anthonywong.net/tag/font/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.anthonywong.net</link>
	<description>Imagine</description>
	<lastBuildDate>Mon, 10 Jan 2011 17:16:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Using Kai font for MacTeX on OS X</title>
		<link>http://blog.anthonywong.net/2008/01/24/using-kai-font-for-mactex-on-os-x/</link>
		<comments>http://blog.anthonywong.net/2008/01/24/using-kai-font-for-mactex-on-os-x/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 19:02:41 +0000</pubDate>
		<dc:creator>anthony</dc:creator>
				<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[MacTeX]]></category>
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://blog.anthonywong.net/2008/01/24/using-kai-font-for-mactex-on-os-x/</guid>
		<description><![CDATA[Typesetting LaTeX with CJK on Mac OS X is provided out-of-box by MacTeX, so working with LaTeX should be a breeze on Mac OS X. However, MacTeX ships with only two Chinese fonts, Arphic Ming Big5 (bsmi) and Arphic Sung GB2312 (gbsn). As I want to use Kai I have to look around for solutions.]]></description>
			<content:encoded><![CDATA[<p>Typesetting <a href="http://www.latex-project.org">LaTeX</a> with CJK on Mac OS X is provided out-of-box by <a href="http://www.tug.org/mactex/">MacTeX</a>, so working with LaTeX should be a breeze on Mac OS X. However, MacTeX ships with only two Chinese fonts, Arphic Ming Big5 (bsmi) and Arphic Sung GB2312 (gbsn). As I want to use Kai I have to look around for solutions.</p>
<p>I found this <a href="http://g5dual.eed.yzu.edu.tw/~lab/latex/install_cjk.html">great website</a> that explains how to use LaTeX and the CJK package on OS X. The good news is that the author of the page provides a shell script for installing any Unicode truetype fonts for TexLive so that you can use the truetype fonts in your LaTeX documents. The bad news is&#8230; it doesn&#8217;t work on my system. I tried it on both Arphic Big5 and GB2312 Kai fonts, and when I ran  my LaTeX document through the <code>latex</code> command (or in TeXShop, for that matters), I came to this error:</p>
<pre style="border: 1px solid #DDD; padding: 2px">
! Package inputenc Error: Keyboard character used is undefined
(inputenc)                in inputencoding `utf8'.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.194 ^^[
         ndinput
</pre>
<p>Trying the shell script on the STKaiti font (/Library/Fonts/华文楷体.ttf) shipped with OS X, is even worse, because ttf2tfm gives a "Bus error" (or segfault on Linux) when parsing the truetype font, looks like a bug in ttf2tfm:</p>
<pre style="border: 1px solid #DDD; padding: 2px">
$ ttf2tfm stkaiti.ttf -P 0 -E 3 -w "stkaitiu@Unicode@"
This is ttf2tfm version 1.5

stkaitiu00:

Glyph  Code   Glyph Name                Width  llx    lly      urx    ury
------------------------------------------------------------------------
Bus error
</pre>
<p>At the end, I resort to extracting the necessary files from Debian packages (hurray Debian) and put them into ~/Library/texmf, and that works!</p>
<p>The Debian packages I use are <a href="http://packages.debian.org/lenny/latex-cjk-chinese-arphic-bkai00mp">latex-cjk-chinese-arphic-bkai00mp</a> and <a href="http://packages.debian.org/lenny/latex-cjk-chinese-arphic-gkai00mp">latex-cjk-chinese-arphic-gkai00mp</a>. Since Debian packages are just <code>ar</code> archives, they can be extracted by the <code>ar x <deb></code> command. After the deb package has been extracted, extract the data.tar.gz file, and then look for the folders called <code>fonts</code> and <code>tex</code>, move them to <code>~/Library/texmf</code>, which you have to create. Now you should have a directory structure like this:</p>
<p><a href="http://blog.anthonywong.net/wp-content/uploads/2008/01/mactex-font-installation.png" rel="lightbox[pics154]" title="MacTex font installation"><img src="http://blog.anthonywong.net/wp-content/uploads/2008/01/mactex-font-installation.png" width="550" height="310" alt="MacTex font installation" class="imageframe imgaligncenter"  style="border: solid 1px #CCC; padding: 4px"/></a></p>
<p>After the font files have been put in place, run these two commands (for the Big5 Kai truetype font):</p>
<pre>
$ sudo texhash
$ sudo updmap --enable Map bkaiu.map
</pre>
<p>For the GB2312 one, use:</p>
<pre>
$ sudo texhash
$ sudo updmap --enable Map gkaiu.map
</pre>
<p>It's that easy!</p>
<img src="http://blog.anthonywong.net/?ak_action=api_record_view&id=154&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.anthonywong.net/2008/01/24/using-kai-font-for-mactex-on-os-x/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

