Are you using some particular algorithm?
I read about the greedy algorithm which wrap the text by words, if last word can`t fit to the end of the line border, it`s pasted on the next one...
sync on : sync rate 00
set window position 0,0
backdrop on
BoxStartX = 100
BoxStartY = 100
d3d_init
FontSize = 8
QuarterFont = int(FontSize/4)
d3d_font 1,"Arial",FontSize,0,0,1
dim text_arr(1) as string
text1$ = "Text1:The Font ID is that of a font created by D3D_FONT. Horizontal alignment can be 0 - Left Aligned, 1 - Centered, or 2 - Right Aligned.Vertical alignment can be 0 - Top Aligned, 1 - Centered, 2 - Bottom Aligned. Specifying a colour value will override the colour setby D3D_COLOR."
text2$ ="Text2:The Font ID is that of a font created by D3D_FONT. Horizontal alignment can be 0 - Left Aligned, 1 - Centered, or 2 - Right Aligned.Vertical alignment can be 0 - Top Aligned, 1 - Centered, 2 - Bottom Aligned. Specifying a colour value will override the colour setby D3D_COLOR."
Filename$ = "text.dat"
FileID = find free datafile()
open datafile to write FileID,Filename$
write datafile string FileID,text1$
write datafile string FileID,text2$
close datafile FileID
`TextLen = len(text$)
TextCount = 2
do
text 0,0,"TextLen: " + str$(TextLen)
text 0,20,"FPS: " + str$(Screen fps())
`text 0,40,""+text_arr(0)
`text 0,60,""+text_arr(1)
` BoxEndX=mousex()
` BoxEndY=mousey()
if flag = 1
For TXT = 1 to TextCount
`Aspect Ratio 3:4
BoxWidth = TextLen/3
BoxHeight = TextLen/4
BoxText$ = "text"+str$(TXT)+"$"
BoxStartX = 100
BoxStartY = TXT*100
if datafile exist (FileID) = 0
open datafile to read FileID,Filename$
for arr = 0 to 1
text$ = datafile string$ (FileID)
text_arr(arr) = text$
next arr
endif
TextLen = len(text$)
d3d_wrapedtext(BoxStartX,BoxStartY,BoxWidth,BoxHeight,QuarterFont,text_arr(TXT-1))
NEXT TXT
close datafile FileID
endif
if mouseclick()= 1
flag = 1
ENDIF
if mouseclick() = 0 then flag = 0
remstart
d3d_starttext
`d3d_text 1,0,20,0,"FPS: "+str$(screen fps()),RGB(0,0,0)
`d3d_box BoxStartX,BoxStartY,BoxEndX,BoxEndY
d3d_boxtext 1,BoxStartX,BoxStartY,BoxWidth*QuarterFont,BoxHeight*QuarterFont,0,0,text$
`d3d_boxtext 1,BoxStartX,mousey()+10,sx,mousey()+100,0,0,text2$
d3d_endtext
remend
sync
LOOP
function d3d_wrapedtext(BoxStartX,BoxStartY,BoxWidth,BoxHeight,QuarterFont,BoxText$)
d3d_starttext
`d3d_text 1,0,20,0,"FPS: "+str$(screen fps()),RGB(0,0,0)
`d3d_box BoxStartX,BoxStartY,BoxEndX,BoxEndY
d3d_boxtext 1,BoxStartX,BoxStartY,BoxWidth*QuarterFont,BoxHeight*QuarterFont,0,0,BoxText$
`d3d_boxtext 1,BoxStartX,mousey()+10,sx,mousey()+100,0,0,text2$
d3d_endtext
ENDFUNCTION
This is what i`ve done so far with using cloggy, it`s a bit messy.But i managed it to make it like i wanted it last night.It can improve more.Just have no time now.
Where there is a will, there is a way.
I often edit my posts, that`s who i am