LDP/LDP/retired/Bangla-PDF-HOWTO.xml

1427 lines
52 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<article>
<articleinfo>
<title>Bangla PDF HOWTO</title>
<author>
<othername>Progga</othername>
<affiliation>
<address><email>abulfazl AT juniv.edu</email></address>
</affiliation>
</author>
<pubdate>2003-01-30</pubdate>
<revhistory>
<revision>
<revnumber>1.1</revnumber>
<date>2003-04-14</date>
<authorinitials>Pro</authorinitials>
<revremark>PDF from Unicode, Caution about Bijoy</revremark>
</revision>
<revision>
<revnumber>1.0</revnumber>
<date>2003-01-30</date>
<authorinitials>Pro</authorinitials>
<revremark>Initial Release on Planet Earth, reviewed by LDP</revremark>
</revision>
</revhistory>
<abstract>
<para> This text mainly describes the PDF creation process using
<application>KWord</application> with the <application>Bijoy2000</application>
fonts and Bijoy keyboard, for working in the Bangla language. Some information
on PDF creation from Unicode encoded Bangla text files is also provided.</para>
</abstract>
</articleinfo>
<sect1 id="introduction">
<title>Introduction</title>
<para> PDF files, known for being viewable on most platforms, are a popular medium for distributing Bangla files over the Internet. Another use of PDF and
Postscript files in the <acronym>UNIX</acronym> world is for printing. While PDF files can be created with various applications, this text is an attempt to describe the process of PDF creation using the free software <application>KWord</application> and <application>ttf2pt1</application>. The fonts used in this process are the Bijoy fonts included in the <application>Bijoy2000</application>
package. The keyboard layout for typing in Bangla is also Bijoy (the
typing method of ligatures or compound characters is slightly different
from the original one).</para>
<sect2 id="copyright">
<title>Copyright &amp; License</title>
<blockquote>
<para>Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, version 1.1 or any later version published by the Free Software Foundation; with no Invariant sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is located at <ulink url="http://www.gnu.org/licenses/fdl.html">http://www.gnu.org/licences/fdl.html</ulink>.</para>
</blockquote>
<blockquote>
<para>Bijoy fonts (c) Mustafa Jabbar, Ananda Computers, 8/6 Segun Bagicha, Dhaka-1000, Bangladesh.</para>
</blockquote>
</sect2>
<sect2 id="requirements">
<title>Minimum Requirements</title>
<para> The test platform used were <application>FreeBSD-4.6.0 RELEASE</application> and <application>RedHat-7.3</application>. Earlier versions of RedHat won't do. Whatever is the platform, at least the following are required:</para>
<itemizedlist>
<listitem>
<para>
<application>XFree86-4.2.0</application>
(unsure about earlier versions)
</para>
</listitem>
<listitem>
<para>
<application>KDE-3</application>
</para>
</listitem>
<listitem>
<para>
<application>KWord-1.1.1</application>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://ttf2pt1.sf.net">
<application>TTF2PT1-3.4.3</application>
</ulink>
</para>
</listitem>
<listitem>
<para>
<application>Bijoy2000 fonts</application>
</para>
</listitem>
<listitem>
<para>Strong willingness to create a Bangla PDF.</para>
</listitem>
</itemizedlist>
<para> There are many fonts that come with the <application>Bijoy2000</application> package. In this text, to state a fontname, only <quote>SutonnyMJ</quote> has been used. This name can be replaced with others to meet individual needs. </para>
</sect2>
<sect2 id="caution">
<title>Caution</title>
<para>After installing the Bijoy fonts and keyboard, one may be tempted to use them for purposes other than creating PDFs. But a little common sense and
farsightedness will reveal that the use of a nonstandard font and keyboard like
Bijoy is destined to create the same kind of chaos regarding Bangla in the Open
Source environment as is now prevailing in the proprietary world. PDF is a
different story though as they are font independent(if created properly) and
has no chance of getting into this kind of chaos. Now what if one needs to
create a Bangla text file? Easy - use Unicode. Recent developments has made it
possible to write Unicode based Bangla in GTK+ 2.0 (or higher) based softwares.
And the same thing is on the offing for QT (which is the backbone of KDE).
Even PDFs can be created from Unicode encoded Bangla text files. This has been
described in a later <xref linkend="unicode"/>. So instead of relying on
nonstandard softwares like Bijoy, try to use Unicode based Bangla wherever
possible. </para>
</sect2>
</sect1>
<sect1 id="fonts">
<title>Fonts</title>
<para> While creating PDFs, <application>KWord</application>
gives the best result if Type1 fonts are used. But
Bangla Type1 fonts are quite rare, so converting TrueType
fonts to Type1 is a good option. This conversion is done with
the <application>ttf2pt1</application>
package. This package has some useful programs to carry out the
conversion properly. After downloading and uncompression, the
<application>ttf2pt1</application>
package can be installed using the following commands: </para>
<screen>
<prompt> $</prompt><userinput> make all </userinput>
<prompt> $</prompt><userinput> make install </userinput>
</screen>
<para> The last command needs to be executed as root. The
<filename>README</filename> of <application>ttf2pt1</application>
has some better descriptions of these.</para>
<sect2 id="conversion">
<title>TrueType to Type1 Conversion</title>
<para> The following steps describe converting TrueType Bijoy fonts to
Type1, suitable for PDF creation:</para>
<procedure>
<step>
<para> Instead of creating a Type1 font directly from
<filename>sutom___.ttf</filename> (TrueType font file of SutonnyMJ
font), create an interim file <filename>sutonnymj.t1a</filename>:</para>
<screen>
<prompt> $</prompt><userinput> ttf2pt1 sutom___.ttf sutonnymj</userinput>
</screen>
</step>
<step>
<para> Perform some correction to <filename>sutonnymj.t1a</filename>
using <command>forceiso</command>, a <acronym>PERL</acronym> script supplied with the
<application>ttf2pt1</application> package, and create
<filename>sutonnymj2.t1a</filename>:</para>
<screen>
<prompt> $</prompt><userinput> cat sutonnymj.t1a | /usr/local/share/ttf2pt1/scripts/forceiso \
"U00%x" > sutonnymj2.t1a</userinput>
</screen>
<para> This correction is needed because some glyphs of Bijoy fonts
have no name. <command>forceiso</command> solves this problem by
assigning proper names to those otherwise nameless glyphs.
</para>
</step>
<step>
<para> Finally, create the Type1 version of SutonnyMJ from
<filename>sutonnymj2.t1a</filename> using <command>t1asm</command>,
another program supplied with the <application>ttf2pt1</application>
package:</para>
<screen>
<prompt> $</prompt><userinput> cat sutonnymj2.t1a | /usr/local/libexec/ttf2pt1/t1asm \
> sutonnymj.pfa</userinput>
</screen>
<para> The last two steps can also be done in one go:</para>
<screen>
<prompt> $</prompt><userinput> cat sutonnymj.t1a | /usr/local/share/ttf2pt1/scripts/forceiso \
"U00%x" | /usr/local/libexec/ttf2pt1/t1asm > sutonnymj.pfa
</userinput>
</screen>
</step>
</procedure>
<para> The final product, in this case <filename>sutonnymj.pfa</filename>,
is the actual Type1 font file. The first step also produces
<filename>sutonnymj.afm</filename>
which can be ignored through the rest of the text.</para>
</sect2>
<sect2 id="font-installation">
<title>Font Installation</title>
<para> There are some programs that automate font installation, such as
<application>type1inst</application> for Type1,
<application>ttmkfdir</application>
for TrueType, KDE's own font installer for both types and some others. When
these are used, the font encoding can be wrong and needs hand-editing of the
<filename>fonts.scale</filename> file.
If any of the font installing programs were used, <command>mkfontdir</command>
must be executed after editing <filename>font.scale</filename>
by hand. For Type1 fonts, the encoding is <quote>adobe-fontspecific</quote>
and not <quote>iso8859-1.</quote> For TrueType fonts, the encoding is
<quote>apple-roman</quote> and not <quote>iso8859-1</quote>. Besides,
anti-aliasing must be stopped for these TrueType fonts to show up.</para>
<para> Alternatively, the next three sections can be considered to
install fonts manually. This is a bit cumbersome but when things go
wrong, it is easier to debug, as the user has a clear idea about the
whole thing. </para>
<sect3 id="type1-installation">
<title>Type1 Font Installation</title>
<para> The following steps describe manual installation of Type1
fonts: </para>
<procedure>
<step>
<para> Create a new directory,
<filename class="directory">/usr/local/share/fonts/type1/bijoy/</filename>, and copy the Type1 font there: </para>
<screen>
<prompt>
$</prompt><userinput> mkdir -p /usr/local/share/fonts/type1/bijoy/ </userinput>
<prompt>
$</prompt><userinput> cp sutonnymj.pfa /usr/local/share/fonts/type1/bijoy/ </userinput>
</screen>
</step>
<step>
<para> Create the file <filename>fonts.scale</filename>
and place it inside <filename class="directory">/usr/local/share/fonts/type1/bijoy/</filename>. The <filename>fonts.scale's</filename> creation process will be described later in <xref linkend="fonts.scale" />. </para>
</step>
<step>
<para> Create another file <filename>fonts.dir</filename>
using <command>mkfontdir</command>: </para>
<screen>
<prompt>
$</prompt><userinput> cd /usr/local/share/fonts/type1/bijoy/ </userinput>
<prompt>
$</prompt><userinput> mkfontdir </userinput>
</screen>
<para> If the <filename>fonts.scale</filename>
was created correctly then <filename>fonts.dir</filename>
will be created, otherwise some error messages will appear
after executing <command>mkfontdir</command>.</para>
</step>
<step>
<para> Open <filename>XF86Config</filename> and add
<filename class="directory">/usr/local/share/fonts/type1/bijoy/</filename>
as a new fontpath in the <quote>Files</quote> section:</para>
<para> <userinput>FontPath "/usr/local/share/fonts/type1/bijoy/" </userinput></para>
<para> The <filename>XF86Config</filename> file is generally found inside
<filename class="directory">/etc/X11/</filename>.
If it's not present there then use <command>find</command>
to get the path:</para>
<screen>
<prompt>
$</prompt><userinput> find / -name XF86Config </userinput>
</screen>
</step>
<step>
<para> Restart X server by pressing
<keycombo action="simul">
<keycap>Ctrl</keycap>
<keycap>Alt</keycap>
<keycap>Bksp</keycap>
</keycombo>.
The font will be installed. </para>
</step>
<step>
<para> Check whether the font has really been installed by using
<command>xlsfonts</command>. This program shows the
<link linkend="xlfd"><acronym>XLFD</acronym></link> of every font that is available to the X server.
<command>grep</command> can be used to find the desired font from
<command>xlsfonts'</command> output:</para>
<screen>
<prompt>
$</prompt><userinput> xlsfonts | grep sutonnymj </userinput>
</screen>
<para>If <quote>sutonnymj</quote> is unavailable to X then grep will give no output. Otherwise the output will be the <acronym>XLFD</acronym> of <quote>sutonnymj</quote>:
</para>
<screen>
-altsys-sutonnymj-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
</screen>
<para> If more than one font were installed then
<command>grep altsys</command>
will show them all (if present in xlsfonts' output).</para>
</step>
</procedure>
</sect3>
<sect3 id="fonts.scale">
<title>Creating <filename>fonts.scale</filename></title>
<para> The <filename>fonts.scale</filename>
file contains various information about the fonts in a directory
where that <filename>fonts.scale</filename>
itself is placed. This means every directory which has any font
file can have its own <filename>fonts.scale</filename>
(non-scalable fonts like Bitmap fonts do not need a
<filename>fonts.scale</filename> file). <anchor id="xlfd"/>The
information that every line of a <filename>fonts.scale</filename> contains
(preceded by the name of the font file itself) is called <acronym>XLFD
</acronym> (X Logical Font Definition). An example line from a <filename>
fonts.scale</filename> file is:</para>
<para> sutonny.pfa -altsys-SutonnyMJ-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
</para>
<para>The only difference is the very first line of
<filename>fonts.scale</filename>, which has only a
number instead of the usual font-file name followed by the
corresponding <acronym>XLFD</acronym>. This number is the total
number of XLFDs listed in that <filename>fonts.scale</filename>
file.</para>
<para> The structure of a <filename>fonts.scale</filename>
is like this: </para>
<programlisting>
Line 1: Total number of XLFD
Line 2: FontFileName1 XLFD
Line 3: FontFileName2 XLFD
....
....
....
</programlisting>
<para> The following is a suitable XLFD for Type1 Bijoy fonts: </para>
<para>
-altsys-SutonnyMJ-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
</para>
<para> Please note that in the above string, <quote>SutonnyMJ</quote>
is the actual fontname. This name needs to be changed accordingly for
other fonts.
</para>
<para> An example <filename>fonts.scale</filename>
file for two Type1 Bijoy fonts can be like this (Where
sutonnymj.pfa and rinkymj.pfa are the actual Type1 font files for
the fonts Sutonnymj and Rinkymj respectively): </para>
<programlisting>
2
sutonnymj.pfa -altsys-SutonnyMJ-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
rinkymj.pfa -altsys-RinkyMJ-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
</programlisting>
<para> It's better not to press <keycap>Return</keycap> after writing the
XLFD in the last line. This sometimes create problem with the total
number of XLFD lines and the file is taken as having bad structure by
<command>mkfontdir</command>. If <filename>fonts.scale</filename>
is not created properly, the <command>mkfontdir</command>
command will give error message. Otherwise <filename>fonts.dir</filename>
will be created.</para>
<para> The <quote>adobe-fontspecific</quote> substring found at the end of every XLFD for Type1 Bijoy fonts is the encoding of that font. If <quote>iso8859-1</quote> encoding is required, this can be done too by creating another file <filename>fonts.alias</filename>. Every line of <filename>fonts.alias</filename> contains two XLFDs. The first XLFD is the alias and the second one is the original. Unlike <filename>fonts.scale</filename> and <filename>fonts.dir</filename>, there is no number at the first line of <filename>fonts.alias</filename>. An example <filename>fonts.alias's</filename>
<emphasis>structure</emphasis> looks like this: </para>
<programlisting>
Line 1: -altsys-SutonnyMJ-medium-r-normal--0-0-0-0-p-0-iso8859-1
-altsys-SutonnyMJ-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
Line 2: -altsys-RinkyMJ-medium-r-normal--0-0-0-0-p-0-iso8859-1
-altsys-RinkyMJ-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
</programlisting>
<para> Generally, some subdirectories under <filename class="directory">/usr/X11R6/lib/X11/fonts/</filename> contain many font files and some <filename>fonts.scale</filename> files, <filename>fonts.dir</filename> and <filename>fonts.alias</filename> as well. A browse through these files can make it easier to create new ones. One thing to notice is that the content of both <filename>fonts.scale</filename> and <filename>fonts.dir</filename> are same but both are still needed.
</para>
</sect3>
<sect3 id="ttf-installation">
<title>TrueType Font Installation</title>
<para> The Bijoy font's TrueType installation method is quite similar
to that of Type1. Just keep a separate directory for the fonts, like,</para>
<para>
<filename class="directory">/usr/local/share/fonts/ttfonts/bijoy/</filename>
</para>
<para>and change the XLFD to:</para>
<para>
-altsys-SutonnyMJ-medium-r-normal--0-0-0-0-p-0-apple-roman
</para>
<para> In the example, the font encoding is <quote>apple-roman</quote>
instead of <quote>adobe-fontspecific.</quote> Also to use these fonts
anti-aliasing must be stopped, and this is where <quote>Xft</quote>
comes into business.In your <filename class="directory">$HOME
</filename> directory, create a hidden file <filename>~/.xftconfig
</filename> and write the following lines in it ( the file may be
already present, in that case just add these lines):</para>
<programlisting>
dir "/usr/local/share/fonts/ttfonts/bijoy/"
match any family == "sutonnymj"
edit antialias = false; encoding = "apple-roman";
</programlisting>
<para> The <literal>match any family == "sutonnymj"</literal> and the next line
prevents anti-aliasing for sutonnymj only. If there are other Bijoy
fonts in use, more similar lines must be added. </para>
<para> The presence of only <filename>~/.xftconfig</filename>
is enough to make a TrueType font available to KWord. There is no
need to create <filename>fonts.scale</filename> and
<filename>fonts.dir</filename>. Even the fontpath needs not be added
in <filename>XF86Config</filename>. So these steps can be skipped if
wished. </para>
<para>Newer systems(like RH 8.0) use Xft 2.0 instead of Xft 1.0 .
Xft 2.0 doesn't use <filename>~/xftconfig</filename>. Instead it uses
<filename>~/.fonts </filename>. This file can be modified by <command>
fontconfig </command>. Here also, <quote>antialias</quote> must be
stopped and <quote>encoding</quote> remains <quote>apple-roman</quote>
. </para>
</sect3>
</sect2>
<sect2 id="using-ttf">
<title>On Using TrueType</title>
<para>
<application> KWord </application>
can't create PDFs perfectly using TrueType fonts, so there is no
reason to use TrueType fonts for creating PDFs. But TrueType is useful
for creating PDFs from files written in <application>MS Word</application>
(i.e. *.doc files). Even then these PDFs are defective (due to the use
of Type3 fonts inside the PDFs) and so are not transferable to other
computers; they can be used for printing only. So the only suggested
use of TrueType is to create PDFs from <application>MS Word</application>
files for printing. Again, these PDFs are of low quality, so if it
is not urgently needed, TrueType should be avoided completely for
PDF creation.</para>
<para> To open an <application>MS Word</application> file in
<application> KWord </application>, the encoding of the relevant font(s) should be changed from
<quote>apple-roman</quote> to <quote>iso8859-1</quote> in the <filename>~/.xftconfig</filename>, for example:</para>
<programlisting>
match any family == "sutonnymj"
edit antialias = false; encoding = "apple-roman";
</programlisting>
<para>will become:</para>
<programlisting>
match any family == "sutonnymj"
edit antialias = false; encoding = "iso8859-1";
</programlisting>
<para> Type1 and TrueType versions of a font should not be used
together. To stop using TrueType fonts, the corresponding FontPath must
be commented out from the <quote>Files</quote> section of
<filename>XF68Config</filename>. The relevant entries for the font in
<filename>~/.xftconfig</filename> must also be commented out. In both cases,
a <quote>#</quote> as the first character on any line comments out the whole
line. Given below is an example <filename>~/.xftconfig</filename>,
where entry for a font has been commented out:</para>
<programlisting>
# dir "/usr/local/share/fonts/ttfonts/"
# match any family == "sutonnymj"
# edit antialias = false; encoding = "apple-roman";
</programlisting>
</sect2>
</sect1>
<sect1 id="keyboard">
<title>Keyboard</title>
<sect2 id="bijoy-keyboard">
<title>Using The Bijoy Keyboard</title>
<para> In X Window, all the keyboard related stuff is handled by <application>XKB</application>.
<acronym>XKB</acronym> relies on some configuration files called the <quote>symbol</quote>
files, to get the layout of a specific keyboard. The following steps describe the
installation process of a symbol file for the Bijoy Bangla keyboard:
</para>
<procedure>
<step>
<para> Below is the symbol file for the Bijoy keyboard. Save it as
<filename> bn_bijoy</filename>
.
</para>
<programlisting>
<![CDATA[
// Symbol file for the Bijoy Bangla Keyboard.
partial default alphanumeric_keys
xkb_symbols "bijoy" {
name[group2]="Bangla";
key <AE01> { [], [ 49, exclam ] };
key <AE02> { [], [ 50, 64 ] };
key <AE03> { [], [ 51, 35 ] };
key <AE04> { [], [ 52, 36 ] };
key <AE05> { [], [ 53, 37 ] };
key <AE06> { [], [ 54, 94 ] };
key <AE07> { [], [ 55, 117 ] };
key <AE08> { [], [ 56, asterisk ] };
key <AE09> { [], [ 57, parenleft ] };
key <AE10> { [], [ 48, parenright ] };
key <AE11> { [], [ minus, 209 ] };
key <AE12> { [], [ 61, plus ] };
key <AD01> { [], [ 79, 115 ] };
key <AD02> { [], [ 104, 113 ] };
key <AD03> { [], [ 87, 88 ] };
key <AD04> { [], [ 99, 100 ] };
key <AD05> { [], [ 85, 86 ] };
key <AD06> { [], [ 80, 81 ] };
key <AD07> { [], [ 82, 83 ] };
key <AD08> { [], [ 110, 84 ] };
key <AD09> { [], [ 77, 78 ] };
key <AD10> { [], [ 111, 112 ] };
key <AD11> { [], [ bracketleft, braceleft ]};
key <AD12> { [], [ bracketright, braceright]};
key <AC01> { [], [ U84, 169 ] };
key <AC02> { [], [ 121, 126 ] };
key <AC03> { [], [ 119, 120 ] };
key <AC04> { [], [ 118, 65 ] };
key <AC05> { [], [ Multi_key, 124 ] };
key <AC06> { [], [ 101, 102 ] };
key <AC07> { [], [ 75, 76 ] };
key <AC08> { [], [ 90, 95 ] };
key <AC09> { [], [ 96, 97 ] };
key <AC10> { [], [ semicolon, colon] };
key <AC11> { [], [ 213, 211 ] };
key <TLDE> { [], [ 212, 210 ] };
key <BKSL> { [], [ 114, 116 ] };
key <AB01> { [], [ 170, 168 ] };
key <AB02> { [], [ 73, U8a ] };
key <AB03> { [], [ U87, U89 ] };
key <AB04> { [], [ 105, 106 ] };
key <AB05> { [], [ 98, 89 ] };
key <AB06> { [], [ 109, 108 ] };
key <AB07> { [], [ 103, 107 ] };
key <AB08> { [], [ comma, less ] };
key <AB09> { [], [ period, greater]};
key <AB10> { [], [ slash, question]};
} ;
]]>
</programlisting>
</step>
<step>
<para> Copy <filename>bn_bijoy</filename> to
<filename class="directory"> /usr/X11R6/lib/X11/xkb/symbols/</filename>
</para>
</step>
<step>
<para> Edit the <quote>InputDevice</quote> section of
<filename> XF86Config </filename> so it looks like: </para>
<programlisting>
.........
.........
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option "XkbKeycodes" "xfree86"
Option "XkbTypes" "complete"
Option "XkbCompat" "complete+leds"
Option "XkbSymbols" "us(pc104)+bn_bijoy+group(lwin_toggle)"
Option "XkbGeometry" "pc(pc104)"
EndSection
..........
..........
</programlisting>
<para> The above description is for a 104-key keyboard. </para>
</step>
<step>
<para>Restart X server by pressing
<keycombo action="simul">
<keycap>Ctrl</keycap>
<keycap>Alt</keycap>
<keycap>Bksp</keycap>
</keycombo>.</para>
</step>
<step>
<para> After restarting X, the Bijoy keyboard should be
present along side the English one. To activate it, press the
left <keycap>Win-key</keycap>. If everything is okay, the
<keycap>Scroll Lock</keycap> LED will be on and the
key presses will produce codes according to the Bijoy keyboard
layout. Pressing the left <keycap>Win-key</keycap>
again will disable Bijoy and the <keycap>Scroll Lock</keycap> LED will go off.
</para>
</step>
<step>
<para> To test the newly installed Bijoy keyboard, follow these steps: </para>
<procedure>
<step>
<para> Open <application>KWord</application>, </para>
</step>
<step>
<para> Select sutonnymj from the font list, </para>
</step>
<step>
<para> Press the left <keycap>Winkey</keycap>, </para>
</step>
<step>
<para> Start typing according to the Bijoy keyboard layout. </para>
</step>
</procedure>
</step>
<step>
<para> A handy tool for testing mouse and keypress events is
<command>xev</command>. This program shows all the generated codes from keypresses.
</para>
</step>
</procedure>
<para> These steps are not enough, however, to write ligatures or compound
characters. The next section describes this very thing. </para>
</sect2>
<sect2 id="ligatures">
<title>Writing Ligatures</title>
<para> The ligature writing process described here is not a standard one
. At best it can be called a work-around (it has a similarity to
cuckoos laying eggs in crows' nests). If this method is used, the
<quote>Multikey</quote> feature won't work on Latin characters (at least when Bijoy
keyboard is needed). If there is no need to use the Multikey for
typing various Latin characters like <quote>ssharp</quote> then this method is
okay. The typing sequence of characters for writing ligatures is
slightly different from the original Bijoy keyboard. Whatever is
the situation, the following steps describe a way to get the ligatures
to appear on the screen: </para>
<procedure>
<step>
<para>Save the following as <filename>Compose.bijoy</filename>: </para>
<programlisting>
<![CDATA[
# Compose File for the Bijoy Bangla Keyboard
#
# Sequence Definition
#
# <Multi_key> Means <Compose>
# Special Character
# Special
<Multi_key> <Multi_key> : "\46"
# Ka
<Multi_key> <K> <K> : "\260"
<Multi_key> <O> <K> : "\274"
<Multi_key> <j> <K> : "\351"
<Multi_key> <l> <K> : "\256\213"
<Multi_key> <m> <K> : "\257\213"
# Kha
<Multi_key> <O> <L> : "\225\114"
<Multi_key> <m> <L> : "\366"
# Ga
<Multi_key> <M> <M> : "\271"
<Multi_key> <O> <M> : "\275"
<Multi_key> <grave> <M> : "\230\115"
<Multi_key> <j> <M> : "\352"
<Multi_key> <o> <M> : "\377"
#Gha
<Multi_key> <O> <N> : "\225\116"
<Multi_key> <grave> <N> : "\230\116"
# Cha
<Multi_key> <P> <P> : "\224\120"
<Multi_key> <T> <P> : "\302"
<Multi_key> <k> <P> : "\360"
# Chha
<Multi_key> <P> <Q> : "\224\121"
<Multi_key> <T> <Q> : "\303"
# Ja
<Multi_key> <R> <R> : "\276"
<Multi_key> <T> <R> : "\304"
<Multi_key> <e> <R> : "\342"
# Jha
<Multi_key> <R> <S> : "\300"
<Multi_key> <T> <S> : "\305"
# Io
<Multi_key> <R> <T> : "\301"
# Ta
<Multi_key> <K> <U> : "\261"
<Multi_key> <U> <U> : "\306"
<Multi_key> <Y> <U> : "\310"
<Multi_key> <b> <U> : "\233\125"
<Multi_key> <c> <U> : "\336"
<Multi_key> <j> <U> : "\353"
<Multi_key> <l> <U> : "\363"
<Multi_key> <m> <U> : "\367"
# Tha
<Multi_key> <Y> <V> : "\311"
<Multi_key> <b> <V> : "\332"
<Multi_key> <l> <V> : "\364"
# Da
<Multi_key> <W> <W> : "\307"
<Multi_key> <Y> <W> : "\312"
<Multi_key> <b> <W> : "\333"
<Multi_key> <j> <W> : "\354"
# Nna
<Multi_key> <l> <Y> : "\362"
<Multi_key> <n> <Y> : "\156\350"
# Ta
<Multi_key> <K> <Z> : "\263"
<Multi_key> <Z> <Z> : "\313"
<Multi_key> <b> <Z> : "\232\227"
<Multi_key> <c> <Z> : "\337"
<Multi_key> <m> <Z> : "\257\227"
# Tha
<Multi_key> <Z> <underscore> : "\314"
<Multi_key> <b> <underscore> : "\232\222"
<Multi_key> <m> <underscore> : "\257\222"
# Dda
<Multi_key> <M> <grave> : "\272"
<Multi_key> <grave> <grave> : "\317"
<Multi_key> <b> <grave> : "\233\140"
<Multi_key> <e> <grave> : "\343"
# Dha
<Multi_key> <M> <a> : "\273"
<Multi_key> <grave> <a> : "\327"
<Multi_key> <b> <a> : "\334"
<Multi_key> <e> <a> : "\344"
# Na
<Multi_key> <K> <b> : "\113\350"
<Multi_key> <M> <b> : "\115\350"
<Multi_key> <N> <b> : "\116\350"
<Multi_key> <Y> <b> : "\131\350"
<Multi_key> <Z> <b> : "\132\350"
<Multi_key> <b> <b> : "\142\234"
<Multi_key> <c> <b> : "\143\350"
<Multi_key> <g> <b> : "\346"
<Multi_key> <k> <b> : "\153\350"
<Multi_key> <m> <b> : "\370"
<Multi_key> <n> <b> : "\375"
# Pa
<Multi_key> <c> <c> : "\340"
<Multi_key> <g> <c> : "\244\143"
<Multi_key> <j> <c> : "\355"
<Multi_key> <l> <c> : "\256\143"
<Multi_key> <m> <c> : "\257\143"
# Pha
<Multi_key> <g> <d> : "\347"
<Multi_key> <j> <d> : "\356"
<Multi_key> <l> <d> : "\365"
<Multi_key> <m> <d> : "\371"
# Ba
<Multi_key> <K> <e> : "\113\241"
<Multi_key> <M> <e> : "\115\246"
<Multi_key> <R> <e> : "\122\241"
<Multi_key> <U> <e> : "\125\241"
<Multi_key> <Y> <e> : "\131\136"
<Multi_key> <Z> <e> : "\132\241"
<Multi_key> <underscore> <e> : "\137\241"
<Multi_key> <grave> <e> : "\330"
<Multi_key> <a> <e> : "\141\237"
<Multi_key> <b> <e> : "\233\136"
<Multi_key> <e> <e> : "\145\237"
<Multi_key> <g> <e> : "\244\136"
<Multi_key> <j> <e> : "\152\246"
<Multi_key> <k> <e> : "\153\246"
<Multi_key> <m> <e> : "\257\136"
<Multi_key> <n> <e> : "\156\237"
# Bha
<Multi_key> <grave> <f> : "\231\242"
<Multi_key> <g> <f> : "\244\242"
# Ma
<Multi_key> <K> <g> : "\264"
<Multi_key> <M> <g> : "\115\245"
<Multi_key> <O> <g> : "\225\147"
<Multi_key> <U> <g> : "\125\245"
<Multi_key> <Z> <g> : "\315"
<Multi_key> <grave> <g> : "\331"
<Multi_key> <a> <g> : "\141\245"
<Multi_key> <b> <g> : "\142\245"
<Multi_key> <g> <g> : "\244\247"
<Multi_key> <j> <g> : "\152\245"
<Multi_key> <k> <g> : "\153\245"
<Multi_key> <l> <g> : "\256\247"
<Multi_key> <m> <g> : "\257\247"
<Multi_key> <n> <g> : "\376"
# La
<Multi_key> <K> <j> : "\113\254"
<Multi_key> <M> <j> : "\115\254"
<Multi_key> <c> <j> : "\143\254"
<Multi_key> <d> <j> : "\144\254"
<Multi_key> <e> <j> : "\145\254"
<Multi_key> <f> <j> : "\146\254"
<Multi_key> <g> <j> : "\244\254"
<Multi_key> <j> <j> : "\152\254"
<Multi_key> <l> <j> : "\153\254"
<Multi_key> <m> <j> : "\257\254"
<Multi_key> <n> <j> : "\156\254"
# Ssa
<Multi_key> <K> <l> : "\266"
# Sa
<Multi_key> <K> <m> : "\267"
<Multi_key> <b> <m> : "\335"
<Multi_key> <c> <m> : "\341"
# Miscellaneous
<Multi_key> <K> <ordfeminine> : "\265"
<Multi_key> <Z> <ordfeminine> : "\316"
<Multi_key> <f> <ordfeminine> : "\345"
<Multi_key> <n> <U84> : "\374"
<Multi_key> <M> <y> : "\270"
<Multi_key> <i> <y> : "\151\223"
<Multi_key> <k> <y> : "\357"
<Multi_key> <n> <y> : "\373"
<Multi_key> <i> <asciitilde> : "\151\203"
# Vowels
<Multi_key> <w> : "\102"
<Multi_key> <x> : "\103"
<Multi_key> <y> : "\104"
<Multi_key> <y> : "\104"
<Multi_key> <asciitilde> : "\105"
<Multi_key> <U84> : "\106"
<Multi_key> <U87> : "\107"
<Multi_key> <U89> : "\110"
<Multi_key> <U8a> : "\112"
# End of Sequence Definition
]]>
</programlisting>
</step>
<step>
<para> Get the current locale name. One way to get it is: </para>
<screen>
<prompt>
$</prompt><userinput> echo $LANG </userinput>
</screen>
</step>
<step>
<para> Find the <filename>Compose</filename> file for the current locale.
<filename>/usr/X11R6/lib/X11/locale/compose.dir</filename>
lists the <filename>Compose</filename> files for all the locales. If
the locale is <quote>C</quote>, the <filename>Compose</filename> file is
<filename>iso8859-1/Compose</filename>, i.e.
<filename>/usr/X11R6/lib/X11/locale/iso8859-1/Compose</filename>.
If the locale is <quote>en_US.ISO8859-15,</quote> the <filename>Compose</filename>
file is <filename>iso8859-15/Compose</filename>, i.e.
<filename>/usr/X11R6/lib/X11/locale/iso8859-1/Compose</filename>.
Whichever is the Compose file for the current locale, make a
backup of it: </para>
<screen>
<prompt>
$</prompt><userinput> cd /usr/X11R6/lib/X11/locale/iso8859-1/ </userinput>
<prompt>
$</prompt><userinput> mv Compose Compose.real </userinput>
</screen>
<para> The above example commands were written assuming that the
locale was <quote>C.</quote></para>
</step>
<step>
<para> Make <filename>Compose.bijoy</filename>
the new <filename>Compose</filename> file for the current locale: </para>
<screen>
<prompt>
$</prompt><userinput> cp Compose.bijoy /usr/X11R6/lib/X11/locale/iso8859-1/Compose</userinput>
</screen>
<para> The above example command was written assuming that the
locale was <quote>C.</quote></para>
</step>
<step>
<para> The ligatures can be written now. To test it do the following: </para>
<procedure>
<step>
<para> Open
<application>KWord</application>, </para>
</step>
<step>
<para> Select sutonnymj from the font list, </para>
</step>
<step>
<para> Press the left <keycap>Winkey</keycap>, </para>
</step>
<step>
<para> Press 'Hashanta'(g)+'Ka'(j)+'Ka'(j). </para>
</step>
</procedure>
<para>
If the output is Zukta Ka, then the ligature writing process is okay.
Now the thing to notice here is that, unlike the original Bijoy
keyboard, Hashanta has been pressed before the two 'Ka's. The
original Bijoy keyboard requires that 'Hashanta' be pressed in the
midst of the two 'Ka's, for example:</para>
<para> Zukta Ka = 'Ka'(j)+'Hashanta'(g)+'Ka'(j) </para>
<para> Except this change of sequence for writing ligatures there
are a few minor ones that have been listed below: </para>
<informaltable frame="none">
<tgroup cols="2">
<thead>
<row>
<entry> Original Sequence </entry>
<entry> Changed Sequence </entry>
</row>
</thead>
<tbody>
<row>
<entry> 'Ka'(j)+'Rafala'(z) </entry>
<entry> 'Hashanta'(g)+'Ka'(j)+'Rafala'(z) </entry>
</row>
<row>
<entry> 'Ta'(k)+'Rafala'(z) </entry>
<entry> 'Hashanta'(g)+'Ta'(k)+'Rafala'(z) </entry>
</row>
<row>
<entry> 'Va'(H)+'Rafala'(z) </entry>
<entry> 'Hashanta'(g)+'Va'(H)+'Rafala'(z) </entry>
</row>
<row>
<entry> 'Ha'(i)+'Rikar'(a) </entry>
<entry> 'Hashanta'(g)+'Ha'(i)+'Rikar'(a) </entry>
</row>
<row>
<entry> 'Ga'(o)+'Ukar'(s) </entry>
<entry> 'Hashanta'(g)+'Ga'(o)+'Ukar'(s) </entry>
</row>
<row>
<entry> 'Ra'(v)+'Ukar'(s) </entry>
<entry> 'Hashanta'(g)+'Ra'(v)+'Ukar'(s) </entry>
</row>
<row>
<entry> 'Sha'(M)+'Ukar'(s) </entry>
<entry> 'Hashanta'(g)+'Sha'(M)+'Ukar'(s) </entry>
</row>
<row>
<entry> 'Ha'(i)+'Ukar'(s) </entry>
<entry> 'Hashanta'(g)+'Ha'(i)+'Ukar'(s) </entry>
</row>
<row>
<entry> 'Ra'(v)+'UUkar'(S) </entry>
<entry> 'Hashanta'(g)+'Ra'(v)+'UUkar'(S) </entry>
</row>
</tbody>
</tgroup>
</informaltable>
</step>
</procedure>
</sect2>
</sect1>
<sect1 id="printing-pdf">
<title>Printing as PDF</title>
<para> After typing some text in <application>KWord</application>,
do the following to get a PDF: </para>
<procedure>
<step>
<para> Press <guimenuitem>Print Preview</guimenuitem>; if the output is okay,
the PDF will be okay. If not, the font conversion was faulty, so check it again
(especially the use of forceiso).</para>
</step>
<step>
<para> Word-wrapping in the <quote>Preview</quote> window and in
<application>KWord</application> may look different. If this is unaccptable then it needs to be adjusted manually. The PDF will always appear as shown in the <quote>Preview.</quote></para>
</step>
<step>
<para> Press <guibutton>Print</guibutton> and a box will appear. Press
<guimenuitem>System Options...</guimenuitem> and select <guimenuitem>Embed fonts in
PostScript data when printing</guimenuitem>. Then click <guibutton>OK</guibutton>.</para>
</step>
<step>
<para> From the printer selection list select <guimenuitem>Print To File
(PDF/Acrobat)</guimenuitem>. Change the output file's name or leave it unchanged.
</para>
</step>
<step>
<para> Now press <guibutton>Print</guibutton>. It may take a while for the box to disappear and the PDF to be created. </para>
</step>
<step>
<para> Now check the PDF with any PDF viewer. </para>
</step>
<step>
<para> A good utility to use here is <command>pdffonts</command>
to check whether the Bangla font has really been embeded in the newly
created PDF. </para>
</step>
</procedure>
</sect1>
<sect1 id="redhat">
<title>RedHat Peculiarities</title>
<para> In some places, the previous descriptions are not applicable to
RedHat. These differences are described below: </para>
<procedure>
<step>
<para> While installing new font(s), the fontpath was supposed to be
included in the <quote>Files</quote> section of <filename>XF86Config</filename>.
In the case of RedHat this is not needed at all. There is a script called
<command>chkfontpath</command> to do this. With <command>chkfontpath</command>,
add a fontpath like this: </para>
<screen>
<prompt>
$</prompt><userinput> chkfontpath -a /usr/local/share/fonts/ttfonts/bijoy/ </userinput>
</screen>
<para> And remove a fontpath like this: </para>
<screen>
<prompt>
$</prompt><userinput> chkfontpath -r /usr/local/share/fonts/ttfonts/bijoy/ </userinput>
</screen>
<para> If <command>chkfontpath</command> doesn't show any error messages then the font(s) become
available or unavailable just after executing it. But even for RedHat, there
is no need to add a TrueType fontpath as <quote>Xft</quote> itself makes the fonts
avilable to <application>KWord</application>. So use of <command>chkfontpath</command>
for TrueType is optional.</para>
<note>
<title>Note</title>
<para> Just for reference, in the case of RedHat, the fontpaths are added in
<filename>/etc/X11/fs/config</filename> and not in <filename>XF86Config</filename>
or <filename>XF86Config-4</filename>.</para>
</note>
</step>
<step>
<para> To use the Bijoy keyboard, the <quote>InputDevice</quote> section of
<filename>XF86Config</filename> needs editing. For RedHat it's a different file,
<filename>XF86Config-4</filename> (i.e. <filename>/etc/X11/XF86Config-4</filename>).
</para>
</step>
<step>
<para> The only use of TrueType was stated as low quality PDF creation
from <application>MS Word</application> files, for printing only. Unfortunately
<application> KWord </application> failed to open any <application>MS Word</application>
files in RedHat, let alone create PDFs. Don't know why. </para>
</step>
</procedure>
</sect1>
<sect1 id="unicode">
<title>PDF from Unicode</title>
<sect2 id="lekho">
<title>Lekho</title>
<para> <application>Lekho</application> is a simple text editor with the
capability to create Unicode encoded Bangla+English text files. It uses the
<quote>Adarshalipi</quote> family of TrueType fonts for showing Bangla
glyphs. If you have never used it then have a look at it's
<ulink url="http://lekho.sf.net/">website</ulink>. The website along with the
Lekho distribution contain enough docs to get someone start using Lekho.
</para>
<para>
The <quote>Adarshalipi</quote> fonts are quite similar to the Bijoy fonts and
so the Type1 conversion procedure is same as the Bijoy fonts. Using a Type1
Adarshalipi font, Lekho can produce PDFs from Unicode encoded Bangla text
files. Actually Lekho produces Postscript files which in turn is converted to
PDF using tools like <command>ps2pdf</command>. The next steps describe PDF
creation using Lekho, provided that a Type1 <quote>Adarshalipi</quote> font has
been installed already: </para>
<procedure>
<step>
<para>When editing is over, change the font size of both Bangla and
English fonts to 11. This is not mandatory but it keeps the format of the
Postscript file as near as it is seen in Lekho. </para>
</step>
<step>
<para>Click the <guibutton>PRINT FILE</guibutton> button and select
<guilabel>PRINT TO FILE</guilabel>. Write a name for the soon to be created
Postscript file and click <guibutton>OK</guibutton>. </para>
</step>
<step>
<para>Use a tool like <command>ps2pdf</command> to convert the
Postscript file to PDF:
</para>
<screen>
<prompt> $</prompt><userinput> ps2pdf file.ps</userinput>
</screen>
</step>
</procedure>
<para>Lekho has another valuable feature - it can export a file to
<ulink url="http://tnp.saha.ernet.in/~pbpal/bangtex/bangtex.html">bangtex
</ulink>, the <application>Latex</application> macro package for
Bangla. So, the Latex users can eventually use this feature to create PDFs.
</para>
</sect2>
<sect2 id="bspeller">
<title>BSpeller</title>
<para>
<ulink url="http://www.bengalinux.org/projects/dictionary/bspeller.php">
BSpeller</ulink> is basically a Bangla spell checker. Besides, it is a light
weight text editor with the ability to print. Instead of TrueType or
Type1, BSpeller relies on OpenType fonts. So it requires GTK+ 2.0 (or later) to
render Bangla glyphs. As it is still a beta software, it's output is somewhat
shaky.</para>
</sect2>
</sect1>
<sect1 id="other">
<title>Other Resources</title>
<sect2 id="tools">
<title>Useful tools</title>
<para> The following is a list of programs that may be useful for
debugging any trouble regarding the fonts, keyboard or the PDFs. Their
usages are well documented in their respective man pages: </para>
<itemizedlist>
<listitem>
<para>
<command>xlsfonts</command>, lists the XLFDs of the all fonts available to X. </para>
</listitem>
<listitem>
<para>
<command>xfd</command>, shows all the glyphs of a font when available to X. </para>
</listitem>
<listitem>
<para>
<command>xset</command>, resets various X options like fontpath. </para>
</listitem>
<listitem>
<para>
<command>xev</command>, detects and shows various mouse and keypress events. </para>
</listitem>
<listitem>
<para>
<command>xkbcomp</command>, besides other operations, prints the current XKB configuration in a single file. </para>
</listitem>
<listitem>
<para>
<command>xpdf</command>, a PDF viewer. </para>
</listitem>
<listitem>
<para>
<command>pdffonts</command>, shows font list of a PDF file. </para>
</listitem>
<listitem>
<para>
<command>ps2pdf</command>, PostScript to PDF converter. </para>
</listitem>
</itemizedlist>
</sect2>
<sect2 id="links">
<title>Useful Links &amp; References</title>
<itemizedlist>
<listitem>
<para> A detailed description of XKB,
<ulink url="http://www.charvolant.org/~doug/xkb/"> www.charvolant.org/~doug/xkb/ </ulink>
</para>
</listitem>
<listitem>
<para> A one stop mall for Unicode based Bangla on Linux,
<ulink url="http://www.bengalinux.org"> www.bengalinux.org </ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://feenix.burgiss.net/ldp/fdu/index.html">The XFree86-De-uglification-Mini-HOWTO </ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.ibiblio.org/pub/Linux/docs/HOWTO/Font-HOWTO">Font-HOWTO </ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.xfree86.org/current/fonts1.html"> Fonts in XFree86</ulink>,
also supplied with the XFree86 documentation as <filename>README.fonts</filename>
and normally found inside <filename>/usr/X11R6/lib/X11/doc/</filename>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.bengalinux.org/howto/">Bangla Localisation
HOWTO</ulink>, a good starting point for using Unicode based Bangla. </para>
</listitem>
</itemizedlist>
</sect2>
</sect1>
<sect1 id="acknowledgments">
<title>Acknowledgments</title>
<itemizedlist>
<listitem>
<para>
<othercredit>
<firstname>Jan</firstname>
<othername>Benedict</othername>
<surname>Glaw</surname>
</othercredit>
(jbglaw AT lug-owl.de), for advocating Bangla in spite of being
non-Bangali. </para>
</listitem>
<listitem>
<para>
<othercredit>
<othername>Shishir</othername>
</othercredit>
Bhai (shishir_faruk AT yahoo.com) +
<othercredit>
<othername>Dolon</othername>
</othercredit>
(mrk_ju AT yahoo.com) &amp;Co, for the inspiration. </para>
</listitem>
<listitem>
<para>
<othercredit>
<firstname>Mojahed</firstname>
</othercredit>
Bhai (mojahed AT agni.com), for being the Guinea pig ;-) </para>
</listitem>
<listitem>
<para>
<othercredit>
<firstname>Sergey</firstname>
<surname>Babkin</surname>
</othercredit>
(babkin AT bellatlantic.net),
the ultimate Type1 guy. </para>
</listitem>
<listitem>
<para> People at the Ankur (formerly Bengalinux) group, for working
towards the future. </para>
</listitem>
<listitem>
<para>
<othercredit>
<firstname>Tabatha</firstname>
<surname>Persad</surname>
</othercredit>
(tabatha AT merlinmonroe.com), for the review and valuable
changes. </para>
</listitem>
<listitem>
<para> To the Almighty, for this text wouldn't have been possible
without his (???) will. </para>
</listitem>
</itemizedlist>
</sect1>
</article>