STM publishing: tools, technologies and change A WordPress site for STM Publishing

1Jun/14Off

Funky effects with Arabic words

Posted by Graham Douglas

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).

Download PDF

29May/14Off

Funky effects with Arabic glyphs!

Posted by Graham Douglas

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!

Download PDF

Quick update: Another example with multiple paths in the glyph.

Download PDF

15May/14Off

Typesetting Arabic clocks with LuaTeX

Posted by Graham Douglas

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.

Download PDF

12Nov/13Off

More progress with HarfBuzz/LuaTeX (update)

Posted by Graham Douglas

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!

Download PDF

Update

Just to add an example with mark glyph positioning and random colours. Vowel positioning added about 10 lines of Lua script :-) .

Download PDF

24Sep/13Off

Early results of integrating HarfBuzz into LuaTeX

Posted by Graham Douglas

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

Download PDF

15Aug/13Off

Example of adjusting Arabic vowel positions

Posted by Graham Douglas

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 

Download PDF