This post covers applying “funky effects” to whole Arabic words – extending the work noted in my previous posts. It was was quite tricky to join a sequence of letters to form whole Arabic words as a single outline path, but I finally got there. This does not yet include positioning vowels according to OpenType mark-to-base rules in the font… that’s next on the list. Code is written in C++ with various classes defined to perform specific tasks (such as write PDF files).
Category Archives: Typesetting and algorithms
Funky effects with Arabic glyphs!
Over the last few evenings I’ve been exploring Bézier curves and effects that can be achieved through “flattening” glyph paths. I found a great C++ library called Clipper which lets you perform a number of interesting operations on polygons. After you flatten a glyph path you can pass it to Clipper to do all sorts of “funky” things, such as offsetting the Laam-Alef glyph path in the example shown below. The PDF file was generated by the HARU PDF library (written in C) and glyph outlines were obtained using FreeType (also written in C). Well, it’s more interesting than watching the rubbish on TV!
Quick update: Another example with multiple paths in the glyph.
Typesetting Arabic clocks with LuaTeX
Just a short post to share an example of producing clock faces with Arabic numbers using LuaTeX’s nodes and glue. No drawing packages were used, all done with pdf_literal nodes and some basic trigonometry to calculate positions of the numbers, angles for clock hands and values of glue to move things around. I will try to write-up the code/techniques in a future post.
More progress with HarfBuzz/LuaTeX (update)
Just a short post to share another example from my on-going work on HarfBuzz/LuaTeX. A rather pointless example – without using any code to correctly place mark glyphs (e.g., vowels) – showing randomly coloured Arabic glyphs. Thanks to the power of HarfBuzz and the superb Lua C API (especially C closures and “for loop” iterators) the code to process the Arabic text is about 25 lines of Lua script.
Source of text for typesetting example: BBC Arabic. I don’t know what the text says but Google Translate indicated it was neither controversial or offensive – I hope that is the case!
Update
Just to add an example with mark glyph positioning and random colours. Vowel positioning added about 10 lines of Lua script :-).
Early results of integrating HarfBuzz into LuaTeX
Building on the work of porting LuaTeX to build on Windows I decided to explore adding HarfBuzz to provide Arabic shaping. The excellent HarfBuzz API lends itself to some interesting solutions so here’s a quick post to show some early results.
Source of text for typesetting fully vowelled Arabic examples: http://en.wikipedia.org/wiki/Arabic_language#Studying_Arabic
Example of adjusting Arabic vowel positions
Follow-up example to the previous post
A slightly more intricate example, this time showing the “before and after” effect of vowel adjustments. Again, this was achieved with a HarfBuzz-based pre-processor.
TeX file generated using HarfBuzz
Again, TeX code shown on individual lines for greater clarity.
\XeTeXglyph609 \hbox to 0pt{\special{color push rgb 0 0 1}\XeTeXglyph911 \special{color pop}} \hbox to 0pt{\vbox{\nointerlineskip\moveright 6.53bp\hbox{\raise-2.71bp\hbox{\special{pdf: content q 0.25 w 0 0 m -0.37 14.60 3.69 4.38 re S Q}\XeTeXglyph911 }}}} \XeTeXglyph831 \hbox to 0pt{\special{color push rgb 0 0 1}\XeTeXglyph907 \special{color pop}} \hbox to 0pt{\vbox{\nointerlineskip\moveright 3.56bp\hbox{\raise-4.82bp\hbox{\special{pdf: content q 0.25 w 0 0 m -0.72 14.60 4.73 3.31 re S Q}\XeTeXglyph907 }}}} \XeTeXglyph263 \XeTeXglyph3 \XeTeXglyph436 \hbox to 0pt{\special{color push rgb 0 0 1}\XeTeXglyph907 \special{color pop}} \hbox to 0pt{\vbox{\nointerlineskip\moveright 1.82bp\hbox{\raise-3.24bp\hbox{\special{pdf: content q 0.25 w 0 0 m -0.72 14.60 4.73 3.31 re S Q}\XeTeXglyph907 }}}} \XeTeXglyph489 \hbox to 0pt{\special{color push rgb 0 0 1}\XeTeXglyph911 \special{color pop}} \hbox to 0pt{\vbox{\nointerlineskip\moveright 3.47bp\hbox{\raise-4.35bp\hbox{\special{pdf: content q 0.25 w 0 0 m -0.37 14.60 3.69 4.38 re S Q}\XeTeXglyph911 }}}} \XeTeXglyph755 \hbox to 0pt{\special{color push rgb 0 0 1}\XeTeXglyph907 \special{color pop}} \hbox to 0pt{\vbox{\nointerlineskip\moveright 2.20bp\hbox{\raise-2.64bp\hbox{\special{pdf: content q 0.25 w 0 0 m -0.72 14.60 4.73 3.31 re S Q}\XeTeXglyph907 }}}} \XeTeXglyph896