{"id":2096,"date":"2012-01-25T11:28:00","date_gmt":"2012-01-25T11:28:00","guid":{"rendered":"http:\/\/www.readytext.co.uk\/?p=2096"},"modified":"2013-11-28T09:05:16","modified_gmt":"2013-11-28T09:05:16","slug":"typesetting-arabic-with-luatex-via-a-c-plug-in-part-1","status":"publish","type":"post","link":"https:\/\/www.readytext.co.uk\/?p=2096","title":{"rendered":"Typesetting Arabic with LuaTeX [via a C plug-in] (Part 1)"},"content":{"rendered":"<h1>Introduction<\/h1>\n<p>In this new series of posts I&#8217;m going to attempt an overview of the topics, concepts, ideas and technologies involved in typesetting  Arabic with LuaTeX, via a DLL I&#8217;m writing in C. Actually, the C code is very substantially platform-independent so it should compile on non-Windows machines&#8230; one day, when it&#8217;s &#8220;finished&#8221;&#8230; <\/p>\n<p>Up until 2 years ago I was teaching myself Arabic (see my <a href=\"http:\/\/www.amazon.co.uk\/gp\/pdp\/profile\/A7LGROLGHXCLU\/ref=cm_cr_rdp_pdp\">Amazon book reviews<\/a>) and had reached the point where I wanted to write-up my notes and worked exercises: I needed to typeset Arabic and wanted to use a TeX-based solution. Having looked around I stumbled upon some truly amazing <a href=\"http:\/\/river-valley.tv\/?s=idris+hamid\">video presentations<\/a> of Arabic typesetting work being undertaken by Idris Hamid and Hans Hagen, using a tool called LuaTeX: something I&#8217;d never heard of. I was truly <em>stunned<\/em> by what I saw, the quality of their Arabic typesetting was (is) incredible, so I had to find out more. A few hours later I&#8217;d worked out that the typesetting was being achieved through Hans Hagen&#8217;s ConTeXt package, with LuaTeX as the underlying TeX engine. However, I&#8217;m personally not a user of ConTeXt, but the LuaTeX engine was just so interesting that I had to explore it. Well, two years later and I&#8217;ve not done any further learning of Arabic, having replaced that activity with plenty of explorations into LuaTeX and a host of other technologies, particularly OpenType and Unicode. <\/p>\n<p>Coming up to the present day, I&#8217;ve finally reached the point where I have puzzled out enough detail of the &#8220;big picture&#8221; to attempt a home-grown Arabic typesetting solution for LuaTeX, but one where most of the &#8220;heavy lifting&#8221; is done in C, with Lua code to interface with and talk to LuaTeX. For sure, there are ready-made options such as XeTeX or the range of Arabic typesetting solutions created by the TeX community. However, my interest is creating a solution that will just as easily output SVG or other non-PDF formats, plus allow the automated production of new and novel &#8220;typeset structures&#8221; and diagrams that will really help with learning Arabic: things I wish had been present in the many books I have bought and studied but which may just be too time-consuming, or difficult\/expensive, to produce by &#8220;conventional&#8221; applications. These are big goals, but definitely achievable, albeit over a year or two of further work. <\/p>\n<h2>Sample<\/h2>\n<p>Just by way of an early example, see the following PDF, as usual, through the Google Docs viewer or <a href=\"http:\/\/readytext.co.uk\/files\/plainarabic.pdf\">download PDF here<\/a>. The trained eye will certainly spot a few issues that need fixing but so far it&#8217;s not looking too bad :-). But there is a long, long way to go yet. The font used is Microsoft&#8217;s &#8220;Arabic Typesetting&#8221; because it is contains a substantial number of OpenType features including cursive positioning, mark-to-base positioning, an enormous range of ligatures plus many other features which make it an ideal choice of font to work with (in my opinion). In the example (the made-up words) you can see the non-horizontal baseline achieved with cursive positioning plus the ability to control vowel placement with great flexibility. <\/p>\n<p>But it&#8217;s still far from perfect, I&#8217;ll readily admit. I hope I can finish this work, and find the time to complete these articles. I&#8217;ll certainly try!<\/p>\n<p><iframe src=\"https:\/\/docs.google.com\/gview?url=http:\/\/readytext.co.uk\/files\/plainarabic.pdf&#038;embedded=true\" style=\"width:100%; height:400px;\" frameborder=\"0\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In this new series of posts I&#8217;m going to attempt an overview of the topics, concepts, ideas and technologies involved in typesetting Arabic with LuaTeX, via a DLL I&#8217;m writing in C. Actually, the C code is very substantially platform-independent so it should compile on non-Windows machines&#8230; one day, when it&#8217;s &#8220;finished&#8221;&#8230; Up until [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,9,3,17],"tags":[],"class_list":["post-2096","post","type-post","status-publish","format-standard","hentry","category-arabic","category-luatex-c-code-windows-dlls","category-luatex","category-unicode-arabic"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2096","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2096"}],"version-history":[{"count":12,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2096\/revisions"}],"predecessor-version":[{"id":3295,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2096\/revisions\/3295"}],"wp:attachment":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2096"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}