% acfit.jam
(FitACContour) {
 MoveHomeToLowerLeft
 5 .dynnodes
 e ms
 55 .squaretangents mn
 MoveHomeToACorner
 .filterbetweencorners
 .filterbetweencorners
 55 .squaretangents e ms mn
 9 1 2 2 .dynspline
 e dc mc
 }.cvx .def
(FitACChar) {
 .countcon
 {.countsa 0 .eq .not {FitACContour}/if .nextcon}.cvx .rept
 e dcs mcs
 .collectgarbage
 }.cvx .def
(FitTheoContour)
{50 50 .transa 20 .interpolatesa e ms 5 .dynnodes 55 .quicktangents MoveHomeToACorner 55 .quicktangents e ms mn 9 1 2 2 .dynspline e dc mc}.cvx .def
(FitTheo) {
 .countcon
 {FitTheoContour .nextcon}.cvx .rept
 e dcs mcs
 }.cvx .def
(GetAISTempContours) {AISisopen {.freeais}/if (AISTemp.ais) getAIS 0.02 .tvalue e .outline .makecontours 0 .setslen (AISisopen) .true .store}.cvx .def
(logc) (types the instructions to draw the curve in Curve.Log) {
 newcontour
 {8 6 .roll initmoveto 6 4 .roll logpoint 4 2 .roll logpoint logpoint (.curveto) .noter}.cvx .foralllinks
 }/xdef
(logcs) (types all the contours to Curve.Log or the open log file) {
 (.flushpath) .notes
 .countcon {logc .nextcon}.cvx .rept
 }/xdef
(logpoint) {.exch cvtempstring .notes cvtempstring .notes}.cvx .def
(cvtempstring) (converts to a string, using a temporary string area)
{( ) .cvis}/xdef
(FitFont) {PressFont.Open PressFont.AllocateBitmap (Bitmap size = ).print PressFont.BitmapSize .exch cvtempstring .print ( by ).print =}.cvx .def
(GetACChar) {(curChar) .exch .store .initdc 100 0 .setcp
 PressFont.UseBitmap .initdc e BitmapOrigin 1 .add .setcp PressFont.DrawRasterChars PressFont.UseScreen PressFont.DrawBitmap
 PressFont.WriteAISTemp GetAISTempContours e .setcontours 3 scale}.cvx .def
(GetACAsciiChar) {.dup .cviac .exch .cvias (curChar) .exch .store .initdc 100 0 .setcp
 PressFont.UseBitmap .initdc e PressFont.BitmapOrigin 1 .add .setcp PressFont.DrawRasterChars PressFont.UseScreen PressFont.DrawBitmap
 PressFont.WriteAISTemp GetAISTempContours e .setcontours 3 scale}.cvx .def
(AISisopen) .false .def
(GetAISTempContours) {AISisopen {.freeais}/if (AISTemp.ais) getAIS 0 .tvalue e .outlineBlackEdge .makecontours 0 .setslen (AISisopen) .true .store}.cvx .def
(FitContour) {(curContour) .exch .store
 .setsa 3 0 .scalesa .afsa 0 250 .translate ms 2 .subdividespline mc 0 -250 .translate}.cvx .def
(LogChar) {.true .setlog
 (").note curChar .cvaci .cvias .note (" ).note
 [ curChar .cvaci PressFont.CharDimensions ]
 {cvtempstring .note ( ).note}.cvx .arrayforall
 "{setUpTransform" .noter
 logcs
 "}.cvx" .noter
 "WriteSDChar" .noter
 .false .setlog}.cvx .def
(FitACRange) (i n -> . Fits n chars, starting at char i.)
{{.dup GetACAsciiChar FitACChar 1 .add}.cvx .rept .pop}/xdef