<?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>jjgod / blog &#187; classics</title>
	<atom:link href="http://blog.jjgod.org/tag/classics/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jjgod.org</link>
	<description>Random notes &#38; thoughts by Jiang Jiang.</description>
	<lastBuildDate>Mon, 16 Jan 2012 11:08:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A closer look at Classics.app</title>
		<link>http://blog.jjgod.org/2008/11/30/a-closer-look-at-classicsapp/</link>
		<comments>http://blog.jjgod.org/2008/11/30/a-closer-look-at-classicsapp/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 04:36:01 +0000</pubDate>
		<dc:creator>jjgod</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Miscs]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[classics]]></category>
		<category><![CDATA[ebook]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[reader]]></category>

		<guid isPermaLink="false">http://blog.jjgod.org/?p=271</guid>
		<description><![CDATA[“Classics” is a great product, it shows us iPhone developers what an elegant ebook reader can be, so I bought it almost instantly after it&#8217;s released. I&#8217;ve been chatting with my friends about this app for a while, now I&#8217;d like to give a more closer examination to it from the perspective of a typographer [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://omploader.org/vejRk/classics-1.png" alt="A Screenshot of Classics" class="left"  /></p>

<p>“<a href="http://www.classicsapp.com/">Classics</a>” is a great product, it shows us iPhone developers what an <em>elegant</em> ebook reader can be, so I bought it almost instantly after it&#8217;s released. I&#8217;ve been chatting with my friends about this app for a while, now I&#8217;d like to give a more closer examination to it from the perspective of a typographer and a programmer. Especially its weaknesses.</p>

<p>Illustrated by my favorite graphic designer, <a href="http://dlanham.com">David Lanham</a>, Classics tries its best to provide a traditional book reading experience (that&#8217;s why it&#8217;s called &#8220;Classics&#8221;). It contains the following books, even I&#8217;ve read most of them in Chinese long time ago, thanks to Classics, it&#8217;s still a fascinating experience to read them again in English:</p>

<ul>
<li><em><a href="http://en.wikipedia.org/wiki/Twenty_Thousand_Leagues_Under_the_Sea">20,000 Leagues Under the Sea</a></em> by <a href="http://en.wikipedia.org/wiki/Jules_Verne">Jules Verne</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/A_Christmas_Carol">A Christmas Carol</a></em> by <a href="http://en.wikipedia.org/wiki/Charles_Dickens">Charles Dickens</a> [Added in version 1.1]</li>
<li><em><a href="http://en.wikipedia.org/wiki/Alice_in_Wonderland">Alice in Wonderland</a></em> by <a href="http://en.wikipedia.org/wiki/Lewis_Carroll">Lewis Carroll</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/Flatland">Flatland</a></em> by <a href="http://en.wikipedia.org/wiki/Edwin_Abbott_Abbott">Edwin Abbott Abbott</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/Gulliver%27s_Travels">Gulliver&#8217;s Travels</a></em> by <a href="http://en.wikipedia.org/wiki/Jonathan_Swift">Jonathan Swift</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/Hound_of_the_Baskervilles">The Hound of the Baskervilles</a></em> by Sir <a href="http://en.wikipedia.org/wiki/Arthur_Conan_Doyle">Arthur Conan Doyle</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/Adventures_of_Huckleberry_Finn">Adventures of Huckleberry Finn</a></em> by <a href="http://en.wikipedia.org/wiki/Mark_Twain">Mark Twain</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/Paradise_Lost">Paradise Lost</a></em> by <a href="http://en.wikipedia.org/wiki/John_Milton">John Milton</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/Robinson_Crusoe">Robinson Crusoe</a></em> by <a href="http://en.wikipedia.org/wiki/Daniel_Defoe">Daniel Defoe</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/The_Call_Of_The_Wild">The Call of the Wild</a></em> by <a href="http://en.wikipedia.org/wiki/Jack_London">Jack London</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/The_Jungle_Book">The Jungle Book</a></em> by <a href="http://en.wikipedia.org/wiki/Rudyard_Kipling">Rudyard Kipling</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/The_Metamorphosis">The Metamorphosis</a></em> by <a href="http://en.wikipedia.org/wiki/Franz_Kafka">Franz Kafka</a></li>
<li><em><a href="http://en.wikipedia.org/wiki/The_Time_Machine">The Time Machine</a></em> by <a href="http://en.wikipedia.org/wiki/H._G._Wells">H. G. Wells</a></li>
</ul>

<p>However, there are still some details to be improved.
<span id="more-271"></span></p>

<p><img src="http://omploader.org/vejRl/classics-2.png" alt="Classics's mistakes on word spacing and hyphenation" class="right"  /></p>

<p>First of all, Classics shows the entire interface in a portrait way, it&#8217;s more like traditional books, but has an unavoidable drawback: the iPhone/iPod Touch screen is not wide enough, if you make the characters large enough (otherwise people won&#8217;t be able to read them clearly), breaking paragraphs into lines will be extraordinarily hard, you either have to introduce a lot of hyphens, or make the word spacing too loose or too tight. From the following screenshot, we can see Classics made both mistakes.</p>

<p>The spots I marked made the reading experience much worse, if you&#8217;re a picky reader like me. And it happens on <em>almost every</em> pages! So why, why couldn&#8217;t Classics support landscape mode to improve the situation a little bit?</p>

<p>To understand this, we must first find out how Classics is implemented. Let&#8217;s take a look (yeah I know I shouldn&#8217;t do such reverse-engineering, but I just can&#8217;t help). First, copy it from where it&#8217;s saved, expand it as a zip archive:</p>

<pre><code>$ cp ~/Music/iTunes/Mobile\ Applications/Classics\ 1.1.ipa classics.zip
$ unzip classics.zip
    Archive:  classics.zip
   creating: Payload/
   creating: Payload/Classics.app/
   creating: Payload/Classics.app/20,000 Leagues.classic/
  inflating: Payload/Classics.app/20,000 Leagues.classic/0.pdf  
  inflating: Payload/Classics.app/20,000 Leagues.classic/1.pdf  
 ...
  inflating: iTunesMetadata.plist    
  inflating: Payload/Classics.app/SC_Info/Classics.sinf  
  inflating: iTunesArtwork           
finishing deferred symbolic links:
  Payload/Classics.app/CodeResources -&gt; _CodeSignature/CodeResources
</code></pre>

<p>OK, now it&#8217;s clearer, let&#8217;s open up Finder so that you can see it in a more structured way:</p>

<p><img src="http://omploader.org/vejRq/classics-3.png" alt="Internal structure of Classics" /></p>

<p>See? It turns out every book Classics loads and displays:</p>

<ol>
<li>Is a .classic ended directory with PDFs for each chapter,</li>
<li>Contains a <code>Info.plist</code> describes it,</li>
<li>Has a cover image called <code>Art.png</code>.</li>
</ol>

<p>Let&#8217;s first look at one of these plists,</p>

<pre><code>$ cd Payload/Classics.app/A\ Christmas\ Carol.classic
$ plutil -convert xml1 Info.plist -o -
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;author&lt;/key&gt;
    &lt;string&gt;Charles Dickens&lt;/string&gt;
    &lt;key&gt;language&lt;/key&gt;
    &lt;string&gt;English&lt;/string&gt;
    &lt;key&gt;sections&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;Preface&lt;/string&gt;
        &lt;string&gt;Marley’s Ghost&lt;/string&gt;
        &lt;string&gt;The First of the Three Spirits&lt;/string&gt;
        &lt;string&gt;The Second of the Three Spirits&lt;/string&gt;
        &lt;string&gt;The Last of the Spirits&lt;/string&gt;
        &lt;string&gt;The End of It&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;title&lt;/key&gt;
    &lt;string&gt;A Christmas Carol&lt;/string&gt;
    &lt;key&gt;year&lt;/key&gt;
    &lt;string&gt;1843&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code></pre>

<p>So the file contains sufficient metadata for Classics to load this book, but it seems quite &#8220;preliminary&#8221;, thus, not flexible enough IMHO. For instance, PDF files must be named from 0 to n, each corresponds to a chapter (0 &rarr; Preface, 1 &rarr; Marley’s Ghost, etc.)</p>

<p><img src="http://omploader.org/vejR4/classics-4.png" alt="A Chapter from Alice in Wonderland" class="left" /></p>

<p>And then, how are these PDFs look? Here is a screenshot taken from Quick Look. <a href="http://linuxcommand.org/man_pages/pdffonts1.html">pdffonts</a> and <a href="http://linuxcommand.org/man_pages/pdfinfo1.html">pdfinfo</a> from <a href="http://www.foolabs.com/xpdf">xpdf</a> can give us more information:</p>

<pre><code>$ pdfinfo 0.pdf 
Title:          untitled4
Author:         Phillip Ryu
Creator:        Pages
Producer:       Mac OS X 10.5.4 Quartz PDFContext
CreationDate:   Fri Nov 14 00:12:37 2008
ModDate:        Fri Nov 14 00:12:37 2008
Tagged:         no
Pages:          2
Encrypted:      no
Page size:      216 x 316.8 pts
File size:      27175 bytes
Optimized:      no
PDF version:    1.3
</code></pre>

<p>So it&#8217;s typesetted manually by <a href="http://phillryu.com/">Phillip Ryu</a> with <a href="http://www.apple.com/iwork/pages/">Pages</a>, doesn&#8217;t sound very high-tech, huh?</p>

<pre><code>$ pdffonts 0.pdf 
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
VLFBFB+Georgia                       TrueType          yes yes no      10  0
LMPSPR+Georgia-Bold                  TrueType          yes yes no       9  0
BXMTAW+Georgia-Italic                TrueType          yes yes no      19  0
</code></pre>

<p>Yeah, the only font family used is <a href="http://en.wikipedia.org/wiki/Georgia_(typeface)">Georgia</a>. To admit, I was actually hoping some fonts more suitable for book typesetting, say, <a href="http://en.wikipedia.org/wiki/Garamond">Garamond</a> or <a href="http://en.wikipedia.org/wiki/Sabon">Sabon</a>.</p>

<p>Enough said, now we have a better understanding of the internal architecture of Classics. As we can see, using PDF for all the books is the chief decision that affects the rest of the app. There are pros and cons for this decision.</p>

<p>Pros:</p>

<ol>
<li>No need to calculate the layout when the user is reading, thus loading a new page will be generally faster than a book reader that loading text and doing layout dynamically.</li>
<li>With PDF, one can embeded arbitrary fonts as wish, bypassing iPhone&#8217;s limitation. (Classics does not make use of this advantage, sadly.)</li>
</ol>

<p>Cons:</p>

<ol>
<li>The layout is fixed, no way to adapt it to a screen in landscape mode.</li>
<li>Loading PDF through iPhone still has noticeable sluggish, thus, you can&#8217;t tap a chapter and have it shown instantly. The worse thing is, there is no way for the developer to optimize it, as long as they still use Apple&#8217;s frameworks for PDF rendering.</li>
</ol>

<p>Except for this, is there anything else can be improved? Yes,</p>

<ul>
<li><p>After compressed, Classics is a 22M beast. Downloading it in bad bandwidth condition can be a problem, not to mention every once it&#8217;s updated, you have to download 22M (or even more) again, while most of them you downloaded are just duplicated resource files you already had!</p>

<p>Even though we can see it greatly simplified application deployment, this part can certainly be improved. For instance, instead of bundle these books with the app, setup a site for it to retrieve books dynamically, books can be downloaded the first time user tries to read, and cached in his Documents directory.</p></li>
<li><p>Pages is definitely not a serious typesetting tool. If I were Phillip<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>, I&#8217;ll try to build an automatic conversion infrastructure with <a href="http://www.tug.org/xetex">XeTeX</a>, it will be much easier to maintain, and gives noticeably better text layout results, especially on line breaking, I suspect.</p></li>
</ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>However, if I&#8217;m really going to implement such a book reader, PDF won&#8217;t be the best option for me though.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.jjgod.org/2008/11/30/a-closer-look-at-classicsapp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

