A Á À Ã Ă Â E É È Ê I Í Ì Ĩ O Ó Ò Õ Ô Ơ U Ú Ù Ũ Ư Y Ý
Total Page:16
File Type:pdf, Size:1020Kb
Making Type 1 fonts for Vietnamese H`anThˆe´ Th`anh University of Education Ho Chi Minh City Vietnam [email protected] Abstract In this article I describe how I made the VNR fonts and converted them to Type 1 format. VNR is the Vietnamese version of the CMR fonts, written in METAFONT based on CMR and EC font sources. Conversion to Type 1 format was done based on the Type 1 version of CMR produced by Blue Sky, with the help of MetaFog, FMP, FontLab and a lot of hacking in VNR sources and Bash and Perl scripting. The result is a set of Type 1 fonts that is similar to the Blue Sky fonts, but also provide Vietnamese letters with the same quality of outlines and hints. Vietnamese letters and VNR fonts Diacritic mark Example Vietnamese is written with Latin letters and a few Vowel more accents in a system called breve băn khoăn Quốc Ngữ circumflex hôm nay horn Qui Nhơn (which can be translated to English as “national Tone language”) developed by the Portuguese mission- acute Lái Thiêu ary Alexander Rhodes. What separates Vietnamese grave Bình Dương from other languages typeset with Latin characters hook above Thủ Đức is that some letters in Vietnamese can have two ac- tilde dĩ vãng cents. The total number of accented letters in Viet- dot below học tập namese (including uppercase and lowercase letters) Consonant is 134. Table 1 lists all lowercase Vietnamese letters. stroke đã đời a á ạ à ả ã o ó ọ ò ỏ õ Table 2: List of all Vietnamese diacritic marks. ă ắ ặ ằ ẳ ẵ ô ố ộ ồ ổ ỗ â ấ ậ ầ ẩ ẫ ơ ớ ợ ờ ở ỡ FONT files which compose the Vietnamese letters from English letters in CMR sources and appropriate e é ẹ è ẻ ẽ u ú ụ ù ủ ũ accents. There were several works on this topic prior to VNR. The best among them was the package ê ế ệ ề ể ễ ư ứ ự ừ ử ữ vncmr by Werner Lemberg, who also created some i í ị ì ỉ ĩ y ý ỵ ỳ ỷ ỹ basic macro support for typesetting Vietnamese in LATEX and plain TEX. đ As I learnt more about TEX and METAFONT, I set out to create new VNR fonts, as I was not en- tirely happy with the accent shapes and positioning Table 1: List of all Vietnamese lowercase letters. in previous packages. I borrowed many ideas from the vncmr package and other CMR-based fonts, like Vietnamese accents can be divided into three the Czech and Polish version of CMR fonts. It took kinds of diacritic marks: tone, vowel and consonant. about 2 years until the first version was released and Table 2 shows them all with examples. used in practice. As Vietnamese letters are identical to Latin let- In the beginning I wrote VNR fonts based on ters, it is natural to write VNR as a set of META- CMR sources. Later, Werner Lemberg and Vladimir TUGboat, Volume 24 (2003), No. 1 — Proceedings of the 2003 Annual Meeting 79 H`anThˆe´ Th`anh Volovich convinced me that it would be better to Reuse is a good idea switch to EC sources instead of CMR sources. The The main idea of efficient generating Type 1 format two main reasons: for VNR fonts is simple: 1. it would be easier to include Vietnamese letters 1. Take the accents from METAFONT sources and in CM-Super fonts; convert them to Type 1 format; 2. it would fix some problems in VNR (mainly with 2. compose those accents and the English letters encoding and some missing glyphs). from Blue Sky fonts to get accented letters. Thus nothing is new; each step is just a reuse of So I changed VNR to be based on EC, which of course introduced new problems. The most notice- existing data. able is with naming: Should VNR fonts be named Use the right tool for each task with an EC-like naming convention (vnrm1000.mf) or a CMR-like naming convention (vnr10.mf)? In The two steps mentioned above can be done prop- the end I decided to support both, but the sources erly, given that we have the right tool for each. (and thus the glyph shapes) are EC-based. Why not Converting the accents to Type 1 format This drop one of them? Because: can be done very quickly using TEXtrace, or nearly 1. I wanted to support EC naming, so Vladimir perfectly using METAPOST and MetaFog. As I had could include Vietnamese letters in CM-Super; an evaluation copy of MetaFog and I wanted the result to be as good as possible, I chose the latter. 2. I wanted to support CMR naming, because I In this step, some glyphs that are needed in wanted to use the Type 1 version of CMR fonts. T5 (the Vietnamese TEX encoding) but are miss- Also, there are many packages which depend on ing in the Blue Sky fonts must also be converted. CMR-style names (such as Texinfo). The number of glyphs needed for each font is 47, of I would like to point out that I am not a type which 22 are Vietnamese accents and letters. Ta- designer and therefore the aesthetic aspect of Viet- ble 3 shows all the glyphs that need to be converted namese letters (regarding accent shapes and posi- to Type 1 format. The vl and vu prefixes stand for tioning) is open to discussion. What I have done “Vietnamese lowercase” resp. “Vietnamese upper- is heavily based on what I learnt from other Viet- case”. At the moment they look identical; however, namese fonts available to me, from the typography they may be changed. of other languages (mainly Czech and Polish), and Many of the additional glyphs are available in from comments from various people. It’s not to say the Blue Sky fonts already, but their availability is that I take no responsibility for VNR fonts. If some- not consistent. Each of the additional glyphs listed thing looks bad, it is of course my fault. here is missing at least in some Blue Sky font. To get rid of this headache, I chose to convert them all. 47 glyphs is quite a large number for each font, It’s good that I can use Vietnamese with as the total number of glyphs to be converted is T X, but I want PDF E 2585 (47×55). Fortunately, not all of them required PK fonts just look ugly in Acrobat Reader. So I manual correction, and the additional glyphs need to needed Type 1 fonts. My first attempt was to create be converted only once, given that EC sources will a set of virtual fonts for Vietnamese, which refer not be changed. So, if I change the VNR sources, to CMR fonts. Unfortunately, the output simply I will have to re-convert only those 22 Vietnamese doesn’t look good, as many needed accents are not accents and letters. available in CMR and must be substituted by some When MetaFog finished and we had the outlines other glyphs. of the needed glyphs, hints for accents were auto- I also tried to use TEXtrace to generate Type 1 generated using FontLab. versions of VNR fonts (using both EC and CMR nam- Several papers have been published on this topic ing). The result is useable, but the size is too large so I will not repeat it all here. (See References, Ed.) and the quality of auto-generated outlines and hints In short, using METAPOST and MetaFog gives cannot be compared to Blue Sky fonts. It seemed the best result, but a lot of manual work is required. a pity to me that I could not use the high-quality That’s one reason why I didn’t convert all Viet- outlines and hints of English letters in the Blue Sky namese glyphs but only those that are truly neces- fonts. So I looked for another method to convert sary. Why regenerate the English letters when they VNR fonts to Type 1 format. already exist in Blue Sky fonts at the high quality? 80 TUGboat, Volume 24 (2003), No. 1 — Proceedings of the 2003 Annual Meeting Making Type 1 fonts for Vietnamese Vietnamese place an accent over a letter exactly like the VNR accents and letters Additional glyphs sources do. The solution is simple: I added some hooks into VNR sources, so information about ac- dotbelow quotesinglbase cent positioning is written to a log file. Then I wrote hookabove guilsinglleft some Perl scripts to extract the data from the log vlgrave guilsinglright file and use them with the composite tool from FMP. vlacute quotedblleft What about the result? vlcircumflex quotedblright vltilde quotedblbase A rough comparison on average font size gave the vldotbelow guillemotleft following result: vlbreve guillemotright Blue Sky 25 KB vlhookabove endash Type 1 VNR (TEXtrace) 70 KB vugrave emdash Type 1 VNR (as described herein) 40 KB vuacute cwm Compactness is gained thanks to FMP, which vucircumflex zeroinferior puts all accents and English letters into subroutines vutilde uni2423 so they can be reused without duplication, as men- tioned above. vudotbelow quotedbl Regarding the quality of outlines and hints of vubreve dollar each accented letter: vuhookabove less • The base part has the the same outlines and Ohorn greater hints as in Blue Sky fonts; Uhorn backslash • the accent part has the outlines produced by ohorn asciicircum METAPOST (and MetaFog), with hints auto- uhorn underscore generated by FontLab.