Post by tsh73 on Feb 3, 2019 22:04:49 GMT
Boustrophedon text
en.wikipedia.org/wiki/Boustrophedon
en.wikipedia.org/wiki/Boustrophedon
'Boustrophedon text
'tsh73 Feb 2019
'Wikipedia rules ;)
'https://en.wikipedia.org/wiki/Boustrophedon
'mirror and flip
'by getbmp line by line
'and ouputting backwards
' Had to justify text for nice look.
data "THIS EXAMPLE OF BOUSTROPHEDON TEXT WAS"
data "WRITTEN SPECIALLY FOR THE WIKIPEDIA"
data "ARTICLE ON THIS OX TURNING METHOD OF"
data "COVERING A WALL WITH TEXT IN ANCIENT"
data "GREECE AND ELSEWHERE"
nomainwin
WindowWidth = 605
WindowHeight = 300
UpperLeftX = 1
UpperLeftY = 1
open "BOUSTROPHEDON" for graphics_nsb_nf as #gr
#gr "trapclose [quit]"
#gr "down"
#gr "fill white; flush"
#gr "home; posxy cx cy"
#gr "font times_new_roman 0 26 bold"
x0=10
#gr "place " ;x0;" ";70
#gr "posxy x y"
w=2*cx-2*x0
for i = 1 to 5
read a$
'justified text, anyone?
if i = 5 then
#gr "place ";x0;" ";y
#gr "\";a$ 'default is left-justified
else
numSps=0
noSps$=""
for j=1 to len(a$)
if mid$(a$,j,1)=" " then
numSps=numSps+1
else
noSps$=noSps$+mid$(a$,j,1)
end if
next
#gr "stringwidth? noSps$ totPix"
extra=w-totPix
print extra, extra/numSps
k=0
pos=x0
while 1
k=k+1
w$=word$(a$,k)
if w$="" then exit while
#gr "place ";pos;" ";y
#gr "\";w$
#gr "stringwidth? w$ wPix"
pos=pos+wPix+extra/numSps
wend
end if
oldY=y
#gr "posxy x y"
if i mod 2=0 then
h=y-oldY
'call rect "#gr",x0,oldY,2*cx-2*x0,0-(y-oldY)
'call rect "#gr",x0,oldY-h,w,h
call mirror "#gr", x0,oldY-h, w, h, x0, 200
call copy "#gr", x0, 200, w, h, x0, oldY-h
end if
#gr "place ";x;" ";y
next
'erase last rect
#gr "place ";x0;" ";y
#gr "color white; backcolor white"
#gr "boxfilled ";x0+w;" ";y+h
#gr "flush"
wait
#gr "home"
#gr "backcolor yellow; circlefilled 50"
#gr "backcolor white; circle 20"
call rect "#gr", cx, cy, 30, 20,
call copy "#gr", cx, cy, 30, 20, 80,100
call mirror "#gr", cx, cy, 30, 20, 200,100
call flip "#gr", cx, cy, 30, 20, 200,200
#gr "flush"
wait
[quit]
timer 0
close #gr
end
sub rect gr$, x,y,w,h
#gr$ "place " ;x;" ";y
#gr$ "box ";x+w;" ";y+h
end sub
sub copy gr$, x,y,w,h,destX,destY
#gr$ "getbmp tmpBmp ";x;" ";y;" ";w;" ";h
#gr$ "drawbmp tmpBmp ";destX;" ";destY
end sub
sub mirror gr$, x,y,w,h,destX,destY
for i=1 to w
#gr$ "getbmp tmpBmp ";x+w-i;" ";y;" 1 ";h
#gr$ "drawbmp tmpBmp ";destX+i;" ";destY
next
end sub
sub flip gr$, x,y,w,h,destX,destY
for i=1 to h
#gr$ "getbmp tmpBmp ";x;" ";y+h-i;" ";w;" 1 "
#gr$ "drawbmp tmpBmp ";destX;" ";destY+i
next
end sub