YP.-QY
ConversionofT
E
XfontsintoType1format
P
eterSzab
o
abstract. ThispaperanalysestheproblemofconvertingT
E
XfontstoType1fonts,
describesT
E
Xtrace,anewfreeconversionprogram,andcomparesittootherpossible
methodsandexistingutilities. T
E
Xtraceworksbyrenderingthefontinhigh
resolutionandthentracing(vectorizing)it.
keywords: PDF,fontconversion,Type1,METAFONT,vector,outline,raster,bitmap,
pdfT
E
X
"
herearetwomajorwaystodescribetheshapeoftheglyphs
1
ofafont: using
bitmap imagesor vector outlines. . Abitmapimageis s arectangular arrayof
dots;eachdotcanbepaintedwhiteorblackindependentlyfromtheothers.
Atahighresolutionofaround600 DPIthehumaneyecannotdistinguishindividual
pixelsandseestheglyphasifitwascontinuous. Ontheotherhand,vectoroutlines
specifytheblackregionsbythecurves(lines,arcs,ellipsesandothers)whichdelimit
them. Themostimportantadvantageofthisrepresentationisthatglyphoutlinescan
betransformed(rotated,scaledetc.) withoutqualityloss.
Mostfontsusedintoday’sdesktoppublishingsystemsaredistributedinsomekind
ofvectoroutlineformat. (Suchformats s are: : Type1,TrueType,OpenType,Speedo,
METAFONTsource.)Theprocessofconvertinganoutlinefonttoitsbitmapequivalent
iscalledrenderingorrasterization. Therenderingmustsurelyhappenbeforeactually
printingthedocumentontopaperordisplayingitonscreen,becausetoday’sprinters
andscreensdisplayeverythingusingarectangular layout of dots. . Sothedierence
betweendocumentpreparationsystemsliesnotinthepresenceoftherendering,but
themomentwhenitoccurs.
Whenprintingadocument ontopaper,theexacttimeinstant of therenderingis
notimportant 4theauthor wantsthenaloutputbebeautiful,andallotherinner
partsoftheprintingprocessareofminorimportance. However,thecaseisdierent
whenthedocumentisabouttobedistributedinelectronicform.Sincereadersmight
usedierentsoftwareforviewingand/orprinting,theauthorshouldensurethatthe
document looks andprintsniceinmostenvironments,i.e. . thedocumentshouldbe
Manythanks toFerencWettlandGyongyiBujdoso
1glyph: aspecic,visiblerepresentationofacharacter
Pdf to html - Convert PDF to html files in C#.net, ASP.NET MVC, WinForms, WPF application
How to Convert PDF to HTML Webpage with C# PDF Conversion SDK
how to convert pdf into html; adding pdf to html
Pdf to html - VB.NET PDF Convert to HTML SDK: Convert PDF to html files in vb.net, ASP.NET MVC, WinForms, WPF application
PDF to HTML Webpage Converter SDK for VB.NET PDF to HTML Conversion
convert pdf to html open source; embed pdf into html
2
szab
o
createdtobeportable. Thisinvolvesselectingafontformatthatworkswellinmost
reader software, , and d using this font format exclusively in electronically published
versionsofthedocument.
Inourspeciccase,theleformatusedfordocumentpublishingisPDF,andone
of the best font t formats for r embedding is Type1, a traditional vector r outline e for-
mat.(Thesewillbepresentedlaterinmoredetail.) Today’sT
E
X-to-PDFgenerating
softwaresupportType1fonts,but unfortunately mostT
E
X fonts are currently not
availableinType1format.Sotheyhavetobeconverted.
Thispaperfocusesonaquitedicultfontconversionproblem. Themostcommon
sourceformat,METAFONTisrathercomplicated(infact,itisanalmostfull-featured
programminglanguage),andthedestinationformat,Type1hastoomanyrestrictions.
Probably this is the reasonwhy there have beenno goodandrobust programs to
dotheconversion. T
E
Xtrace,describedlaterinthisdocument,overcomestherst
problembynoteventryingtounderstandtheMETAFONTles,butlettingtheoriginal
METAFONTprogramrendertheglyphs,andthencallingtheAutoTraceprogramwhich
tracesthebitmaps(approximatesthemwithvectoroutlines).FortunatelyAutoTrace’s
outputneedsonlyminormodicationstocomplytherestrictionsoftheType1format.
Themaindisadvantageof this \blind" conversionapproachis aminor quality loss
causedbyboththerenderingandthetracingprocess.
The availability of thefonts inavector outlineformat is of primary importance
whenpublishing the document t as s PDF, because e Acrobat Reader, the most widely
usedPDFviewerdisplaysbitmapfontsslowlyanduglyonscreen.
Motivation
WhyPDF?
ThePDFleformatisverypopularnowadaysamongauthorstodistributetheirwork
electronically. PDFhasbecomepopularbecauseit
9 representsletters,spaces,linebreaksandimagesetc.accurately:documentsretain
theirstructureandoriginalvisualappearancebetweenPDFviewers(asopposed
tomarkuplanguages,suchasSGMLandHTML).
9 followstheindustrystandardPostScriptpagedrawingmodel,PostScriptlescan
beconvertedtoPDFwithoutqualityloss(andviceversa).
9 is s portable e anddevice-independent. . Printing g PDF les s andrenderingthem on
screenisofteneasierandmorestraightforwardthandoingthesameforPostScript
les.ItispossibletocreateaportablePDFdocument,butonecanneverbesure
aboutPostScriptportability.
9 haswidespreadfreelyavailable e viewers (e.g.Acrobat Reader: : eitherstand-alone
orinthewebbrowser,Ghostscript,xpdf,PDFe-Bookreaders)formostplatforms.
MostsystemshavesomesortofPDFviewerinstalled.
9 hashyperlink,formsubmitandotherweb-relatedcapability. . (Thisarticleignores
thesefacilitiesanddealsonlywithstaticPDFles.)
Online Convert PDF to HTML5 files. Best free online PDF html
Download Free Trial. Convert a PDF file to HTML. Then just wait until the conversion from PDF to HTML is complete and download the file.
convert pdf to webpage; conversion pdf to html
C# HTML5 Viewer: Deployment on DotNetNuke Site
RasterEdge.XDoc.Office.Inner.Office03.dll. RasterEdge.XDoc.PDF.dll. RasterEdge.XDoc. PDF.HTML5Editor.dll. RasterEdge.XDoc.PowerPoint.dll. RasterEdge.XDoc.TIFF.dll
best pdf to html converter; pdf to html converter online
conversionoft
e
xfonts intotype1 format
3
Figure1: Thedifferencebetweenvector r (nice)andbitmapfontsinAcrobatReader
9 allowsrelativelysmalllesizes,whichiscomparabletoDVIles.
9 is s wellsuitedforbothshortandlongdocuments,includingscienticarticles,re-
ports,booksandsoftwaredocumentation.
Of course,it is possibletoconvert T
E
Xoutput intoPDFformateitherbycalling
pdfT
E
X[6],whichdirectlycreatesPDFlesinsteadofDVIles,orusingaDVI-to-
PDForPostScript-to-PDFconverter. PreparingaPDFversionofaT
E
Xdocument
issomewhatharderthanjustprintingthePostScriptversion,andrequiresabitmore
time. Toenjoy y thebenetslistedabove,theauthormust usetheproperversionof
the utilities, shemustadjustthesettings,andshe must makesurethat theproper
versionsofthefontsgetembedded.
FontproblemswithPDFandT
E
X
ThemainproblemwithPDFlesoriginatingfromT
E
Xsourceisthatcharactersof
mostT
E
X fontsshow upslowly andlook uglyinAcrobatReader. . This s is because
suchfontsaregeneratedbyMETAFONT,andareembeddedintothePDFleashigh
resolution bitmapimages; ; andAcrobat t Reader displays s bitmapimages s slowly and
poorlyonscreen.ThishasbeenoneofthefamousUglyBitsrelatedtoTeXforyears.
Theproblemdoesn’toccurwhenprintingthedocument,becausetheresolutionofthe
printerismostoftenhighenough(300DPI)toeliminaterenderingproblems.
Thesolutiontothisproblemistoembedtheoendingfontsinsuchaleformat
whichAcrobatReadercandisplayquicklyandbeautifully.Agoodcandidateforthis
istheclassical,standardType1format,appearedinthelate’80s. FortunatelypdfT
E
X
andnewerversionsofps2pdf(Ghostscript6:50)fullysupportit,sotheonlyproblem
remainingisthathowtoconvertafontinMETAFONTformattotheType1format.
Manytechniqueshavebeenproposedsofar,andnoneofthemisfullysatisfactory.
Theproblemitselfcanbesimplyvisualizedbyrunningpdftexonsimple.texle
(seealsoFigure1):
Sample text: nice\par \font\f=ecrm1000\f Sample text: ugly\end
Both the e console output of f pdftex x and d the e .log le should d containthe e entries
ecrm1000.600pk>and<cmr10.pfb>(thenumber600mayvaryacrossinstallations).
TheseentriesarethenamesofthetwofontlespdftexhasembeddedintothePDF
le. The e pk k extension means s that t the e glyphs s of the e font have been n embeddedas
bitmapimages(theresolutionof600DPIisalsoindicated4thisisofcourseprinter
dependent), andthe .pfb extensionmeans that the glyphs s have beenincludedas
vectoroutlinesintheType1format.
C# HTML5 Viewer: Deployment within SharePoint Site
PDF in C#, C# convert PDF to HTML, C# convert PDF to Word, C# extract text from PDF, C# convert PDF to Jpeg, C# compress PDF, C# print PDF, C# merge PDF files
change pdf to html; convert pdf link to html
C# WinForms Viewer: Load, View, Convert, Annotate and Edit PDF
Convert PDF to Tiff image (.tif, .tiff). • Convert PDF to HTML (.htm, .html). PDF Annotation. • Add sticky notes to PDF document in preview.
convert pdf into webpage; convert pdf to html with images
4
szab
o
DierencesbetweenMETAFONTandType1
We’llfocusonlyonhowtheseformatsdescribetheshapesofindividualglyphs. The
dierence betweenhow font-widemetrics, glyph h metrics, kerningand ligatures s are
treatedisn’t muchimportant, becausethisinformationcanbeconvertedeasily and
precisely4andthisinformationwillbeacquiredfromtheoriginalT
E
Xfonts(the.tfm
les)anyway,sowedon’thavetoconvertthematall.
TacoHoekwatergivesadetailed,richlyillustratedcomparisonofthetwofontfor-
mats,includingmanyguresandacasestudyofconvertingsomemathandsymbol
fonts(e.g.logo8,wasy5,stmary7,rsfs10)in[3]. Thecuriousbutbeginnerreaderis
referredtothatarticle.
ThefundamentaldierencebetweentheMETAFONTandType1isthatMETAFONT
isaprogramminglanguage,andType1isjustacompactleformatdescribingglyph
data
2
.Thecompiler/interpreteroftheMETAFONTlanguageisthemfprogram,which
readsthefontprogramsourcefrom.mfles(writtenbyhumans). TheMETAFONT
programminglanguagecontains3amongothers4lineandcurvedrawinginstructions.
mffollowstheinstructionsinthefontprogram,anddrawstheglyphsintoabitmapin
memory,andsavesthebitmapintoalewhenready.Thustheprintable/embeddable
versionofaMETAFONT font isavailableonlyinbitmapformat4therasterization
cannotbedelayed.
METAFONTprogramsdescribelinesandcurvesindirectly:theyimposemathemat-
icalequationstheshapesmustfulll,andmfdeterminestheexactshapesbysolving
these equations. . For r example, , the font designer r is allowedto o dene apoint t as an
intersectionoftwo,previouslydenedlines,andtoleavethecalculationoftheexact
coordinatestomf.
On the e other hand, Type1 fonts dene points and d shapes s calculatedpreviously,
in the e time of font t creation. . This s suggests s that t a a Type1 font t is the e nal l output
of somefont generationprocess,suchasacompiler similartoMETAFONT(see[4]),
or 3morecommonly4theexportfacilityofagraphical,wysiwygfonteditor
3
.The
processitselfmaybearbitraryaslongasitsoutputconformstothesyntaxdescribed
in the e Type1 documentation[1]. . The e font contains theglyphs as s vector r outlines,
in the e formof curves consisting of straight lines andBezier-curves. . Therendering
(rasterization)intotheprinter-specicresolutionisdeferredasmuchaspossible;thus
Type1fonts arescalable(resolution-independent). . Type1 1 doesn’t t dene aspecic
renderingalgorithm,sominorpixeldierencesmightoccur whenprintingthesame
document containing Type1 fonts s on n dierent printers. . The e rendering algorithms
arerelativelysimple (muchsimpler thananmf implementation),andtheyare fast
enoughforreal-timeoperation: eachinstanceoftheglyphisrenderedindependently
totheothersbytheprinter
4
. TheType1leformatrelatescloselytothePostScript
programminglanguage(thefontleisavalidPostScriptcodeinfact),butitispossible
torenderType1fontswithoutknowinghowtointerpretPostScript.
Type1fontscanbeeaselyconvertedtoMETAFONTformat(see[4]). Thisconversion
2
asimilardierenceexistsbetweenT
E
X andHTML;onecannotwritealoop thatprints nstars
inpureHTML,butit ispossibleinT
E
X
3suchasthefreeandsophisticatedPfaEditprogram
[8]
4
thisisnot exactlytruefor modernprintersthathaveaglyphcache
C# WPF Viewer: Load, View, Convert, Annotate and Edit PDF
Convert PDF to Tiff image (.tif, .tiff). • Convert PDF to HTML (.htm, .html). PDF Annotation. • Add sticky notes to PDF document.
convert pdf to html5; convert pdf to html with
VB.NET PDF - WPF PDF Viewer for VB.NET Program
PDF from RTF. Create PDF from Text. PDF Export. Convert PDF to Word (.docx). Convert PDF to Tiff. Convert PDF to HTML. Convert PDF to
convert pdf to html format; convert pdf to html file
conversionoft
e
xfonts intotype1 format
5
ismerelysyntactical: similartoconvertingplaintextintoaprogramthatjustprints
thetextintoitsstandardoutputandquits:wejustconvertaglyphoutlinetoMETA-
FONTdrawinginstructionsthatdrawtheoutline. However,thisdirectionofconversion
is quiteuseless,becauseT
E
XcanalreadydealwithType1fontswell(evenforPDF
les), plus s theinner structureof the glyphs wouldn’t berevealed, , so we’dlosethe
benetofthegeometrical(programmed)fontgenerationphilosophyofMETAFONT.
The other r way, converting .mf f to Type1 is s expected to be e harder, , because e the
METAFONTlanguageismuchmorecomplicatedthantheType1syntax.Sowecannot
convert the METAFONT programs exactly without \understanding"them. . Because
current.mflestendtobequitecomplicated,fullofdirtytricks,andtheyareutilizing
mostfeaturesofthelanguage,theonlyreliablewaytounderstandtheselesisusing
afullMETAFONTinterpreter.Therearetwosuchinterpretersavailable: mfitselfand
mpost(METAPOST). mfdoesn’tt t ourneeds, because itgenerates bitmapimages
andnot vector r outlines. . Onthe e other hand, mpost generates EPS S (Encapsulated
PostScript) output,containingvector outlines whichareverysimilar totheType1
outlines. But, , due totherestrictions s of the Type1format,theseoutlines mustbe
post-processed. This s cleanupprocess is so o complicatedthat t currently no program
existsthatcandoitreliably. AlternativewaysofusingofMETAFONTorMETAPOST
forconversionwillbediscussedtwosectionslater.
Of course3 as in n the e case of T
E
Xtrace 4one may y goaheadwithout tryingto
understandtheMETAFONTlanguage,andlookingatonlymf’sbitmapoutput. These
bitmapsmustsomehowbeconverted(traced) intovectoroutlinesthat approximate
thebitmap. Fortunatelythereexistautomaticutilitiesforthis.
AtourfromCMtoEC
T
E
X’s defaultandmost commonfontfamilyis theComputer Modern(CM)family,
designedbytheauthorofT
E
XandMETAFONT,DonaldKnuthhimself,between1979
and1985
5
.ThefontswereavailableonlyinMETAFONTformattill1992,whenBlueSky
convertedthemtoType1. NowtheType1.pfblesareavailablefromCTANand
theyarepartofmoststandardT
E
Xdistributions(suchasteT
E
XandMikT
E
X).
pdfT
E
Xisconguredtousethese.pfblesbydefault(pdftex.cfgincludesbsr.
mapwhichcontainsalltheavailablefontnames),sothereshouldbenoproblemwhen
creatingPDFfromthoseT
E
XdocumentswhichusetheCMfonts.
TheECabbreviationstandsfortheEuropeanComputerModernfamily,designed
by Jorg Knappen n between 1995 and 1997. . European n means that these e fonts s suit
typesettinginsomenon-EnglishEuropeanlanguagesbetterthantheCMfonts. Apart
fromthis,theECfontsarebasicallythesameastheCMfontswithacoupleofminor
additions andadjustments. . It t is almost impossibletodistinguishafont intheEC
familyfromits CMcounterpart6. Thamaindierencebetweenthesetwofamiliesis
technical: theECfamilycontainstheaccentedcharactersdirectlyinthefont,while
the CM familycontainstheletters andthe accents separatelyandT
E
Xmacrosare
usedtopositiontheaccents. TheECfontsarethuslarger,buttheyhaveanimportant
5forthosewhoarestillwondering: thispaperusestheComputerModernfontsalmostexclusively.
6
oneof thevisibledierencesaretheaccents;forexampletheCMacuteaccentis taller,andthe
CMHungarian umlautaccentis moreangledthanits ECcounterpart
VB.NET PDF- HTML5 PDF Viewer for VB.NET Project
PDF from RTF. Create PDF from Text. PDF Export. Convert PDF to Word (.docx). Convert PDF to Tiff. Convert PDF to HTML. Convert PDF to
pdf to html converters; converter pdf to html
VB.NET Create PDF from Excel Library to convert xlsx, xls to PDF
PDF from RTF. Create PDF from Text. PDF Export. Convert PDF to Word (.docx). Convert PDF to Tiff. Convert PDF to HTML. Convert PDF to
online pdf to html converter; convert pdf to html email
6
szab
o
benet: textenteredusingthosefontscanbeautomaticallyhyphenatedbyT
E
X(in
thecaseofCMfontsthemacrospreventautomatichyphenation).
UnfortunatelytheECfontsarenotavailableinType1formatyet,andmostEuro-
peanT
E
Xusersaresueringfromthisproblem.TheprimaryreasonwhyT
E
Xtrace
waswrittenis todotheconversion. . However,severalmethodsexistedbeforeT
E
X-
tracetoovercomethisUglyBit. Someofthemare:
9 TheAEfontswiththeLAT
E
XpackageaesimulatetheECfontsfromtheavailable
CMfontswithvirtualfonts7. Bothrequirementsarefullled: automatichyphen-
ationworksbecausethevirtualfontgivesT
E
Xalltheaccentedglyphs,andPDF
leslooknicebecausethevirtualfontpointstotheCMfonts,alreadyavailablein
Type1formatfromBlueSky.
ThemostseriousproblemoftheAEfontsisthatonlythemostcommonlyused
ECfontsaresimulated,andtheyareavailableonlyinsomeoftheECdesignsizes
(5{8of14). Ofcoursesomeglyphsaremissingbecausetheyweremissingfromthe
CMfonts(examples:ethð,gulliemots). Anotherproblemisthatthemetrics
areabitdierentfromtheoriginalfont,andthisaects lineandpagebreaksof
thedocument. (Thiscouldbeeasilysolvedbyoverwritingthe.tfmlesfromthe
goodECfonts.)
Correctingtheaccents andcreating g alldesignsizes s wouldhave beenpossible
witha couple of weeks s of work, , but the missing glyphs s imposed d an unsolvable
limitation. Andthemethodworkedonlyfor r theECfonts,it couldn’tcopewith
allT
E
Xfonts.
9 TheZEfontsaresimilartotheAEfonts,buttheycollectthemissingglyphsfrom
commonAdobefonts(suchas /Times-Roman). . Apart t fromthis,they havethe
samefundamentalproblemsastheAEfonts.
9 AutomatichyphenationworkswellwhentypesettinganEnglish(andotherlatin
non-accented) document. . The e alreadyavailableCM fonts canbe usedfor this.
InL
A
T
E
X,theonly thingtheauthormust ensureisthat thedocumentpreamble
doesn’tcontain\usepackage{t1enc}.
9 Therearelanguage-specicconversionutilitieswhichmodify.texsourcelesand
insertdiscretionaryhyphens(\-)intotheappropriateplaces.Sothehyphenation
problemissolved,theautomatichyphenationprovidedbyT
E
Xisn’tusedatall.
TheseutilitiesarenotpartofT
E
Xitself,andhavedierentinterfacefordierent
languages. They y contradict the e generic, consistent t and d accurate e way as s Babel
works,andmaketypesettingwithT
E
Xmoredicultanderror-prone.Thesolution
isfont-independent,soitworkswiththeCMfonts.
Thus,inthecaseoftheComputerModernfamily,onecanusethetricksaboveto
manage without theType1versions oftheECfonts. . But t therearenosuchtricks
formostotherT
E
Xfonts: theyneedconversion,andfortheconversion,oneneedsa
properconverter.
7
aT
E
X virtual font builds its glyphs from glyphs of other fonts. . Virtualfonts s can be usedfor
re-encodingand/orcollectingglyphs fromseveralfonts.
conversionoft
e
xfonts intotype1 format
7
VX]X-X]XW
T
E
Xtrace
T
E
XtraceisacollectionofscriptsforUNIXthatconvertanyT
E
XfontintoaType1
.pfboutlinefontimmediatelysuitableforusewithDVIPS,pdfT
E
X,AcrobatReader
(andmany other r programs). . The e documents usingthese fonts s cannot be e visually
distinguishedfromthedocuments usingtheoriginalT
E
X fonts,moreover thePDF
documentsdisplayquicklyandnicelyinAcrobatReader.
ThemaingoalforwritingT
E
XtracewastoconverttheECfontstoType1format
withit.Thisgoalhasbeenfullled,372ofthe392fontles(28fonts14designsizes)
areavailableas.pfbleswithanaveragelesizeof86kb.Themissing20lesarethe
Typewriterfonts at5ptandtheexperimentalFibonacciandFunnyfontsatvarious
sizes.TheyaremissingbecauseMETAFONTfailedtogeneratethem.Theconversion
took40hourswitha333MHzCeleronprocessorand128Mbmemory.
The 392TC(Text Companion) fonts andsomeothershavebeenalsoconverted.
(Withsomefailures,becauseof METAFONTover oworfontprogramerror).
T
E
Xtraceisinbetastatus,theauthoriswaitingbugreportsfromusers.
Howitworks
T
E
Xtracerenders allthe256glyphs oftheT
E
Xfont inaveryhighresolution(
7000DPI),thenitconvertstheresultingbitmaps toindividualvectoroutlines, , and
nallyit assembles these outlines toform asyntactically correct Type1 1 font. . The
nalresult is a.pfbfont le,whichcanbereadbybothDVIPSandpdfT
E
Xtobe
includedintodocuments.
Theprinciplesoundssimple,buttheimplementationisquitecomplicatedbecause
oftheusualquirksofprogramsused,incompatiblesoftwareandloose(ordisobeyed)
leformatspecications.
T
E
Xtrace operates fully y automatically. . It t doesn’t require human n intervention,
it doesn’task questions. . Theoutput t of T
E
Xtraceis usefulimmediately, , needs s no
furtherconversion,re-editingoradjustmentinfonteditors. T
E
Xtracecanoperate
inbatchmode;thismeansconvertingallthefontslistedina.maple.
TheoperationsofT
E
Xtraceforasinglefont:
1. A.texleisgenerated,eachpagewithadierentglyphfromthefont.
Notonlytheshape oftheglyphis important,buttheabsolutecoordinatesof
thecharacteroriginmust alsobespecied: : thisguaranteesthat t glyphswillline
uptobasepointandfolloweachotherthesamedistancesintheoriginalandthe
convertedfont. SotheT
E
Xprimitive\shipoutisusedtooutputpages.Thisway
pagenumbersandthevariousgluesarecompletelyavoided,sotheglyphistypeset
toawell-dened,exactplaceonthepage.
Thefontisrequestedatarelativelylargesize(120:45ptfor600DPIandfonts
withdesignsizeof10pt),sothat1emwillbe1000pixelslongwhenrendered.
T
E
Xisinstructedtooutputglyphmetricsintoaseparate.logle.
8
szab
o
2. texisinvokedtocreatethe.dvilefromthe.texle. . Thisisaquitesimplejob
forT
E
X: nolineorpagebreaksetc.occur.Asasideeect,texrunsmktextfm(or
whateverfontgenerationmechanismisusedintheT
E
Xdistribution)ifthe.tfm
lewasmissing.
3. dvipsis s run,whichconvertsthe.dvileto.psandautomaticallyembedsthe
fontintothe.psle.
DVIPS reads s the font from the e appropriate e .pk le (e.g. . ecrm1000.7227pk)
mostofthetime. Ifthe.pkdoesn’talready y exist(whichisprobablytruesince
thechancesforaprevioususeofthefontat120:45ptorsoarenegligible),itcalls
mktexpktocreateit. mktexpklooksaroundandpassesthejobtomf.
Allthishappensautomatically,withoutT
E
XtracehavingtoknowaboutT
E
X
fontgenerationandembeddinginternals.
4. gs(GNUGhostscript)iscalledtorender(rasterize)the.psle.
Thisisalmostasyntacticalconversion,becauseMETAFONTfontsarealready
insertedinto.psleinrasterizedbitmap.pkformatby DVIPS8.Of coursethe
outputbitmaps ofGhostscriptarenot senttotheprinter,buttheyaresavedto
individualimageles(inthePBMformat).
Special care must be takenfor r glyphs s withnegativesidebearing (i.e. . glyphs
extendingtotheleftfromtheirorigin). Fornormalprinting,thisisn’taproblem,
becauseasub-millimeternegativesidebearingis negligablewithaleftmarginof
2cm.InthecaseofT
E
Xtrace,wemustmakesurethattheglyphwon’tstickout
ofthepage. Thiscouldbeaccomplishedbymovingalarge(butconstant)amount
totherightandhopingthattheleftsidebearingissmallerthanthatamount.T
E
X-
traceusesamorepreciseapproach:itmeasurestheglyphboundingbox(witha
carefultrickeryusingthebboxdeviceofGhostscript),andmovestheappropriate
amounttotheright.
5. Theindividualbitmapsareconvertedtovectoroutlinesbythefreeexternalpro-
gramAutoTrace(writtenbyMartinWeber<martweb@gmx.net>).
This converter r supports s several l input t andoutput le e formats, but these are
mostlyequivalent. TheEPSformatis s usedforoutput,becauseitisverysimilar
tohowType1represents glyphs. . However,Type1imposes s somerestrictions on
the glyphs,soalittlemodicationof theoriginalAutoTrace outputroutinewas
requiredtoobeytheserestrictions:
9 Pathdirections(clockwise/counter-clockwise)hadtobecorrected,sothatblack
regionswouldalwaysbetotheright-handsidefromthepath.
9 Multiplepathshadtobeconvertedintoasingleone.
9 Theinitialclearingoftheimagetowhitecolorhadtoberemoved.
9 Curvesdidn’ttoucheachotherintheoriginaloutput,sonomodicationswere
necessary.
TheAutoTraceprogram hasbugs: : it t errs outwithsome failedassertionerror
for 0:12% of the glyphs. . Theauthor r ofAutoTrace isawareof the bugs, , but he
currentlyhas noxforthem. . Thebugis s workedaroundempirically,bycalling
8
anexception: whenDVIPShasembeddedafontinother r than.pkformat.
conversionoft
e
xfonts intotype1 format
9
original
AutoTrace
Freehand
CorelTrace
Streamline
Figure2: AutoTracecomparedtoothertracingsoftware
original
-corner-threshold 80
-corner-threshold 90
Figure3: AutoTracecannotfindcornersatlowresolution
AutoTracewithdierentparametersuntilthebugstopstomanifest.
AutoTrace{althoughitisfree{isn’tcurrentlyavailablefromthewebbecauseof
technicalreasons.SotheproperversionofAutoTraceisincludedintheT
E
Xtrace
distribution.
AutoTracewaschosenforthetracingbecauseitisfree,worksautomatically,and
gives agoodresult(see Figure 2for a a comparison). . Other r examples of glyphs
tracedbyAutoTracearetheornamentsthroughoutthisdocument. AutoTracedoes
aquitegoodjobatextremelyhighresolutions(suchasthe7227DPIusedbyT
E
X-
trace),butproducespooranduselessoutputforlowresolutions(example: when
aglyphat10ptisscannedat600DPI).
Figure3illustratesthatthesharpcornersproducethemostproblemsforAuto-
Trace. Adjusting g the command-line options s doesn’t help, , andit might evendo
harmifdierent regionsoftheimagerequiredierentoptions. . Fortunatelysuch
distortionsdonot occurwhenusingT
E
Xtrace,becausefonts arerenderedina
highenoughresolution.
6. ThevectoroutlinesarecleanedupabittocomplytheType1specication.
Thedetailsofthecleanuphavebeenexplainedinthepreviousitem.Thecleanup
afterAutoTraceismucheasierthanitwouldbeafterMETAPOST(see[3]).
Theoutlinesarealsoproperlyscaledandshiftedrespecttotheorigin.
7. TheoutlinesaremergedintoaType1fontle.
type1fix.pl(autility bundledwithT
E
Xtrace) is runonthefontletox
quirksincommonfonteditorsandotherfonthandlingsoftware(includingpdfT
E
X
andDVIPS).
The output .pfb le will be highly portable andcompatible with h most t font
software. Inanidealworld(withnoUglyBits)thereshouldbenofontcompat-
ibilityissues. However,inthe e realworld, suchissues are commonsincethereis
nostandardwaytoreadaType1fontapartfrominterpretingitasaPostScript
program. (Ofcoursethat’drequireafullPostScriptinterpreterinallfonthandling
programs,whichistoocomplicatedandwouldmakeexecutionslow).
10
szab
o
Somostutilities(includingthosementionedabove)useadierent,nonstandard
Type1reader(inventedbythe\commonsense"oftheirprogrammer).Theseread-
erstendtohavespeciclurkingquirks: theyareabletoloadmostType1fonts,
buttheymightrunintoaproblemwithloadingan\oending"fonts,whichfully
followtheType1specication. Fortunatelytooutputof f type1fix.plavoidsall
commonquirks,sofontsgeneratedbyT
E
Xtracedon’tsuerfromincompatibili-
tiesofthird-partysoftware.
Availability
T
E
Xtraceis freesoftware,licensedundertheGNUGeneralPublicLicense. . Itcan
bedownloadedfromitshomepage:
http://www.inf.bme.hu/~pts/textrace/
T
E
XtracerequiresaUNIXsystemwiththeteT
E
Xdistribution,GNUGhostscript,
Perl andGNU Bashtorun. . Successfulruns s havebeenreportedon n MacOSX X and
Win32,butthoseplatformsarenotsupported. Ofcourse,.pfbfontlesgeneratedby
T
E
Xtraceareplatformindependent,andtheycanbeusedinanyT
E
Xenvironment.
SomefontsconvertedbyT
E
Xtraceareavailablefordownloadfromthesamehome
page. TheseincludealltheECandTCfonts,somemissingAMSfontsandothers.
Problemstobesolved
9 Hugefontles. . The.pfblesT
E
Xtracegeneratesarearound3:15timeslarger
thantheoptimum. ThisismostlybecauseofAutoTracecannotndtheoptimal
Bezier-curvesthatdescribetheoutline.Tosolvethis,AutoTracehastobepartially
rewrittenoranothertracermustbeused.(Theauthordoesn’tknowoffreetracers
comparabletoorbetterthanAutoTrace.)
9 Cornersgetsmoothed. . Findingthecorners(sharpangles)oftheoutlineisaweak
pointAutoTrace: sometimesitrecognizescornersassmallarcs. . Theauthortried
adjustingthetracingparameterstosolvetheproblem,buthasn’tsucceeded.
9 Hintinginformationismissing. . Type1fontsusetheso-calledhinting g technology
toimproverenderingonsmallresolutions(e.g.onscreen,100DPI).Thisrequires
globalandglyphwiseadditionalinformationinthefont,calledhints. Toachieve
highquality,this informationshouldbeinsertedby expertswithgreat care,the
process can be e automatedonly with h loss of quality. . Fonts s generatedby T
E
X-
tracecompletelylackhinting,soglyphsareexpectedtobebadlyreadableinlow
resolutions. Fortunately,inpractice,fonts s generatedby T
E
Xtracecanberead
quitewellinAcrobatReaderunlessoneturnsantialiasingoexplicitly9.
9 Conversionisslow. . Witha333MHzCeleronprocessor r and128Mbofmemory,
conversion of a single e font t (e.g. . ecit1728) ) takes around six minutes. . This s is
tolerableunless onewants toconvert hundredsoffonts (suchas allthe392EC
fonts).Althoughthismightsoundquiteslow,currentlyT
E
Xtraceisthefastestin
itscategory.Moreover,theprocessisfullyautomatic,andtheresultisimmediately
9withFile!Preferences!General!Smooth...
Documents you may be interested
Documents you may be interested