POSTED BY GINGER2SNAPS 5-4-04 @ 4:32PM EST SEND PRIVATE MESSAGE Any help greatly appriciated!

Background
The high level problem I am trying to calculate the width of a line of text for a given font. I am generating a dynamic PDF using fpdf.org's tool. FPDF utilizes PHP files among other things to generate the PDF. I can use this PDF to generate the length of a line of text given the definition. I've provided two sample definitions below, one for Arial and one for Amazon (a script font).

Question
My problem is I want to make sure I'm understanding what all of these variables are first. I don't understand what the following variables are:
  • flags
  • ut
  • up
  • stemV
    As you can see from the images below, Arial isn't really caluclating correctly, but Amazon is. The reason I don't think Arial is calculating correctly is because the ration between the EM Square =2692 and the EM Width (width of an U.C. "M") =833 be SO far apart. Am I misinterpretting the numbers and/or variables?





    $type='TrueType';
    $name='ArialMT';
    $desc=array('Ascent'=>905,'Descent'=>-212,'CapHeight'=>716,'Flags'=>32,'FontBBox'=>'[-664 -325 2028 1037]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>750);
    $up=-106;
    $ut=73;
    $cw=array(
    	chr(0)=>750,chr(1)=>750,chr(2)=>750,chr(3)=>750,chr(4)=>750,chr(5)=>750,chr(6)=>750,chr(7)=>750,chr(8)=>750,chr(9)=>750,chr(10)=>750,chr(11)=>750,chr(12)=>750,chr(13)=>750,chr(14)=>750,chr(15)=>750,chr(16)=>750,chr(17)=>750,chr(18)=>750,chr(19)=>750,chr(20)=>750,chr(21)=>750,
    	chr(22)=>750,chr(23)=>750,chr(24)=>750,chr(25)=>750,chr(26)=>750,chr(27)=>750,chr(28)=>750,chr(29)=>750,chr(30)=>750,chr(31)=>750,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
    	','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
    	'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
    	'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
    	'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>750,chr(128)=>556,chr(129)=>750,chr(130)=>222,chr(131)=>556,
    	chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>750,chr(142)=>611,chr(143)=>750,chr(144)=>750,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
    	chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>750,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
    	chr(176)=>400,chr(177)=>549,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>576,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
    	chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
    	chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
    	chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>549,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
    $enc='cp1252';
    $diff='';
    $file='Arial.z';
    $originalsize=273020;
    
    
    

    
    $type='TrueType';
    $name='AmazoBTReg';
    $desc=array('Ascent'=>896,'Descent'=>-293,'CapHeight'=>722,'Flags'=>96,'FontBBox'=>'[-164 -293 1456 896]','ItalicAngle'=>16,'StemV'=>70,'MissingWidth'=>231);
    $up=-127;
    $ut=39;
    $cw=array(
    	chr(0)=>231,chr(1)=>231,chr(2)=>231,chr(3)=>231,chr(4)=>231,chr(5)=>231,chr(6)=>231,chr(7)=>231,chr(8)=>231,chr(9)=>231,chr(10)=>231,chr(11)=>231,chr(12)=>231,chr(13)=>231,chr(14)=>231,chr(15)=>231,chr(16)=>231,chr(17)=>231,chr(18)=>231,chr(19)=>231,chr(20)=>231,chr(21)=>231,
    	chr(22)=>231,chr(23)=>231,chr(24)=>231,chr(25)=>231,chr(26)=>231,chr(27)=>231,chr(28)=>231,chr(29)=>231,chr(30)=>231,chr(31)=>231,' '=>231,'!'=>333,'"'=>328,'#'=>768,'$'=>463,'%'=>640,'&'=>759,'\''=>168,'('=>347,')'=>347,'*'=>500,'+'=>833,
    	','=>231,'-'=>430,'.'=>231,'/'=>278,'0'=>463,'1'=>463,'2'=>463,'3'=>463,'4'=>463,'5'=>463,'6'=>463,'7'=>463,'8'=>463,'9'=>463,':'=>254,';'=>254,'<'=>833,'='=>833,'>'=>833,'?'=>389,'@'=>986,'A'=>1090,
    	'B'=>1055,'C'=>805,'D'=>923,'E'=>845,'F'=>627,'G'=>1083,'H'=>1000,'I'=>748,'J'=>706,'K'=>1000,'L'=>992,'M'=>1104,'N'=>1059,'O'=>874,'P'=>824,'Q'=>926,'R'=>1046,'S'=>676,'T'=>861,'U'=>1073,'V'=>870,'W'=>1065,
    	'X'=>1067,'Y'=>1072,'Z'=>956,'['=>347,'\\'=>278,']'=>347,'^'=>1000,'_'=>500,'`'=>500,'a'=>410,'b'=>422,'c'=>356,'d'=>406,'e'=>354,'f'=>290,'g'=>412,'h'=>456,'i'=>246,'j'=>243,'k'=>458,'l'=>315,'m'=>652,
    	'n'=>452,'o'=>419,'p'=>438,'q'=>403,'r'=>323,'s'=>360,'t'=>253,'u'=>450,'v'=>421,'w'=>648,'x'=>435,'y'=>450,'z'=>356,'{'=>500,'|'=>500,'}'=>500,'~'=>833,chr(127)=>231,chr(128)=>231,chr(129)=>231,chr(130)=>231,chr(131)=>463,
    	chr(132)=>382,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>500,chr(137)=>960,chr(138)=>500,chr(139)=>316,chr(140)=>1277,chr(141)=>231,chr(142)=>500,chr(143)=>231,chr(144)=>231,chr(145)=>231,chr(146)=>231,chr(147)=>382,chr(148)=>382,chr(149)=>590,chr(150)=>500,chr(151)=>1000,chr(152)=>500,chr(153)=>822,
    	chr(154)=>500,chr(155)=>316,chr(156)=>602,chr(157)=>231,chr(158)=>500,chr(159)=>1072,chr(160)=>231,chr(161)=>333,chr(162)=>463,chr(163)=>463,chr(164)=>606,chr(165)=>463,chr(166)=>500,chr(167)=>521,chr(168)=>500,chr(169)=>822,chr(170)=>307,chr(171)=>465,chr(172)=>833,chr(173)=>430,chr(174)=>822,chr(175)=>500,
    	chr(176)=>329,chr(177)=>833,chr(178)=>500,chr(179)=>500,chr(180)=>500,chr(181)=>527,chr(182)=>500,chr(183)=>231,chr(184)=>500,chr(185)=>500,chr(186)=>314,chr(187)=>465,chr(188)=>500,chr(189)=>500,chr(190)=>500,chr(191)=>456,chr(192)=>1090,chr(193)=>1090,chr(194)=>1090,chr(195)=>1090,chr(196)=>1090,chr(197)=>1090,
    	chr(198)=>1459,chr(199)=>805,chr(200)=>845,chr(201)=>845,chr(202)=>845,chr(203)=>845,chr(204)=>748,chr(205)=>748,chr(206)=>748,chr(207)=>748,chr(208)=>500,chr(209)=>1059,chr(210)=>874,chr(211)=>874,chr(212)=>874,chr(213)=>874,chr(214)=>874,chr(215)=>500,chr(216)=>874,chr(217)=>1073,chr(218)=>1073,chr(219)=>1073,
    	chr(220)=>1073,chr(221)=>500,chr(222)=>500,chr(223)=>485,chr(224)=>410,chr(225)=>410,chr(226)=>410,chr(227)=>410,chr(228)=>410,chr(229)=>410,chr(230)=>559,chr(231)=>356,chr(232)=>354,chr(233)=>354,chr(234)=>354,chr(235)=>354,chr(236)=>246,chr(237)=>246,chr(238)=>246,chr(239)=>246,chr(240)=>500,chr(241)=>452,
    	chr(242)=>419,chr(243)=>419,chr(244)=>419,chr(245)=>419,chr(246)=>419,chr(247)=>833,chr(248)=>419,chr(249)=>450,chr(250)=>450,chr(251)=>450,chr(252)=>450,chr(253)=>500,chr(254)=>500,chr(255)=>450);
    $enc='cp1252';
    $diff='';
    $file='AmazoBTReg.z';
    $originalsize=118072;