//Written by Lyle Ramshaw September 5, 1980  9:37 AM:
// In order to get arrowheads to work properly, text strings of length
// one in the font "Arrows" are treated specially by Draw (a hack).  
// This module exports a single procedure which will adjust the location
// of an arrowhead in the Press file so that its point will be at the
// same place as its point on the screen.  
 
// outgoing procedures:
external [ ArrowsMicaAdjust ]

//Call this procedure with the addresses of words that contain the
// tentative X and Y coordinates of the arrowhead, computed by the
// standard rule [from Top and Left data for the string, with Y adjusted 
// by the Baseline number from the .AL font].  This procedure will
// handle adjustments for the remaining factors:  (i) the Top number
// for an arrowhead refers to the top of the bounding box of the
// arrowhead alone, not of the arrowhead font;  (ii) the point of the
// arrow should look right in the Press file, instead of the left end of 
// the baseline;  (iii) the file Arrows10.al has a few off-by-one pixel
// bugs;  and (iv) who knows what all else.
// The basic data in the procedure is a table indexed by character code
// value that specifies the X and Y corrections in units of 4 micas (one
// might call this unit the "Formica", no?)

structure XYDEL [
	xDel bit 7	//excess 64 Formicas
	yDel bit 9	//excess 256 Formicas
	]
    
let ArrowsMicaAdjust(charCode, lvX, lvY) be [ArrowsMicaAdjust
let delTable = table [
      0;#070354;      0;#070400;#052416;#044402;#042354;      0; //#040 row
      0;      0;#052376;      0;#067700;      0;      0;      0; //#050 row
      0;#070424;#065446;#070441;#053457;#054441;#053446;#050424; //#060 row
#055445;      0;      0;      0;#070674;      0;      0;      0; //#070 row
#064404;#067644;#067667;#067667;#070637;#070570;#066650;#070637; //#100 row
#067650;#063600;#070644;#066650;      0;#067673;#070673;      0; //#110 row
      0;#066567;#060600;#067650;#064570;#064570;#070670;#061574; //#120 row
#070672;#062571;#070672;      0;      0;      0;      0;      0; //#130 row
      0;#070657;#070700;#070700;#066646;#070610;#063655;#076647; //#140 row
#070656;#063620;#072660;#065661;      0;#070700;#070676;      0; //#150 row
      0;#070611;#061620;#067657;#070610;#065611;#065700;#066614; //#160 row
#070676;#070614;#070700;      0;      0;      0;#047404;      0 ]//#170 row
let xyDel=delTable!(charCode-#040)
@lvX=@lvX+4*(xyDel<<XYDEL.xDel-64)
@lvY=@lvY+4*(xyDel<<XYDEL.yDel-256)
]ArrowsMicaAdjust