FarsiTEX
and the Iranian TEX Community
Behdad Esfahbod
farsitex@behdad.org
Roozbeh Pournader
roozbeh@sharif.edu
The 23rd Conference and Annual Meetingof the TEX Users group,Trivandrum, Kerala, India
September 4, 2002

What is Persian?

Contemporary Persian

Dari

Farsi

TajikiAfghanistan

IranTajikistan

1

The Modern Persian Script• Based on the Arabic Script• Extra letters: Peh (p), Tcheh (c), Jeh (j), and Gaf (g)• Modified letters:– Kaf (K) → Keheh (k)– Yeh (x) → Farsi Yeh (y)2The History of the Script• The switch from Pahlavi to Arabic happened in the 7thcentury CE• The adaption propagated to Pakistan, Afghanistan, India,
China, Malaysia, and Java where the alphabet was extended
even more: 29 basic Arabic letters → 139 letters in modern
use (from Kurdish to Jawi)

3

The Persian Typography• Based on calligraphic practices– Originally Naskh (as opposed to Kufi), the Meccan styleof writing Arabic– Nastaliq was invented in 15th century CE and thecalligraphy switched• With lead typography it switched back to Naskh• With late 1990s proprietary digital typography tools,
Nastaliq become public again, but the popularity dropped
because of unreadablity
4

Persian Scientific Typography• Blossoming in 1950s by Mosahab works (who also inventedIranic)• Manual typesetting using “match stick methods”• LinoType machines in 1970s, modern publishers raised,resulting in a leap in math books

5

Localized TEXs

• TEX-e-Parsi and LATEX-e-Farsi appearing in 1992

• TEX-e-Parsi, won the competition because of better quality

6

TEX-e-Parsi• Developed by high investment from the vendor and a few
major scientific publishers, going TEXtreme• The vendor went bankrupt in 1997
• Latest version in 1996, with pre-3.0 TEX and LATEX 2.09 +NFSS• A few math departments and the two original publishers
who sponsored it still use it• The price was very high7

Zarnegar, the alternative• Appearing in early 1995
• Original design, using a visual markup language• Splendid fonts, and the vendor’s knowledge of the market• Still in wide use: may be the second popular software afterMS Word
• Main Problems: Unbearable math typesetting, and a
proprietary and closed file format
8

FarsiTEX• Started as an academic project by Mohammad Ghodsi in1991, called FaTEX in the first year
• Three BSc projects provided the foundation in 1992 and1993• Two master theses in 1994, shaped the current macros,and the Scientific Farsi (sf) family of fonts• Some Arabic script specific works, like contextual shapingof letters, was done in a pre-processor
9The Old Releases• A new team was gathered in 1996
• The team created a new syntax and character set• Wrote some converters, and an MS-DOS editor• The engine was based on emTEX, and LATEX 2.09
• Released FarsiTEX for MS-DOS under GNU GPL• The last release of this era is dated October 1998
10

The New Releases• After a meeting in 2000, the team become semi-activeagain• A MS Windows editor was almost ready• Packaged engine based on MiKTEX• Released the MS Windows version

11

Other Released Stuff• Localized version of MakeIndex• FarsiTEX to HTML converter tool, written from scratch• . . . which are just some prototypes

12

Never Released Material• Azin fonts, as an alternative to the original Scientific Farsi
font family• The LATEX 2ε macros• teTEX based engine (Linux & friends finally)• FarsiTEX2HTML, based on LATEX2HTML13

Never Released Material (continued)• PostScript Type 1 Scientific Farsi fonts• Popular public domain Persian fonts, converted to both
METAFONT and PS Type 1• FarsiTEX2Unicode character set converter

14Linux Editor?

• Not yet. Many people promised to write one, but possibly
forgot it!

• The current MS Windows editor runs using WINE

• There’s a Persian LyX• What about transliteration-based input?

15Problems with the Current Version
The current version, being based on LATEX 2.09, has many
problems, a barrier to further development:• LATEX 2.09 is not supported anymore• Lack of NFSS support, which makes using other Persian
fonts too hard

• The design is dirty, and overrides many LATEX internals, sothat hardly any LATEX package would work with FarsiTEX,
unless some tailoring is done
16TEXnical Details• Having it’s own character set, FarsiTEX needs it’s own
special editor• Some converters are needed to pre-process the input• And finally, the macros (and the TEX--XET engine) takecare of bidirectional rendering

17

Arabic Script Rendering

Input text

Logical order

After Bidirectional Algorithm

Visual order

After Arabic Joining Algorithm

Glyph list

After Ligation

Glyph list

When Rendered

Outputslammals
mALu
mMu
mMu

With enough care, the above algorithms can be applied in somedifferent order.

18

Bidirectional Algorithm• Main issue to tackle• TEX--XET can render bidirectional text

• . . . but only when subtext directions are known explicitly!

• The editor or the pre-processor should specially mark thedirections for the TEX--XET engine

19

Bidirectional Algorithm (continued)• A very simplified bidirectional algorithm, but powerful• The editor converts between logical and visual orders• Two code points for some punctuation marks• Identify the direction (using the background color in theeditor)• Pre-processor marks different directions by inserting \InE,\EnE, \InF, and \EnF
20

Joining & Shaping Algorithms• Two adjacent letters may join to each other, or may not• . . . forming 1, 2, or 4 glyphs for each character (for examples, t, v, u)• The Joining Algorithm is for deciding if two adjacent letters
do join or not• The Shaping Algorithm is for selecting the proper glyph,based on the results of the Joining Algorithm• The pre-processor and the editor are responsible for them21Line Justification• It is common to stretch the joining line between letters• No inter-letter spacing, no hyphenation• The pre-processor inserts a stretchable Kashida character
between the connected letters• The active inserted character, then, expands to a horizontal
glue filled by horizontal rules
22FarsiTEX Forever• FarsiTEX is not released as a part of any TEX distribution
yet, mainly because the team members still think that it’s
not stable• The team is going to cleanup and release the current code
base, with PostScript Type 1 fonts, based on MiKTEX andteTEX, for both MS Windows and Linux platforms?

23

FarsiTEX Forever (continued)• The system should be redesigned, restructured, andrewritten, which needs breaking backwards compatibility,that is the reason it is not happened yet• And “The Ultimate Solution”, is moving to Unicode andusing Omega

24

Iranian TEX Community• There is no real community• There are people using (Farsi)TEX daily and professionally• Some are active in mailing lists too• But it is far from an active community: nobody contributes(has ever contributed) patches!

25

The Team(The new FarsiTEX team in 1999)

http://www.farsitex.org/Questions?
26