tedd wrote: > > bb: > > When are you going to start using required dim's? Trying adding: > > DIM s$(12) > dim x,longestline,adjust,desired,times,gotlong,s > dim s$,p$,nos#,slop#,slopeach# > dim sloptohere,sloptoherei,sloptohere#,slopthisone,slopcumulative > dim v,y,i,h > > On my machine, the last few lines were not tall enough to display the > characters height properly. I don't know what happened and don't know > how to fit it, I'm just reporting that the demo looked strange. > Tedd, You don't understand poets. I'm sure headaches is an unknown word in their dictionary as I already said, that's probably why for the mere mortals they appear somewhat strange. Sade and Masoch are most certainly close friends to them considering their taste for torture. BB's demo ended up in a joyful mess in FB^3 with my settings. I would have spent more time trying to fix it than building another demo. And here it is: BEGIN GLOBALS DIM gText(12) AS STR255 END GLOBALS CLEAR LOCAL FN FullJustify DIM AS SHORT i,L,maxLen,nbSpaces // Getting the longest line in our array FOR i = 1 TO 11 L = FN StringWidth( gText(i) ) IF L > maxLen THEN maxLen = L NEXT // Calculation for the extra spaces FOR i = 1 TO 11 // Counting the number of spaces nbSpaces = 0 L = INSTR( 0, gText(i), " " ) WHILE L nbSpaces++ L = INSTR( L + 1, gText(i), " " ) WEND // Don't justify if next line is empty LONG IF gText( i + 1 ) != "" // Calculate how much pixels are left to play with LONG IF nbSpaces L = maxLen - FN StringWidth( gText(i) ) // Let the Toolbox do the hard work for us IF L THEN CALL SpaceExtra( FN FixRatio( L, nbSpaces ) ) END IF END IF PRINT gText(i) // reset extra space to 0, otherwise next StringWidth call // will not return an interesting value for us CALL SpaceExtra(0) NEXT END FN LOCAL FN initText gText(2) = ¬ "i read 'inside macintosh, text' about getting full justification," gText(3) = ¬ "and decided it would be less work to write a routine myself." gText(4) = ¬ "since all it was doing was making the size of the spaces bigger." gText(5) = ¬ "(you could do it for each character, too, if you should want to.)" gText(6) = ¬ "it's pretty easy, really. just find out how much you need to" gText(7) = ¬ "lengthen (or shorten) each line to make it end where you want," gText(8) = ¬ "and reposition the pen a bit after hitting each space." gText(9) = ¬ "" gText(10) = ¬ "window(_penh) positioning can be used for columns, too!," gText(11) = ¬ "even with a proportionally-spaced font..." END FN WINDOW 1,"",(0,0)-(640,500) TEXT ,12 FN initText FN FullJustify DO HANDLEEVENTS UNTIL FN Button And for BB only, here is the FBII version: DIM gText$(12) END GLOBALS CLEAR LOCAL FN FullJustify DIM i,L,maxLen,nbSpaces 'Getting the longest line in our array FOR i=1 TO 12 L=FN STRINGWIDTH(gText$(i)) IF L>maxLen THEN maxLen=L NEXT 'Calculation for the extra spaces FOR i=1 TO 12 'Counting the number of spaces nbSpaces=0 L=INSTR(0,gText$(i)," ") WHILE L nbSpaces=nbSpaces+1 L=INSTR(L+1,gText$(i)," ") WEND 'Don't jusfiy if next line is empty LONG IF gText$(i+1)<>"" 'Calculate how much pixels are left TO play with LONG IF nbSpaces L=maxLen-FN STRINGWIDTH(gText$(i)) 'Let the Toolbox do the hard work for us IF L THEN CALL SPACEEXTRA(FN FIXRATIO(L,nbSpaces)) END IF END IF PRINT gText$(i) 'Reset extra space to 0, otherwise next StringWidth call 'will not return an interesting value for us CALL SPACEEXTRA(0) NEXT END FN LOCAL FN initText gText$(2)="i read 'inside macintosh, text' about getting full justification," gText$(3)="and decided it would be less work to write a routine myself." gText$(4)="since all it was doing was making the size of the spaces bigger." gText$(5)="(you could do it for each character, too, if you should want to.)" gText$(6)="it's pretty easy, really. just find out how much you need to" gText$(7)="lengthen (or shorten) each line to make it end where you want," gText$(8)="and reposition the pen a bit after hitting each space." gText$(9)="" gText$(10)="window(_penh) positioning can be used for columns, too!," gText$(11)="even with a proportionally-spaced font..." END FN WINDOW 1,"",(0,0)-(640,500) TEXT ,12 FN initText FN FullJustify DO HANDLEEVENTS UNTIL FN BUTTON -- Cheers Alain ----------------------------------------------------- FB^3 in Europe: http://euro.futurebasic.com/ FB II Pouch: http://www.pixmix.com/FB/outils.html -----------------------------------------------------