anotherTypesetter/legacies/site/index.html
2024-03-29 20:47:58 +08:00

172 lines
8.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="None">
<link rel="canonical" href="https://blog.kianting.info/pages/docs/anotherTypeSetter/">
<link rel="shortcut icon" href="img/favicon.ico">
<title>Another Typesetter 另一個排版器</title>
<link rel="stylesheet" href="css/theme.css" />
<link rel="stylesheet" href="css/theme_extra.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" />
<script>
// Current page data
var mkdocs_page_name = "Home";
var mkdocs_page_input_path = "index.md";
var mkdocs_page_url = "/pages/docs/anotherTypeSetter/";
</script>
<script src="js/jquery-2.1.1.min.js" defer></script>
<script src="js/modernizr-2.8.3.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="." class="icon icon-home"> Another Typesetter 另一個排版器</a>
<div role="search">
<form id ="rtd-search-form" class="wy-form" action="./search.html" method="get">
<input type="text" name="q" placeholder="Search docs" title="Type search term here" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal current" href=".">Home</a>
<ul class="current">
<li class="toctree-l2"><a class="reference internal" href="#_1">摘要</a>
<ul>
<li class="toctree-l3"><a class="reference internal" href="#_2">序言</a>
</li>
<li class="toctree-l3"><a class="reference internal" href="#_3">先備知識</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="defineASTandGrammar/">Ch 1</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="" href="2DManipulating.md">Ch 2</a>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href=".">Another Typesetter 另一個排版器</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href=".">Docs</a> &raquo;</li>
<li>Home</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section">
<h1 id="another-typesetter-">Another Typesetter - 另一個排版器</h1>
<h2 id="_1">摘要</h2>
<p>本文是講一個排版器的雛形如何製作的考察使用Rust語言。</p>
<h3 id="_2">序言</h3>
<p>以前從國中時候試用Linux以及架站以後就開始想用LaTeX排版些自己所寫的東西其中包含覺得LaTeX的語法不好想要重造輪子。就算後來大學沒有走上資訊工程這條路還是希望有天至少能夠完成個能用的雛形。</p>
<p>但是這是涉及字體檔案的處理、PDF的處理、語法分析後來自己因為不知道如何開發所以一直停擺。不是遇到很多蟲就是效能問題有缺失。因為時間繁忙很少更不消說了。甚至買了Knuth教授的 <em>Digital Typography</em>,想要瞭解斷行演算法,結果粗估五、六十頁,所以幾乎沒有讀。</p>
<p>另外筆者一個分支興趣是編譯器的相關知識所以開始讀和王垠的編譯器思想系出同門的Jeremy G. Siek所著作之 <em>Essential of Complication: An Incremental Approach in Racket</em>編譯之要素Racket語言的遞增的方法。我想到既然編譯器這種複雜的軟體可以一層一層的用pass來遞增功能就像水彩從背景、大物體一直由少漸多的完成。而排版軟體也是把使用者輸入的排版之領域特定語言(DSL)轉換成文字、圖形和二維座標對應關係最後匯出成PDF或SVG等等的編譯器若是能夠用層層遞增的方法來完成相信也能夠避免結構的複雜化導致錯誤容易發生的挫折。</p>
<p>然而排版語言不只是輸入文字轉圖形而已,更重要的是還要有因應美觀的自動斷行(justification)和斷字(hyphenation)等等的演算法、還有PDF的基本知識、字型函式庫的取用、排版要求多欄、甚至還牽涉到語言特有的特性比如東亞全形文字漢字、諺文、日文假名、注音符號和非全形文字中間要加空白以及從左寫到右的文字希伯來字母和阿拉伯字母等的排版方法不一而足。</p>
<p>為了簡化起見且目標讀者是臺灣的受眾本書僅涉及到ASCII英文字母——頂多加些一些附加符號(diacritics)和漢字的排版。其他的功能希望讀者可以漸次由少漸多的附加。另外這邊會使用到一些LISP的表達式來表達抽象語法樹若是不懂的話可以看一點教 Lisp或是Scheme的書如SICP。另外這本書不是編譯原理和描述PDF規格的書不涉獵底層的知識有需要的可以參考相關領域的書。</p>
<h3 id="_3">先備知識</h3>
<p>這不是教一位入門使用者如從零知識撰寫排版軟體的書讀者應該有知道如何使用靜態型別語言的經驗比如一點C、或是Rust等等。另外抽象語法樹為求方便使用LISP撰寫所以需要會LISP和Scheme的知識知名教科書SICP的開頭可以讀一讀</p>
<p>這本書也不教編譯理論和tokenizing、parsing、狀態機等等的頂多只會帶到一些很基礎的知識有需要的請另外再讀。所以使用者需要會有使用正規表達式(regex)的能力。</p>
<p>操作環境使用Linux。需要安裝fontconfig等套件。</p>
<ul>
<li><a href="./defineASTandGrammar">定義抽象語法樹和語法</a></li>
</ul>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="defineASTandGrammar/" class="btn btn-neutral float-right" title="Ch 1">Next <span class="icon icon-circle-arrow-right"></span></a>
</div>
<hr/>
<div role="contentinfo">
<!-- Copyright etc -->
</div>
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span style="margin-left: 15px"><a href="defineASTandGrammar/" style="color: #fcfcfc">Next &raquo;</a></span>
</span>
</div>
<script>var base_url = '.';</script>
<script src="js/theme.js" defer></script>
<script src="search/main.js" defer></script>
<script defer>
window.onload = function () {
SphinxRtdTheme.Navigation.enable(true);
};
</script>
</body>
</html>
<!--
MkDocs version : 1.1.2
Build Date UTC : 2023-12-01 16:29:33.709363+00:00
-->