TTF2TFM(1) TTF2TFM(1) NAME ttf2tfm−buildTeXmetricfilesfromaTrueTypefont SYNOPSIS ttf2tfmttffile[.ttf|.ttc][-ccaps-height-factor][-eextension-factor][-Eencoding-id][-ffont-index] [-l][-n][-N][-O][-pinencfile[.enc]][-Pplatform-id][-q] [-rold-glyphnamenew-glyphname][-Rreplacement-file[.rpl]][-sslant-factor] [-toutencfile[.enc]][-Tinoutencfile[.enc]][-u][-vvplfile[.vpl]][-Vscvplfile[.vpl]][-x] [-yvertical-shift-factor][tfmfile[.tfm]] ttf2tfm--version|--help DESCRIPTION ThisprogramextractsthemetricandkerninginformationofaTrueTypefontandconvertsitinto metricfilesusablebyTEX(quitesimilartoafm2tfmwhichispartofthedvipspackage;please consultitsinfofilesformoredetailsonthevariousparameters(especiallyencodingfiles). SinceaTrueTypefontoftencontainsmorethan256glyphs,somemeansarenecessarytomapa subsetoftheTrueTypeglyphsintoaTEXfont.Todothis,twomappingtablesareneeded:the first(called‘input’or‘raw’encoding)mapstheTrueTypefonttoarawTEXfont(thismapping tableisusedbybothttf2tfmandttf2pk),andthesecond(called‘output’or‘virtual’encoding) mapstherawTEXfonttoanother(virtual)TEXfont,providingallkerningandligatureinformationneededbyTEX. ThistwostagemappinghastheadvantagethatonerawfontcanbeaccessedwithvariousTEX encodings(e.g.T1andOT1)viathevirtualfontmechanism,andjustonePKfileisnecessary. ForCJKV(Chinese/Japanese/Korean/oldVietnamese)fonts,adifferentmechanismisprovided (seeSUBFONTDEFINITIONFILESbelow). PARAMETERS Mostofthecommandlineswitchnamesarethesameasinafm2tfmforconvenience.Oneor morespacecharactersbetweenanoptionanditsvalueismandatory;optionscan’tbeconcatenated.Forhistoricalreasons,thefirstparametercannotbeaswitchbutmustbethefontname. -ccaps-height-factor Theheightofsmallcapsmadewiththe-Vswitch.Defaultvalueofthisrealnumber is0.8timestheheightofuppercaseglyphs.Willbeignoredinsubfontmode. -eextension-factor Theextensionfactortostretchthecharactershorizontally.Defaultvalueofthisreal numberis1.0;iflessthan1.0,yougetacondensedfont. -Eencoding-id TheTrueTypeencodingID.Defaultvalueofthisnon-negativeintegeris1.Willbeig-noredif-Nisused. -ffont-index ThefontindexinaTrueTypeCollection.Defaultisthefirstfont(index0).WillbeignoredforordinaryTrueTypefonts.[TrueTypecollectionsareusuallyfoundinsomeCJK fonts;e.g.thefirstfontindexspecifiesglyphsandmetricsforhorizontalwriting,andthe secondfontindexdoesthesameforverticalwriting.TrueTypecollectionsusuallyhave theextension‘.ttc’.] -lCreateligaturesinsubfontsbetweenfirstandsecondbytesofalltheoriginalcharacter codes.Example:Charactercode0xABCDmapstocharacterposition123insubfont45. Thenaligatureinsubfont45betweenposition0xABand0xCDpointingtocharacter123 willbeproduced.ThefontsoftheKoreanHLATEXpackageusethisfeature.Willbeignoredifnotinsubfontmode. -nUsePSnames(ofglyphs)oftheTrueTypefont.Willbeignoredinsubfontmode.Only glyphswithavalidentryintheselectedcmapareused. FreeTypeversion1.4 01-Mar-2000 1 TTF2TFM(1) TTF2TFM(1) -NUseonlyPSnamesoftheTrueTypefont.Nocmapisused,thustheswitches-Eand-P havenoeffect,causingawarningmessage.Willbeignoredinsubfontmode. -OUseoctalvaluesforallcharactercodesintheVPLfileratherthannames;thisisusefulfor symbolorCJKfontswherecharacternamessuchas‘A’aremeaningless. -pinencfile TheinputencodingfilenamefortheTTF→rawTEXmapping.Thisparameterhastobe specifiedinttfonts.mapforsuccessivettf2pkcalls.Willbeignoredinsubfontmode. -Pplatform-id TheTrueTypeplatformID.Defaultvalueofthisnon-negativeintegeris3.Willbeig-noredif-Nisused. -qMakettf2tfmquiet.Itsuppressesanyinformationaloutputexceptwarninganderror messages.ForCJKfonts,theoutputcangetquitelargeifyoudon’tspecifythisswitch. -rold-glyphnamenew-glyphname Replacesold-glyphnamewithnew-glyphname.Thisswitchisusefulifyouwanttogivean unnamedglyph(i.e.,aglyphwhichcanberepresentedwith‘.gXXX’or‘.cXXX’only)a nameorifyouwanttorenameanalreadyexistingglyphname.Youcan’tusethe ‘.gXXX’or‘.cXXX’glyphnameconstructsfornew-glyphname;multipleoccurrencesof-r arepossible.Ifinsubfontmodeorifnoencodingfileisspecified,thisswitchisignored. -Rreplacement-file Usethisswitchifyouhavemanyreplacementpairs;theycanbecollectedinafilewhich shouldhave‘.rpl’asextension.Thesyntaxusedinsuchreplacementfilesissimple: Eachnon-emptylinemustcontainapair‘old-glyphnamenew-glyphname’separatedby whitespace(withoutthequotationmarks).Apercentsignstartsalinecomment;youcan continuealineonthenextlinewithabackslashasthelastcharacter.Ifinsubfontmode orifnoencodingfileisspecified,thisswitchisignored. -sslant-factor Theobliquenessfactortoslantthefont,usuallymuchsmallerthan1.Defaultofthisreal numberis0.0;ifthevalueislargerthanzero,thecharactersslopetotheright,otherwise totheleft. -toutencfile Theoutputencodingfilenameforthevirtualfont(s).OnlycharactersintherawTEX fontareused.Willbeignoredinsubfontmode. -Tinoutencfile Thisisequivalentto‘-pinoutencfile-tinoutencfile’.Willbeignoredinsubfontmode. -uUseonlythosecharactersspecifiedintheoutputencoding,andnoothers.Bydefault, ttf2tfmtriestoincludeallcharactersinthevirtualfont,eventhosenotpresentinthe encodingforthevirtualfont(itputsthemintootherwise-unusedpositions,ratherarbi-trarily).Willbeignoredinsubfontmode. -vvplfile OutputaVPLfileinadditiontotheTFMfile.Ifnooutputencodingfileisspecified, ttf2tfmusesadefaultfontencoding(cmtt10).Willbeignoredinsubfontmode.Note: Becarefultousedifferentnamesforthevirtualfontandtherawfont! -Vscvplfile Sameas-v,butthevirtualfontgeneratedisapseudosmallcapsfontobtainedbyscaling uppercaselettersby0.8(resp.thevaluespecifiedwith-c)totypesetlowercase.Thisfont handlesaccentedlettersandretainsproperkerning.Willbeignoredinsubfontmode. -xRotateallglyphsby90degreescounter-clockwise.Ifno-yparameterisgiven,therotat-edglyphsareshifteddownverticallyby0.25em.Willbeignoredifnotinsubfontmode. FreeTypeversion1.4 01-Mar-2000 2 TTF2TFM(1) TTF2TFM(1) -yvertical-shift-factor Shiftdownrotatedglyphsbythegivenamount(theunitisem).Ignoredifnotinsubfont modeorglyphsarenotrotated. --version Showsthecurrentversionofttf2tfmandtheusedfilesearchlibrary(e.g.kpathsea). --helpShowsusageinformation. IfnoTFMfilenameisgiven,thenameoftheTTFfileisused,includingthefullpathandreplacing theextensionwith‘.tfm’. CMAPS ContrarytoType1PostScriptfonts(butsimilartothenewCIDPostScriptfontformat),most TrueTypefontshavemorethanonenativemappingtable,alsocalled‘cmap’,whichmapsthe(internal)TTFglyphindicestothe(external)TTFcharactercodes.CommonexamplesareamappingtabletoUnicodeencodedcharacterpositions,andthestandardMacintoshmapping. TospecifyaTrueTypemappingtable,usetheoptions-Pand-E.With-Pyouspecifytheplat-formID;definedvaluesare: platform platformID(pid) AppleUnicode 0 Macintosh 1 ISO 2 Microsoft 3 TheencodingIDdependsontheplatform.Forpid=0,weignorethe-Eparameter(settingitto zero)sincethemappingtableisalwaysUnicodeversion2.0.Forpid=1,thefollowingtablelists thedefinedvalues: platformID=1 script encodingID(eid) Roman 0 Japanese 1 Chinese 2 Korean 3 Arabic 4 Hebrew 5 Greek 6 Russian 7 RomanSymbol 8 Devanagari 9 Gurmukhi 10 Gujarati 11 Oriya 12 Bengali 13 Tamil 14 Telugu 15 Kannada 16 Malayalam 17 Sinhalese 18 Burmese 19 Khmer 20 Thai 21 Laotian 22 FreeTypeversion1.4 01-Mar-2000 3 TTF2TFM(1) TTF2TFM(1) Georgian 23 Armenian 24 Maldivian 25 Tibetan 26 Mongolian 27 Geez 28 Slavic 29 Vietnamese 30 Sindhi 31 Uninterpreted 32 HerearetheISOencodingIDs: platformID=2 encoding encodingID(eid) ASCII 0 ISO10646 1 ISO8859-1 2 Andfinally,theMicrosoftencodingIDs: platformID=3 encoding encodingID(eid) Symbol 0 Unicode2.0 1 ShiftJIS 2 GB2312(1980) 3 Big5 4 KSC5601(Wansung) 5 KSC5601(Johab) 6 Theprogramwillabortifyouspecifyaninvalidplatform/encodingIDpair.Itwillthenshowthe possiblepid/eidpairs.Pleasenotethatmostfontshaveatmosttwoorthreecmaps,usuallycorrespondingtothepid/eidpairs(1,0),(3,0),or(3,1)incaseofLatinbasedfonts.ValidMicrosoft fontsshouldhavea(3,1)mappingtable,butsomefontsexist(mostlyAsianfonts)whichhavea (3,1)cmapnotencodedinUnicode.Thereasonforthisstrangebehavioristhefactthatsome MSWindowsversionswillrejectfontshavinganon-(3,1)cmap(sinceallnon-UnicodeMicrosoft encodingIDsareforAsianMSWindowsversions). The-Pand-Eoptionsofttf2tfmmustbeequallyspecifiedforttf2pk;thecorrespondingpa-rametersinttfonts.mapare‘Pid’and‘Eid’,respectively. Thedefaultpid/eidpairis(3,1). Similarly,an-foptionmustbespecifiedas‘Fontindex’parameterinttfonts.map. Ifyouusethe-Nswitch,allcmapsareignored,usingonlythePostScriptnamesintheTrueType font.Thecorrespondingoptioninttfonts.mapis‘PS=Only’.Ifyouusethe-nswitch,thede-faultglyphnamesbuiltintottf2tfmarereplacedwiththePSglyphnamesfoundinthefont.In manycasesthisisnotwhatyouwantbecausetheglyphnamesinthefontareoftenincorrector non-standard.Thecorrespondingoptioninttfonts.mapis‘PS=Yes’. Singlereplacementglyphnamesspecifiedwith-rmustbegivendirectlyas‘old-glyphname=new-glyphname’;-Risequivalenttothe‘Replacement’option. FreeTypeversion1.4 01-Mar-2000 4 TTF2TFM(1) TTF2TFM(1) INPUTANDOUTPUTENCODINGS YoumustspecifytheencodingvectorsfromtheTrueTypefonttotherawTEXfontandfromthe rawTEXfonttothevirtualTEXfontexactlyaswithafm2tfm,butyouhavemorepossibilitiesto addressthecharactercodes.[With‘encodingvector’amappingtablewith256entriesinformof aPostScriptvectorismeant;seethefileT1-WGL4.encofthispackageforanexample.]With afm2tfm,youmustaccesseachglyphwithitsAdobeglyphname,e.g.‘/quotedsingle’or ‘/Acircumflex’.Thishasbeenextendedwithttf2tfm;nowyoucan(andsometimesmust)access thecodepointsand/orglyphsdirectly,usingthefollowingsyntaxforspecifyingthecharacterpositionindecimal,octal,orhexadecimalnotation:‘/.c<decimal-number>’,‘/.c0<octal-number>’, or‘/.c0x<hexadecimal-number>’.Examples:‘/.c72’,‘/.c0646’,‘/.c0x48’.Toaccessaglyphindex directly,usingthecharacter‘g’insteadof‘c’inthejustintroducednotation.Example:‘/.g0x32’. [Note:The‘.cXXX’notationmakesnosenseif-Nisused.] Forpid/eidpairs(1,0)and(3,1),bothttf2tfmandttf2pkrecognizebuilt-indefaultAdobeglyph names;theformerfollowsthenamesgiveninAppendixEofthebook‘InsideMacintosh’, volume6,thelatterusesthenamesgivenintheTrueTypeSpecification(WGL4,aUnicodesubset).NotethatAdobenamesforagivenglyphareoftennotuniqueanddosometimesdiffer,e.g., manyPSfontshavetheglyph‘mu’,whereasthisglyphiscalled‘mu1’intheWGL4characterset todistinguishitfromtherealGreeklettermu.BealsoawarethatOpenType(i.e.TrueType2.0) fontsuseanupdatedWGL4table;weusethedatafromthelatestpublishedTrueTypespecification(1.66).Youcanfindthosemappingtablesinthesourcecodefilettfenc.c. Ontheotherhand,theswitches-nand-Nmakesttf2tfmreadinandusethePostScriptnames intheTrueTypefontitself(storedinthe‘post’table)insteadofthedefaultAdobeglyphnames. Usethe-rswitchtoremapsingleglyphnamesand-Rtospecifyafilecontainingreplacement glyphnamepairs. Ifyoudon’tselectaninputencoding,thefirst256glyphsoftheTrueTypefontwithavalidentry intheselectedcmapwillbemappedtotheTEXrawfont(withoutthe-qoption,ttf2tfmprints thismappingtabletostandardoutput),followedbyallglyphsnotyetaddressedintheselected cmap.However,somecodepointsforthe(1,0)pid/eidpairareomittedsincetheydonotrepresentglyphsusefulforTEX:0x00(null),0x08(backspace),0x09(horizontaltabulation),0x0d(carriagereturn),and0x1d(groupseparator).The‘invalidcharacter’withglyphindex0willbe omittedtoo. Ifyouselectthe-Nswitch,thefirst256glyphsoftheTrueTypefontwithavalidPostScript namewillbeusedincasenoinputencodingisspecified.Again,someglyphsareomitted:‘.notdef’,‘.null’,and‘nonmarkingreturn’. Ifyoudon’tselectanoutputencoding,ttf2tfmusesthesamemappingtableasafm2tfmwould use(youcanfinditinthesourcecodefiletexenc.c);itcorrespondstoTEXtypewritertext.Unusedpositions(eithercausedbyemptycodepointsinthemappingtableormissingglyphsinthe TrueTypefont)willbefilled(ratherarbitrarily)withcharacterspresentintheinputencodingbut notspecifiedintheoutputencoding(withoutthe-qoptionttf2tfmprintsthefinaloutputen-codingtostandardoutput).Usethe-uoptionifyouwantonlyglyphsinthevirtualfontwhich aredefinedintheoutputencodingfile,andnothingmore. Onefeaturemissinginafm2tfmhasbeenaddedwhichisneededbytheT1encoding:ttf2tfm willconstructtheglyph‘Germandbls’(bysimplyconcatenatingto‘S’glyphs)evenfornormal fontsifpossible.Itappearsintheglyphlistasthelastitem,markedwithanasterisk.Sincethis isn’tarealglyphitwillbeavailableonlyinthevirtualfont. Forbothinputandoutputencoding,anemptycodepositionisrepresentedbytheglyphname ‘/.notdef’. Inencodingfiles,youcanuse‘\’asthefinalcharacterofalinetoindicatethattheinputiscontinuedonthenextline.Thebackslashandthefollowingnewlinecharacterwillberemoved. FreeTypeversion1.4 01-Mar-2000 5 TTF2TFM(1) TTF2TFM(1) SUBFONTDEFINITIONFILES CJKV(Chinese/Japanese/Korean/oldVietnamese)fontsusuallycontainseveralthousandglyphs; tousethemwithTEXitisnecessarytosplitsuchlargefontsintosubfonts.Subfontdefinition files(usuallyhavingtheextension‘.sfd’)areasimplemeanstodothissmoothly. Asubfontfilenameusuallyconsistsofaprefix,asubfontinfix,andapostfix(whichisemptyin mostcases),e.g. ntukai23→prefix:ntukai,infix:23,postfix:(empty) HerethesyntaxofalineinanSFDfile,describingonesubfont: <whitespace><infix><whitespace><ranges><whitespace> <infix>:= anythingexceptwhitespace.It’sbesttouseonlyalphanumericalcharacters. <whitespace>:= space,formfeed,carriagereturn,horizontalandverticaltabs--nonewlinecharacters. <ranges>:= <ranges><whitespace><codepoint>| <ranges><whitespace><range>| <ranges><whitespace><offset><whitespace><range> <codepoint>:= <number> <range>:= <number>‘’<number> <offset>:= <number>‘:’ <number>:= hexadecimal(prefix‘0x’),decimal,oroctal(prefix‘0’) Alinecanbecontinuedonthenextlinewithabackslashendingtheline.Therangesmustnot overlap;offsetshavetobeintherange0-255. Example: Theline

0310:0x23490x2345_0x2347

assignstothecodepositions10,11,12,and13ofthesubfonthavingtheinfix‘03’thecharactercodes0x2349,0x2345,0x2346,and0x2347respectively. TheSFDfilesinthedistributionarecustomizedfortheCJKpackageforLATEX. YouhavetoembedtheSFDfilenameintotheTFMfontname(attheplacewheretheinfixwillappear)surroundedbytwo‘@’signs,onthecommandlineresp.thettfonts.mapfile;bothttf2tfm andttf2pkswitchthentosubfontmode. Subfontmodedisablestheoptions-n,-N,-p,-r,-R,-t,-T,-u,-v,and-Vforttf2tfm;similar-ly,no‘Encoding’or‘Replacement’parameterisallowedinttfonts.map.Singlereplacement glyphnamesareignoredtoo. ttf2tfmwillcreateallsubfontTFMfilesspecifiedintheSFDfiles(providedthesubfontcontains glyphs)inonerun. Example: Thecall

ttf2tfmntukai.ttfntukai@/usr/local/lib/ttf2tfm/Big5@

FreeTypeversion1.4 01-Mar-2000 6 TTF2TFM(1) TTF2TFM(1)

willuse/usr/local/lib/ttf2tfm/Big5.sfd,producingallsubfontfilesntukai01.tfm,
ntukai02.tfm,etc.

RETURNVALUE ttf2tfmreturns0onsuccessand1onerror;warninganderrormessagesarewrittentostandard error. SOMENOTESONFILESEARCHING Bothttf2pkandttf2tfmuseeitherthekpathsea,emtexdir,orMiKTeXlibraryforsearching files(emtexdirwillworkonlyonoperatingsystemswhichhaveanMS-DOSishbackground,i.e. MS-DOS,OS/2,Windows;MiKTeXisspecifictoMSWindows). Asalastresort,bothprogramscanbecompiledwithoutasearchlibrary;thesearchedfilesmust betheninthecurrentdirectoryorspecifiedwithapath.Defaultextensionswillbeappendedalso(withtheexceptionthatonly‘.ttf’isappendedandnot‘.ttc’). KPATHSEA Pleasenotethatolderversionsofkpathsea(<3.2)havenospecialmeanstoseachforTrueType fontsandrelatedfiles,thusweusethepathsforPostScriptrelatedstuff.Theactualversionof kpathseaisdisplayedonscreenifyoucalleitherttf2pkorttf2tfmwiththe--versioncommand lineswitch. Hereisatableofthefiletypeandthecorrespondingkpathseavariables.TTF2PKINPUTSand TTF2TFMINPUTSareprogramspecificenvironmentvariablesintroducedinkpathseaversion3.2:

.ttfand.ttcTTFONTS
ttfonts.mapTTF2PKINPUTS
.encTTF2PKINPUTS,TTF2TFMINPUTS
.rplTTF2PKINPUTS,TTF2TFMINPUTS
.tfmTFMFONTS
.sfdTTF2PKINPUTS,TTF2TFMINPUTS

Andherethesameforpre-3.2-versionsofkpathsea:

.ttfand.ttcT1FONTS
ttfonts.mapTEXCONFIG
.encTEXPSHEADERS
.rplTEXPSHEADERS
.tfmTFMFONTS
.sfdTEXPSHEADERS

Finally,thesameforpre-3.0-versions(asusede.g.inteTEX0.4):

.ttfand.ttcDVIPSHEADERS
ttfonts.mapTEXCONFIG
.encDVIPSHEADERS
.rplDVIPSHEADERS
.tfmTFMFONTS
.sfdDVIPSHEADERS

Pleaseconsulttheinfofilesofkpathseafordetailsonthesevariables.Thedecisionwhetherto usetheoldorthenewschemewillbedoneduringcompilation. YoushouldsettheTEXMFCNFvariabletothedirectorywhereyourtexmf.cnfconfigurationfileresides. Hereisthepropercommandtofindouttowhichvalueakpathseavariableisset(weuse TTFONTSasanexample).Thisisespeciallyusefulifavariableisn’tsetintexmf.cnforintheenvironment,thuspointingtothedefaultvaluewhichishard-codedintothekpathsealibrary.

kpsewhich-progname=ttf2tfm-expand-var='$TTFONTS'

Weselecttheprogramnamealsosinceitispossibletospecifyvariableswhicharesearchedonly FreeTypeversion1.4 01-Mar-2000 7 TTF2TFM(1) TTF2TFM(1) foracertainprogram--inourexampleitwouldbeTTFONTS.ttf2tfm. Asimilarbutnotidenticalmethodistosay

kpsewhich-progname=ttf2tfm-show-path='truetypefonts'

[Afulllistofformattypescanbeobtainedbysaying‘kpsewhich--help’onthecommandline prompt.]Thisisexactlythehowttf2tfm(andttf2pk)searchforfiles;thedisadvantageisthat allvariablesareexpandedwhichcancauseverylongstrings. EMTEXDIR Herethelistofsuffixesanditsrelatedenvironmentvariablestobesetinautoexec.bat(resp.in

config.sysforOS/2):
.ttfand.ttcTTFONTS
ttfonts.mapTTFCFG
.encTTFCFG
.rplTTFCFG
.tfmTEXTFM
.sfdTTFCFG

Ifoneofthevariablesisn’tset,awarningmessageisemitted.Thecurrentdirectorywillalways besearched.Asusual,oneexclamationmarkappendedtoadirectorypathcausessubdirectories oneleveldeeptobesearched,twoexclamationmarkscausesallsubdirectoriestobesearched. Example:

TTFONTS=c:\fonts\truetype!!;d:\myfonts\truetype!

Constructionslike‘c:\fonts!!\truetype’aren’tpossible. MIKTEX Bothttf2tfmandttf2pkhavebeenfullyintegratedintoMiKTeX.PleaserefertothedocumentationofMiKTeXformoredetailsonfilesearching. PROBLEMS Mostvptovfimplementationsallowonly100bytesfortheTFMheader(thelimitis1024inthe TFMfileitself):8bytesforchecksumanddesignsize,40bytesforthefamilyname,20bytesfor theencoding,and4bytesforafacebyte.Thereremainonly28bytesforsomeadditionalinformationwhichisusedbyttf2tfmforanidentificationstring(whichisessentiallyacopyofthe commandline),andthislimitisalwaysexceeded. Theoptimalsolutionistoincreasethevalueofmaxheaderbytesinthefilevptovf.web(and probablypltotf.webtoo)to,say,400andrecompilevptovf(andpltotf).Otherwiseyou’llget some(harmless)errormessageslike

ThisHEADERindexistoobigformypresenttablesize

whichcanbesafelyignored. SEEALSO ttf2pk(1),afm2tfm(1),vptovf(1), theinfopagesfordvipsandkpathsea AVAILABILITY ttf2tfmispartoftheFreeTypepackage,ahighqualityTrueTyperenderinglibrary. AUTHORS WernerLEMBERG<wl@gnu.org>

Fre´ de´ ricLOYER<loyer@ensta.fr>

FreeTypeversion1.4 01-Mar-2000 8