While creating PDFs, KWord 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 ttf2pt1 package. This package has some useful programs to carry out the conversion properly. After downloading and uncompression, the ttf2pt1 package can be installed using the following commands:
$ make all $ make install
The last command needs to be executed as root. The README of ttf2pt1 has some better descriptions of these.
The following steps describe converting TrueType Bijoy fonts to Type1, suitable for PDF creation:
Instead of creating a Type1 font directly from sutom___.ttf (TrueType font file of SutonnyMJ font), create an interim file sutonnymj.t1a:
$ ttf2pt1 sutom___.ttf sutonnymj
Perform some correction to sutonnymj.t1a using forceiso, a PERL script supplied with the ttf2pt1 package, and create sutonnymj2.t1a:
$ cat sutonnymj.t1a | /usr/local/share/ttf2pt1/scripts/forceiso \ "U00%x" > sutonnymj2.t1a
This correction is needed because some glyphs of Bijoy fonts have no name. forceiso solves this problem by assigning proper names to those otherwise nameless glyphs.
Finally, create the Type1 version of SutonnyMJ from sutonnymj2.t1a using t1asm, another program supplied with the ttf2pt1 package:
$ cat sutonnymj2.t1a | /usr/local/libexec/ttf2pt1/t1asm \ > sutonnymj.pfa
The last two steps can also be done in one go:
$ cat sutonnymj.t1a | /usr/local/share/ttf2pt1/scripts/forceiso \ "U00%x" | /usr/local/libexec/ttf2pt1/t1asm > sutonnymj.pfa
The final product, in this case sutonnymj.pfa, is the actual Type1 font file. The first step also produces sutonnymj.afm which can be ignored through the rest of the text.
There are some programs that automate font installation, such as type1inst for Type1, ttmkfdir 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 fonts.scale file. If any of the font installing programs were used, mkfontdir must be executed after editing font.scale by hand. For Type1 fonts, the encoding is "adobe-fontspecific" and not "iso8859-1." For TrueType fonts, the encoding is "apple-roman" and not "iso8859-1". Besides, anti-aliasing must be stopped for these TrueType fonts to show up.
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.
The following steps describe manual installation of Type1 fonts:
Create a new directory, /usr/local/share/fonts/type1/bijoy/, and copy the Type1 font there:
$ mkdir -p /usr/local/share/fonts/type1/bijoy/ $ cp sutonnymj.pfa /usr/local/share/fonts/type1/bijoy/
Create fonts.scale and place it inside /usr/local/share/fonts/type1/bijoy/. fonts.scale's creation process will be described later in Section 2.2.2.
Create another file fonts.dir using mkfontdir:
$ cd /usr/local/share/fonts/type1/bijoy/ $ mkfontdir
If the fonts.scale was created correctly then fonts.dir will be created, otherwise some error messages will appear after executing mkfontdir.
Open XF86Config and add /usr/local/share/fonts/type1/bijoy/ as a new fontpath in the "Files" section:
The XF86Config file is generally found inside /etc/X11/. If it's not present there then use find to get the path:
$ find / -name XF86Config
Restart X server by pressing Ctrl+Alt+Bksp. The font will be installed.
Check whether the font has really been installed by using xlsfonts. This program shows the XLFD of every font that is available to the X server. grep can be used to find the desired font from xlsfonts' output:
$ xlsfonts | grep sutonnymj
If "sutonnymj" is unavailable to X then grep will give no output. Otherwise the output will be the XLFD of "sutonnymj":
If more than one font were installed then grep altsys will show them all (if present in xlsfonts' output).
The fonts.scale file contains various information about the fonts in a directory where that fonts.scale itself is placed. This means every directory which has any font file can have its own fonts.scale (non-scalable fonts like Bitmap fonts do not need a fonts.scale file). The information that every line of a fonts.scale contains (preceded by the name of the font file itself) is called XLFD (X Logical Font Definition). An example line from a fonts.scale file is:
The only difference is the very first line of fonts.scale, which has only a number instead of the usual font-file name followed by the corresponding XLFD. This number is the total number of XLFDs listed in that fonts.scale file.
The structure of a fonts.scale is like this:
Line 1: Total number of XLFD Line 2: FontFileName1 XLFD Line 3: FontFileName2 XLFD .... .... ....
The following is a suitable XLFD for Type1 Bijoy fonts:
Please note that in the above string, "SutonnyMJ" is the actual fontname. This name needs to be changed accordingly for other fonts.
An example fonts.scale 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):
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
It's better not to press Return 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 mkfontdir. If fonts.scale is not created properly, the mkfontdir command will give error message. Otherwise fonts.dir will be created.
The "adobe-fontspecific" substring found at the end of every XLFD for Type1 Bijoy fonts is the encoding of that font. If "iso8859-1" encoding is required, this can be done too by creating another file fonts.alias. Every line of fonts.alias contains two XLFDs. The first XLFD is the alias and the second one is the original. Unlike fonts.scale and fonts.dir, there is no number at the first line of fonts.alias. An example fonts.alias's structure looks like this:
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
Generally, some subdirectories under /usr/X11R6/lib/X11/fonts/ contain many font files and some fonts.scale, fonts.dir and fonts.alias 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 fonts.scale and fonts.dir are same but both are still needed.
The Bijoy font's TrueType installation method is quite similar to that of Type1. Just keep a separate directory for the fonts, like,
and change the XLFD to:
In the example, the font encoding is "apple-roman" instead of "adobe-fontspecific." Also to use these fonts anti-aliasing must be stopped, and this is where "Xft" comes into business.In your $HOME directory, create a hidden file ~/.xftconfig and write the following lines in it ( the file may be already present, in that case just add these lines):
dir "/usr/local/share/fonts/ttfonts/bijoy/" match any family == "sutonnymj" edit antialias = false; encoding = "apple-roman";
The match any family == "sutonnymj" and the next line prevents anti-aliasing for sutonnymj only. If there are other Bijoy fonts in use, more similar lines must be added.
The presence of only ~/.xftconfig is enough to make a TrueType font available to KWord. There is no need to create fonts.scale and fonts.dir. Even the fontpath needs not be added in XF86Config. So these steps can be skipped if wished.
Newer systems(like RH 8.0) use Xft 2.0 instead of Xft 1.0 . Xft 2.0 doesn't use ~/xftconfig. Instead it uses ~/.fonts . This file can be modified by fontconfig . Here also, "antialias" must be stopped and "encoding" remains "apple-roman" .
KWord 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 MS Word (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 MS Word 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.
To open an MS Word file in KWord , the encoding of the relevant font(s) should be changed from "apple-roman" to "iso8859-1" in the ~/.xftconfig, for example:
match any family == "sutonnymj" edit antialias = false; encoding = "apple-roman";
match any family == "sutonnymj" edit antialias = false; encoding = "iso8859-1";
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 "Files" section of XF68Config. The relevant entries for the font in ~/.xftconfig must also be commented out. In both cases, a "#" as the first character on any line comments out the whole line. Given below is an example ~/.xftconfig, where entry for a font has been commented out:
# dir "/usr/local/share/fonts/ttfonts/" # match any family == "sutonnymj" # edit antialias = false; encoding = "apple-roman";
If Xft 2.0 is in use then similar measures must be taken using fontconfig.
Закладки на сайте
Проследить за страницей
Created 1996-2020 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру