Aleph Guide

From Wiki
Revision as of 10:18, 17 July 2006 by 58.145.50.53 (talk)
Jump to navigation Jump to search

Aleph in ConTeXt: A Guide to the Perplexed

(with apologies to Maimonides)

by Prof. Idris Samawi Hamid

< Aleph | Arabian and Hebrew >

Introduction

Aleph is a typesetting engine derived from Omega and eTeX. Reasons for Aleph:

  1. ConTeXt depends on the eTeX extensions, and even LaTeX now defaults to pdfeTeX.
  2. Omega provides a nice foundation for multilingual typesetting with large (>256) character sets, including large virtual fonts, but a stable, dependable version has not been a priority with its developers.
    1. In particular, the RL-LR code works excellently for the most part (minor bugs, easy to work around).
    2. Omega 1.15 was the last relatively stable bugfix version, as far as usability is concerned.
  3. Some users need a dependable LR-RL TeX engine now.

Aleph weds Omega 1.15 and eTeX 201, removes some extraneous stuff, and fixes a few bugs. I use it for production purposes. It uses dvipdfmx for pdf production, and can take advantage of most of ConTeXt's capabilities. Giuseppe Bilotta has done virtually all of the development work.

In addition to large character sets, Aleph inherits the filter sequence mechanism for script processing (extension ocp, compile from text-editable otp). So you can script whatever input encoding you like to whatever output font encoding you like. It is mechanism powerful enough to do contextual analysis of Arabic script for example, but not powerful enough for things like vertical glyph positioning for cursive scripts and the like.

Aleph, inheriting from Omega, provides many ready-to-go filters, using a Times Roman like font for Latin, Greek, and Cyrillic scripts. The ConTeXt module for this setup is called Gamma (m-gamma.tex); this is a port of the Lambda (i.e., LaTeX) style files to ConTeXt. The font typescript is called type-omg.

Installing

This install is based on the stand-alone ConTeXt for Win32 package.

Users of MiKTeX and other OS's will need to adjust the following instructions to their own setups.

  • Make sure you have a very recent version of ConTeXt that supports the engine path mechanism. This mechanism allows texexec to manage two, e.g., cont-en.fmt files at once, one in texmf/web2c/aleph and one in texmf/web2c/pdfetex

How recent, you ask? Just be safe and get the latest :-)

  • Some configuration points:
    • Make sure you have the following line in texexec.ini set to "true": "set UseEnginePath to true"
    • In texmf-local\web2c\texmf.cnf, texmf-local\web2c\context.cnf, and texmf\web2c\texmf.cnfcomment this line as follows
%extra_mem_bot.context    = 2000000

otherwise Aleph will crash under some conditions, like overfull boxes and the like... The XeTeX developer found the source to this bug, and a fix; hopefully Giuseppe will get to it :-))

  • Get rid of two directories from omega.zip (not really necessary but if you want to be efficient): texmf/eomega and texmf/omega/encodings
  • Put support files in texmf-local.
  • Compile the Aleph format:
 mktexlsr
 
 texexec --make en -tex=aleph
  • Here is a test file. Note the preamble
% tex=aleph output=dvipdfmx

at the beginning of every Aleph file.

omarb.tex

% tex=aleph output=dvipdfmx
\usemodule[gamma]  % or \input m-gamma.tex
\input type-omg.tex

\setupbodyfont[omlgc,12pt]

\starttext

\startlatin

This is a test

\bf This is a test

\stoplatin

\startgreek

A B G D a b g d

{\bf A B G D a b g d}

\stopgreek

\startarab

`rby:

A b t th j H kh

{\bf \ A b t th j H kh}

fArsy:

A b p t th j ch H kh

{\bf A b p t th j ch H kh}

\starturdu

ArdU:

A b p t 't th j ch H kh

{\bf A b p t 't th j ch H kh}

\stopurdu

\blank

\tfc

`rby:

bsm ALLah Al-rrHmn Al-rrHym

fArsy:

bh nAm khdAwnd b-kh-sh-nde mhrbAn

\starturdu

\tfc

ArdU:

ALLah kE nAm sE jw rHmAn w rHym hE

\stopurdu

\stoparab

\stoptext
  • For Arabic script you will probably want to use an encoding that supports direct Arabic-script editing. There are three: utf-8, iso-8859-6 (Apple/Unix), and cp1256 (Microsoft). We can define the following, using ConTeXt macros for managing filter sequences. Maybe I will add these to m-gamma and ask Hans to distribute. In the meantime, here are some definitions, samples of all three encodings, and an example of mixed lr-rl text:

TODO: the Unicode characters got mixed up in the mail, please fix it, Idris! (See: To-Do List)


m-arabic-enc.tex

% tex=aleph output=dvipdfmx
%\usemodule[gamma] \input m-gamma.tex
%\input type-omg.tex
\usetypescriptfile[type-omg]
\usetypescript[OmegaArab]

\hoffset=0pt

%% Individual Filters

% Input filters (from what you type)

\definefiltersynonym [UTF8]      [inutf8]
\definefiltersynonym [ISO8859-6] [in88596]
\definefiltersynonym [CP1256]    [incp1256]

% Contextual filter

\definefiltersynonym [UniCUni]            [uni2cuni]

% Output filters (font mapping)

\definefiltersynonym [CUniArab]           [cuni2oar]

%% Filter Sequences

\definefiltersequence
  [UTFArabic]
  [UTF8,UniCUni,CUniArab]

\definefiltersequence
  [ISOArabic]
  [ISO8859-6,UniCUni,CUniArab]

\definefiltersequence
  [WINArabic]
  [CP1256,UniCUni,CUniArab]

% For inner paragraph control within an LR paragraph

\definestartstop
  [arabictextutf]
  [commands=%
    {\textdir TRT%
    \switchtobodyfont[omarb]%
    \usefiltersequence[UTFArabic]}]

\definestartstop
  [arabictextiso]
  [commands=%
    {\textdir TRT%
    \switchtobodyfont[omarb]%
    \usefiltersequence[ISOArabic]}]

\definestartstop
  [arabictextwin]
  [commands=%
    {\textdir TRT%
    \switchtobodyfont[omarb]%
    \usefiltersequence[WINArabic]}]

\def\ArabicTextUTF#1{\startarabictextutf#1\stoparabictextutf}

\def\ArabicTextISO#1{\startarabictextiso#1\stoparabictextiso}

\def\ArabicTextWIN#1{\startarabictextwin#1\stoparabictextwin}

% For global Arabic script

\def\ArabicDirGlobal{%
\pagedir TRT\bodydir TRT\textdir TRT\pardir TRT %
\hoffset=-8.88cm} % compensate for a bug in \bodydir TRT

\def\ArabicUTF{\ArabicDirGlobal\usefiltersequence[UTFArabic]
                \switchtobodyfont[omarb]}

\def\ArabicISO{\ArabicDirGlobal\usefiltersequence[ISOArabic]
                \switchtobodyfont[omarb]}

\def\ArabicWIN{\ArabicDirGlobal\usefiltersequence[WINArabic]
                \switchtobodyfont[omarb]}

% For separate Arabic-script paragraphs

\def\ArabicDirPar{\textdir TRT\pardir TRT}

\definestartstop
  [arabutf]
  [commands=%
    {\usefiltersequence[UTFArabic]
     \switchtobodyfont[omarb]%
     \ArabicDirPar}]

\definestartstop
  [arabiso]
  [commands=%
    {\usefiltersequence[ISOArabic]
     \switchtobodyfont[omarb]%
     \ArabicDirPar}]

\definestartstop
  [arabwin]
  [commands=%
    {\usefiltersequence[WINArabic]
     \switchtobodyfont[omarb]%
     \ArabicDirPar}]

\showframe[text]

\starttext

\startarabutf

اللَّهُمَّ صَلِّ عَلَى مُحَمَّدٍ وَ
آلِ مُحَمَّدٍ وَ ارْزُقْنِي
الْيَقِينَ وَ حُسْنَ الظَّنِّ بِكَ
وَ أَثْبِتْ رَجَاءَكَ فِي قَلْبِي
وَ اقْطَعْ رَجَائِي عَمَّنْ سِوَاكَ
حَتَّى لَا أَرْجُوَ غَيْرَكَ وَ لَا
أَثِقَ إِلَّا بِك‏

\stoparabutf

\blank

\startarabiso

Çääñîçïåñî Õîäñð Ùîäîé åïÍîåñîÏí èî Âäð åïÍîåñîÏí èî ÇÑòÒïâòæðê
Çäòêîâðêæî èî ÍïÓòæî ÇäØñîæñð Èðãî èî ÃîËòÈðÊò ÑîÌîÇÁîãî áðê
âîäòÈðê èî Çâò×îÙò ÑîÌîÇÆðê Ùîåñîæò ÓðèîÇãî ÍîÊñîé äîÇ ÃîÑòÌïèî
ÚîêòÑîãî èî äîÇ ÃîËðâî ÅðäñîÇ Èðã

\stoparabiso

\blank

\startarabwin

Çááøóåõãøó Õóáøö Úóáóì ãõÍóãøóÏò æó Âáö ãõÍóãøóÏò æó ÇÑúÒõÞúäöí
ÇáúíóÞöíäó æó ÍõÓúäó ÇáÙøóäøö Èößó æó ÃóËúÈöÊú ÑóÌóÇÁóßó Ýöí
ÞóáúÈöí æó ÇÞúØóÚú ÑóÌóÇÆöí Úóãøóäú ÓöæóÇßó ÍóÊøóì áóÇ ÃóÑúÌõæó
ÛóíúÑóßó æó áóÇ ÃóËöÞó ÅöáøóÇ Èößþ

\stoparabwin

\blank

Here is some mixed {\em Arabic-} (\ArabicTextUTF{عربي}) and
Latin-script. As you can see, Aleph does a very good job mixing
{\em LR} (\ArabicTextUTF{يسار-يمين}) and {\em RL}
(\ArabicTextUTF{يمين-يسار}) texts. \ArabicTextUTF{و
هنا جملة منقطعة في وسط قرينة
لاتينية}. Aleph even does a great job breaking Arabic
phrases across lines.

\stoptext

Going beyond

The last example shows how to make and apply your own filter sequences beyond the basic Gamma module. To go further you need to learn some low-level business. You will also need some working utilities. I have put together a windows package that you can unzip to C:\ConTeXt. These utilities do work, but they are cobbled together from old fpTeX and MiKTeX versions.


TODO: store the utilities on the wiki server and link to them (See: To-Do List)


Example: If you want to get the final Persian kaaf instead of the default Arabic one

Check to see if your glyph is in the Arabic font. The Arabic font is made of 6 raw fonts: 3 regular and three bold:

 texmf-local/fonts/type1/public/omega
 omsea1, omsea1b, ... omsea3b

Using a font viewer or editor you will find the Persian final kaaf in omsea2, named kafswashfin.

Now go to texmf-local/omega/lambda/misc and open omarab.cfg you will find a line

 04AA N kafswashfin

This means that the 044A is the virtual font position for kafswashfin. Open cuni2oar.otp and add the following at line 263:

 %@"E343 => @"04AA;

Following this line you should see

 % remaining Arabic glyphs
 @"E000-@"E3FF => #(\1 - @"DF00);

Basically, in uni2cuni.otp final-kaaf gets mapped to E343. In the font, we want it mapped to kafswashfin, so we did that. Now recompile the otp:

 otp2ocp cuni2oar

Now you will get kafswashfin for the final kaaf.

Want new fonts (Arabic or Latin). Here are the instructions

  • Read the following two papers carefully again and again; they are your friends :-)
  • Make a pfb file containing the glyphs you need, or use an existing font
  • Make a cfg file a la texmf\omega\lambda\misc\omlgc.cfg. Make sure you list your glyph positions in hexadecimal notation.
  • Get the following from an old TeXLive distro: \support\makeovp.zip, containing makeovp.pl. There is a SH file with a sample of its use using omlgc.
  • Following are instructions for cooking omarab.ovf.
    • You want your own ovf, say, omlgcch.ovf (<ch> for <cherokee>).
    • Generate an afm file for your private glyph pfb/pfa plus the afm files that are listed in the SH file (base files for omlgc found in \texmf\fonts\afm\public\omega)
    • Using the instructions below and the SH file (ignore the kernings.afm file!) you can figure out how to make your own ovp and ovf.
    • Before making the ovf file, examine the ovp file created, especially the first few lines, to see how the font-metric info from the afm's are concatenated. Very instructive.
  • Don't forget the rest of the accounting:
    • adding lines to a map file and pointing dvips/dvipdfm to it;
    • create a typescript file;
    • edit your otp's. If you get stuck be sure to read tsukuba-arabic

How to cook omarab.ovf

Ingredients: omarab.cfg, omseco.afm, omsea1.afm, omsea2.afm, omsea3.afm

 #perl makeovp.pl omarab.cfg omseco.afm omsea1.afm omsea2.afm omsea3.afm omarab.ovp
 #pltotf omseco.pl omseco.tfm
 #pltotf omsea1.pl omsea1.tfm
 #pltotf omsea2.pl omsea2.tfm
 #pltotf omsea3.pl omsea3.tfm
 #ovp2ovf omarab.ovp omarab.ovf omarab.ofm

If the last line does not work, try

 #ovp2ovf omarab.ovp omarab.ovf omarab.tfm

rename omarab.tfm to omarab.ofm --> ofm directory

How to distill omarab.ovp from omarab.ovf:

Use a different directory or a different name for the output ovp so that omarab.ovp created above is not overwritten.

get omarab.ofm & rename to omarab.tfm

 #ovf2ovp omarab.ovf omarab.tfm omarab.ovp

How to cook omarabb.ovf

Ingredients: omarab.cfg, omsecob.afm, omsea1b.afm, omsea2b.afm, omsea3b.afm

 #perl makeovp.pl omarab.cfg omsecob.afm omsea1b.afm omsea2b.afm omsea3b.afm omarabb.ovp
 #pltotf omsecob.pl omsecob.tfm
 #pltotf omsea1b.pl omsea1b.tfm
 #pltotf omsea2b.pl omsea2b.tfm
 #pltotf omsea3b.pl omsea3b.tfm
 #ovp2ovf omarabb.ovp omarabb.ovf omarabb.ofm


If the last line does not work, try

 #ovp2ovf omarabb.ovp omarabb.ovf omarabb.tfm

rename omarab.tfm to omarab.ofm --> ofm directory

How to distill omarabb.ovp from omarabb.ovf

Use a different directory or a different name for the output ovp so that omarabb.ovp created above is not overwritten

get omarab.ofm & rename to omarab.tfm

 #ovf2ovp omarabb.ovf omarabb.tfm omarabb.ovp
  • For more info, there is also the (mostly cryptic) Omega manual in PS-Format. Don't ask me why it's not in PDF. :-(

See also tsukuba-arabic

Miscellaneous

  • Some people have gotten large OpenType fonts to work in Aleph/Omega. Probably they used FontForge to convert to CFF-enriched type1. FF can produce ofm files (large tfms) so that's a help too.
  • Me, I'm working on an advanced Arabic-script typesetting system that really pushes Aleph to the max. At present I don't actually use m-gamma, etc, but my own macros. I really hope to release something this year...
  • See also Omega example

To the future

  • The otp mechanism does not seem well suited to support, e.g., opentype GPOS tables, important for really advanced Arabic (though GDEF and GSUB should work fine with the present mechanism for most purposes). We need a better model for horizontal and vertical glyph substitutions.
  • The low-level filtersequence mechanism needs to abstract language processing from font mapping. Right now both are hardwired into a single sequence, so setting up more than one font for a single language is more of a pain than it should be.
  • The otp language is a bit cryptic. Hans has suggested switching otp's to a new language (like lua or io) but I don't know how hard that will be...
  • One very important feature which may work better at the primitive/engine level by extending the pdfeTeX engine: glyph substitution that depends on the paragraph. For example: In traditional Arabic typography, one way to compensate for "underfull" paragraphs is to substitute a "swash" version of a letter. Another way is by stretching the cursive tie between joining characters (which is already implemented in my own Arabic system). Combined with HZ we can get some pretty interesting high-level options, effects, etc. that the user can choose etc.


[1] gay teen brother sex [2] gay black teen boys [3] gat teen studio [4] games to play at teen girl sleepovers [5] games for teen sleepovers [6] galleries of teen boys [7] ga teen driving law [8] fun teen pixs [9] fun teen personality quiz [10] fun projects for teen girls [11] fuck a teen [12] free young teen video clips [13] free young teen thumbnails [14] free young pre teen porn [15] free wordpress themes teen [16] free video clip of teen blow job [17] free tinney teen video [18] free teen webcam shots [19] free teen sex enter email to join list [20] free teen rape movie samples [21] free teen quizzes [22] free teen porno mpvies [23] free teen porn trailers [24] free teen porn site [25] free teen porn pic [26] free teen porn 13 up no credit card [27] free teen photo [28] free teen personality tests [29] free teen meal plans [30] free teen magazine [31] free teen lesbiens [32] free teen hardcpre [33] free teen hardcore thumbs [34] free teen girls videos [35] free teen girls nude [36] free teen galerie [37] free teen fucking porn [38] free teen christian music magazine [39] free teen chatting [40] free teen brunette sex [41] free teen bbs [42] free teen anka nude pics [43] free soft teen porn [44] free sexy teen girls movies [45] free porn teen video young [46] free pics of hot teen girls [47] free online teen sex clips [48] free nude teen thumbnails [49] free nude teen sluts [50] free non nude teen tgp [51] free naked teen movie gallery [52] free mpeg teen [53] free monologues for teen actors [54] free mom teaching teen movies [55] free mom teaching teen clips [56] free mail to order teen clothing catalog [57] free loi teen mpegs [58] free latin teen picture gallery [59] free hot teen angels [60] free hot sexy teen videos [61] free hiden teen movies [62] free hard fucked teen video [63] free grandpa teen sex [64] free gay teen boys having sex [65] free gay teen boy 18 [66] free full length teen vids [67] free full length teen videos [68] free fat teen galleries [69] free essays about teen pregnanacy [70] free ebony teen pics [71] free downloads teen movies [72] free christian teen chat [73] free big teen tits [74] forum model teen [75] forum health teen [76] formal teen clothing [77] forced feminizing teen [78] forced amateur teen girl sex [79] florida leaders teen challenge [80] flat chested teen pics [81] find teen titans on xbox [82] filipina sexy teen [83] female teen weight training program [84] fantastic teen bible devotions [85] fancy teen dresses [86] extreeme pre teen fucks [87] exploited latin teen [88] exotic nude teen girls [89] exercise teen [90] everyday teen hairstyles [91] euro young teen sluts [92] euro teen nudist [93] erotic art teen [94] eriotic gay teen stories [95] endemol u k teen talent [96] embarrassing moments of a teen [97] el toro vfc teen fun [98] ebony teen por [99] easy to read teen books [100] early teen camel toe pictures [101] drunk teen [102] download teen titans episodes [103] dorie teen model [104] does music have an affect on teen behavior [105] dkny teen clothing [106] dirty teen girls free samplers [107] depressed teen poetryt [108] denver teen chat [109] define teen drinking and alcohol abuse [110] decorationg a teen agers room [111] decoration a teen agers room [112] decorating tips for a teen [113] dealing with parenthood as a teen [114] daily free beautiful teen sex blog [115] daily devotions for teen girls online [116] cute young teen girls [117] cute teen thongs [118] cute teen swim [119] cute teen summer quptes [120] cute teen sex [121] cute naked teen [122] custom teen bedding [123] cum teen small tits [124] csm teen modeling [125] crittenden teen summer [126] crimson teen [127] cp teen [128] couch casting teen anal [129] cool teen room theme ideas [130] cool games for teen parties [131] college teen bookbang nikki [132] collections for teen rooms [133] collage teen bound [134] cock sucking teen [135] club speed teen night club [136] clothing for teen punk girls [137] cleveland teen mental health [138] clearance teen clothing [139] classics for teen reading [140] circumcised teen penis [141] church of christ teen question [142] christina model teen florida [143] christian teen poetry [144] christian teen penpals [145] christian teen organizations [146] cheap teen clothing in chicago il [147] chat teen punk [148] chat central flirt teen [149] challenges and differculties of teen parenting [150] center drug teen treatment [151] celebrity teen hairtsyle [152] catalogs for teen clothes [153] casting call san francisco teen [154] cast not another teen movie [155] cast crew teen wolf [156] car insurance for teen drivers [157] cantin ohio teen pregnancy [158] canadian teen hotties [159] call casting teen in maryland [160] call casting shreveport teen [161] california teen chat rooms [162] business ideas for teen boys [163] brazlian teen [164] brandy s box gallery teen [165] bra model pantie teen