Thomas Piekenbrock
Mike Fabian wrote:
Correct vertical variants of punctuation characters are used by CJK-LaTeX if the font used has a GSUB table for vertical context.
The free Japanese Kochi TrueType fonts have such a table, therefore it works perfectly with the Kochi fonts.
You can check whether such a GSUB table is available with 'ftdump':
ftdump /usr/X11R6/lib/X11/fonts/truetype/kochi-mincho.ttf
Thank you for this advice. (for other fonts I will continue with my hack of CJK with "rotate" inside)
Whether fonts can be converted to pfb or not doesn't depend on whether they are Big5 fonts or not.
All CJK TrueType fonts distributed with SuSE Linux can be easily converted to .pfb and used with CJK-LaTeX.
Which conversion programme are you calling here? Is it ttf2pfb, or ttf2pt1?
'ttf2pt1' is used by '/usr/sbin/cjk-latex-config --type1'.
Are the resulting pfb files in Unicode (up to 255 pfb files per font) or GB / Big5 / JIS?
As you like. Whatever is written in /etc/ttf2pk/ttfonts.map is generated. For example, for the free Japanese TrueType fonts Kochi Mincho and Kochi Gothic I have the following entries in /etc/ttf2pk/ttfonts.map: kochimin@UJIS@ kochi-mincho.ttf kochimins@UJIS@ kochi-mincho.ttf Slant=0.167 kochiminr@UJIS@ kochi-mincho.ttf Rotate=Yes kochiminrs@UJIS@ kochi-mincho.ttf Slant=0.167 Rotate=Yes kochigo@UJIS@ kochi-gothic.ttf kochigos@UJIS@ kochi-gothic.ttf Slant=0.167 kochigor@UJIS@ kochi-gothic.ttf Rotate=Yes kochigors@UJIS@ kochi-gothic.ttf Slant=0.167 Rotate=Yes kochimin-uni@Unicode@ kochi-mincho.ttf kochimins-uni@Unicode@ kochi-mincho.ttf Slant=0.167 kochiminr-uni@Unicode@ kochi-mincho.ttf Rotate=Yes kochiminrs-uni@Unicode@ kochi-mincho.ttf Slant=0.167 Rotate=Yes kochigo-uni@Unicode@ kochi-gothic.ttf kochigos-uni@Unicode@ kochi-gothic.ttf Slant=0.167 kochigor-uni@Unicode@ kochi-gothic.ttf Rotate=Yes kochigors-uni@Unicode@ kochi-gothic.ttf Slant=0.167 Rotate=Yes Then, '/usr/sbin/cjk-latex-config --type1' will generate the following .pfb fonts: /usr/share/texmf/fonts/type1/cjk-latex/UJIS/kochigo/kochigo01.pfb [...] kochigo35.pfb /usr/share/texmf/fonts/type1/cjk-latex/UJIS/kochigo/kochimin01.pfb [...] kochimin35.pfb /usr/share/texmf/fonts/type1/cjk-latex/Unicode/kochigo-uni/kochigo-uni00.pfb [...] kochigo-uniff.pfb /usr/share/texmf/fonts/type1/cjk-latex/Unicode/kochimin-uni/kochimin-uni00.pfb [...] kochimin-uniff.pfb I.e. it will generate 255 .pfb files for the Unicode encoding and fewer for GB, Big5, JIS. Note that no .pfb files are created for the slanted and no rotated variants. I.e. you cannot use .pfb files for slanted or vertical text. That is because ttf2pt1 currently doesn't support slanting and rotating. As soon as it supported by ttf2pt1, I'll add that.
What about cyberbit.ttf?
For cyberbit.ttf, /etc/ttf2pk/ttfonts.map currently contains: cyberb@Unicode@ cyberbit.ttf cyberbs@Unicode@ cyberbit.ttf Slant=0.167 cyberbr@Unicode@ cyberbit.ttf Rotate=Yes cyberbrs@Unicode@ cyberbit.ttf Rotate=Yes Slant=0.167 I.e. currently it will only generate Unicode for cyberbit.ttf.
Does it generate all of Unicode, GB, Big5, and JIS automatically? Or which programme do I have to call to do all that manually, using which options?
If you are using cyberbit.ttf in Big5, you need to have entries in /etc/ttf2pk/ttfonts.map referencing cyberbit.ttf in Big5, for example cyberb-big5@UBig5@ cyberbit.ttf cyberbs-big5@UBig5@ cyberbit.ttf Slant=0.167 cyberbr-big5@UBig5@ cyberbit.ttf Rotate=Yes cyberbrs-big5@UBig5@ cyberbit.ttf Rotate=Yes Slant=0.167 and some .fd files like /usr/share/texmf/tex/latex/CJK/Bg5/c00????.fd which declare font families using the font file names cyberb-big5, cyberbs-big5, cyberbr-big5, cyberbrs-big5. If you are already using cyberbit in Big5 as .pk fonts, you must already have all that, otherwise if wouldn't yet work for the .pk fonts. Then just call '/usr/sbin/cjk-latex-config --type1' and .pfb fonts matching your entries in /etc/ttf2pk/ttfonts.map will be generated, i.e. in case of the above example, /usr/share/texmf/fonts/type1/cjk-latex/UBig5/cyberb-big5/cyberb-big501.pfb [...] cyberb-big558.pfb will be generated. If you are already using some fonts as .pk fonts, you only need to call /usr/sbin/cjk-latex-config --type1 then the matching .pfb fonts will be generated, a map-file /var/lib/texmf/dvips/config/cjk-latex.map will be generated and entries to use that map-file will be automatically added to /var/lib/texmf/pdftex/config/pdftex.cfg /var/lib/texmf/dvips/config/config.ps I.e. if you are already using fonts as .pk fonts, just call /usr/sbin/cjk-latex-config --type1 and from then on you can use the fonts as .pfb fonts. That's easy, isn't it? This feature exists since SuSE Linux 8.0, but I didn't yet find time to document it properly.
(When I looked into this last time, ttf2pfb could not do unicode->JIS or unicode->Big5 conversion, and ttf2pt1 had only some support for Chinese and none for Japanese.
Actually ttf2pt1 doesn't really care whether Japanese or Chinese fonts are used. It just generates .pfb files containing glyphs according to glyph-lists in map-files like /usr/share/ttf2pt1/maps/cubig5.map it's true that ttf2pt1 only comes with map-files for Chinese, but that doesn't matter, I don't use the map-files distributed with ttf2pt1 anyway. What one really wants to use are the map-files distributed with ttf2tfm, like /usr/share/texmf/ttf2tfm/UBig5.sfd because these are used to create the .tfm and the .pk files. And you want your generated .pfb files contain exactly the same glyphs as those in the respective .tfm and .pk files. Otherwise you would get wrong glyphs when using the .pfb files. I.e. I need to make ttf2pt1 use the .sfd files from ttf2tfm. Unfortunately ttf2pt1 expects .map files in a slightly different format than the .sfd files from ttf2tfm. Very similar, but a little bit different. Therefore, my /usr/sbin/cjk-latex-config creates temporary .map files from the .sdf files and feeds these into ttf2pt1.
The vast majority of my fonts are free and non-free Chinese Big5, but also several non-free Japanese JIS and some Japanese Unicode based ones. The Kochi fonts are good, but I still like to have "kaisho" and "reisho" as well as some brush type "gyosho".
With the SuSE CJK-LaTeX package, just try
/usr/sbin/cjk-latex-config --type1
and you should be able to use most of your fonts as .pfb.
That should save a lot of work compared to doing the conversion
manually.
ttf2pt1 can handle some fonts only with smoothing of outlines disabled
and cannot handle some fonts at all. Probably this indicates that
there is something broken in the fonts. My /usr/sbin/cjk-latex-config
script contains exeptions for such fonts, for example if it
detects wadalab-gothic.ttf and watanabe-mincho.ttf it skips them
if (grep(/$tt_basename/,("wadalab-gothic.ttf","watanabe-mincho.ttf"))) {
print "$tt_basename does not work with ttf2pt1, skipping ...\n";
return 0;
}
these two fonts are very broken. And it disables outline smoothing for
Kochi Gothic, otherwise ttf2pt1 would segfault when processing
Kochi Gothic:
if (grep(/$tt_basename/,("kochi-gothic.ttf"))) {
print "$tt_basename broken, disabling smoothing of outlines.\n";
$smoothing_opt = " -O s ";
}
If you have broken fonts, you may need to make these exeption lists a
bit longer, or uncomment the bad fonts in /etc/ttf2pk/ttfonts.map
before running
/usr/sbin/cjk-latex-config --type1
But for good fonts you should not need to do anything.
I would appreciate if you test my automated type1 generation for
CJK-LaTeX a bit.
Suggestions for improvements are very welcome.
--
Mike Fabian