/* $VER: WebfontManager 1.0 (18.12.2005) by Fulvio Peruggi (peruggi@unina.it) Dynamic size management of TrueType webfonts for AWeb 3.5+ Cloning of Firefox font features for AWeb 3.5+ */ /* Initialization */ /* Basic ranges */ /* Typographic sizes used for the default proportional fonts (Arial or Times New Roman). */ /* position 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 */ /* pcrange =' 9,10,11,12,13,14,15,16,17,18,20,22,24,26,28, 30, 32, 34, 36, 40, 44, 48, 56, 64, 72' HTML size 3 */ pegrange ='12,13,14,15,16,17,18,19,21,22,24,26,28,32,34, 36, 38, 40, 42, 46, 52, 58, 66, 76, 86' /* HTML size 3 */ pegrange2='34,38,40,42,46,48,52,54,60,62,68,74,80,92,98,102,108,114,120,132,148,166,188,218,246' /* HTML size 7 */ /* HTML scale */ /* Typographic sizes used for the default 7-step HTML scale (centered on size 21 of the pegrange). */ refscale='15,18,21,24,32,40,60' /* Sizes adapted for Firefox cloning. */ /* refscale='17,19,21,24,32,40,60' */ /* Expanded small sizes for better readability of tiny fonts. */ /* refscale='15,18,21,24,27,30,33' */ /* Linear scale for moderate sizes of large fonts. */ /* Threshold */ /* The smallest typographic size that will be used for displaying fonts. */ /* Choose a value among: 12,13,14,15,16,17,18,19,20,21,22,24,26,28. Default value: 12. */ threshold=12 /* Distance */ /* Number of steps in the pegrange between typographic sizes of default monospace and proportional fonts. */ /* Example: default proportional size = 24; default monospace size = 20; distance (from 24 to 20) = -3 steps. */ distance=0 /* Font weights */ /* Correction factors used for relative size balancing. */ AndaleMono =1.00 Arial =1.00 /* Reference parameter: do not change! */ ArialBlack =1.25 ComicSansMS =1.25 CourierNew =1.00 /* Reference parameter: do not change! */ Georgia =1.00 Impact =1.10 TimesNewRoman =1.00 /* Reference parameter: do not change! */ TrebuchetMS =1.05 Verdana =1.05 Webdings =0.90 ArialNarrow =1.00 LucidaSansUnicode=1.40 Symbol =1.10 Tahoma =1.05 Wingdings =1.00 /* Other parameters */ sep='7F'x /* This is the ASCII-8 character '' used as separator */ defsize=0 cursize=0 /* Current settings */ address command parse arg action . do i=1 to 25 parse var pegrange midsize.i ',' pegrange parse var pegrange2 maxsize.i ',' pegrange2 end call open('in','ENVARC:AWeb3/browser','read') do forever line=readln('in') if line='' then leave if left(line,5)='FON7 ' then defsize=substr(line,lastpos(' ',line)+1) if defsize~=0 then leave end call close('in') do defpos=1 to 25 if maxsize.defpos=defsize then leave end call open('in','ENV:AWeb3/browser','read') do forever line=readln('in') if line='' then leave if left(line,5)='FON7 ' then cursize=substr(line,lastpos(' ',line)+1) if cursize~=0 then leave end call close('in') do curpos=1 to 25 if maxsize.curpos=cursize then leave end do i=1 to 7 parse var refscale refsize.i ',' refscale end do i=1 to 7 expratio.i=refsize.i/refsize.3 end /* Main */ call open('in','ENV:AWeb3/browser','read') call open('out','T:browser','write') action=upper(action) select when action='MIN' then do i=1 call sizemanager end when action='DEC' then do i=curpos-1 call sizemanager end when action='DEF' then do i=defpos call sizemanager end when action='INC' then do i=curpos+1 call sizemanager end when action='MAX' then do i=25 call sizemanager end when action='TOG' then do call proptoggle end when action='REF' then do i=9 call sizemanager end otherwise exit 10 end call close('in') call close('out') 'Copy T:browser ENV:AWeb3/browser QUIET' 'Delete T:browser QUIET' exit sizemanager: if i<1 then i=1 if i>25 then i=25 j=i+distance if j<1 then j=1 if j>25 then j=25 do forever line=readln('in') delta=0 select when line='' then leave when left(line,5)='FONA ' then do parse var line ident ' ' fontname (sep) k (sep) filename (sep) oldsize capital=upper(fontname) select when pos('SANS-SERIF',capital)~=0 then weight=Arial when pos('SERIF',capital)~=0 then weight=TimesNewRoman when pos('MONOSPACE',capital)~=0 then do weight=CourierNew delta=1 end otherwise interpret 'weight=' compress(fontname) end newsize=round(weight*expratio.k*((1-delta)*midsize.i+delta*midsize.j)) if newsize=0.5 then rounded=integer+1 else rounded=integer end else do even=2*(real%2) if real-even>=1 then rounded=even+2 else rounded=even end return rounded proptoggle: do forever line=readln('in') lline=left(line,5) select when line=='' then leave when lline='FON1 ' then call toggle when lline='FON2 ' then call toggle when lline='FON3 ' then call toggle when lline='FON4 ' then call toggle when lline='FON5 ' then call toggle when lline='FON6 ' then call toggle when lline='FON7 ' then call toggle otherwise call writeln('out',line) end end return toggle: parse var line pre ' 'type' ' size . type=upper(type) select when type='ARIALREGULAR.FONT' then type='timesnewromanregular.font' when type='TIMESNEWROMANREGULAR.FONT' then type='arialregular.font' when type='ARIAL.FONT' then type='timesnewroman.font' when type='TIMESNEWROMAN.FONT' then type='arial.font' otherwise nop end call writeln('out',pre||' '||type||' '||size) return