! !@(#) display all the hershey fonts and demonstrate textang ! program fcirctxt #include "interface.h" character*40 str1, str2, str3, str4, fonts(22) character*100 buf character*1 c integer BLACK, YELLOW, GREEN integer i parameter (BLACK = 0, YELLOW = 3, GREEN = 2) data fonts/ 'astrology', 'cursive', 'futura.l', & & 'futura.m', 'gothic.eng', 'gothic.ger', & & 'gothic.ita', 'greek', 'japanese', 'markers', & & 'math.low', 'math.upp', 'meteorology', 'music', & & 'cyrillic', 'script', 'symbolic', 'times.g', & & 'times.ib', 'times.i', 'times.r', 'times.rb' / data str1/ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' / data str2/ 'abcdefghijklmnopqrstuvwxyz' / data str3/ '1234567890+-=!@#$%^&*(){}[]' / data str4/ '<>,./?~`\|_BONK,blark' / print*,'Enter output device:' read(*,'(a)')buf call vinit(buf) call vsetflush(.false.) call color(BLACK) call clear ! ! define the world space ! call ortho2(-14.0, 14.0, -14.0, 14.0) do 10 i = 1, 22 ! ! textang is used to specify the orientation of text. As ! we want the title to come out straight we make sure it is ! zero each time we go through this loop. ! call textang(0.0) ! ! do the title ! call color(YELLOW) call font('futura.m') write(buf, '(''This is Hershey font '',a)') fonts(i) call boxtext(-11.0, 12.0, 20.0, 1.0, buf) ! ! draw a box around the title ! call rect(-11.0, 12.0, 9.0, 13.0) call color(GREEN) ! ! grab a font from the table ! call font(fonts(i)) ! ! show the outer ring ! call textsize(1.5, 1.5) call ShowCircularText(11.0, str1) ! ! show the second ring ! call textsize(1.3, 1.3) call ShowCircularText(8.5, str2) ! ! show the third ring ! call textsize(1.1, 1.1) call ShowCircularText(7.0, str3) ! ! show the inside ring ! call textsize(0.9, 0.9) call ShowCircularText(5.0, str4) c = char(getkey()) if (c .eq. 'q') then call vexit stop end if call color(BLACK) call clear 10 continue call vexit end ! ! nchars ! ! return the real length of a string padded with blanks ! integer function nchars(str) character *(*) str do 10 i = len(str), 1, -1 if (str(i:i) .ne. ' ') then nchars = i return end if 10 continue nchars = 0 return end ! ! ShowCircularText ! ! show a ring of text ! subroutine ShowCircularText(r, str) #include "interface.h" real r character*(*) str real i, inc, x, y, a, pi integer j character*1 c parameter (pi = 3.1415926535) j = 1 inc = 360.0 / nchars(str) i=0.0 do 10 i10 = 1,nchars(str) ! ! calculate the next drawing position ! c = str(j:j) x = r * cos(i * pi / 180.0) y = r * sin(i * pi / 180.0) call move2(x, y) ! ! calculate angle for next character ! a = 90.0 + i ! ! set the orientation of the next character ! call textang(a) ! ! draw the character ! call drawchar(c) j = j + 1 i=i+inc 10 continue end subroutine ShowCircularText