home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / fermiVogle.tar.Z / fermiVogle.tar / devel / examples / pcirctxt.p < prev    next >
Text File  |  1996-02-07  |  3KB  |  156 lines

  1. program circtxt;
  2. (*
  3.  * display all the hershey fonts and demonstrate textang
  4.  *)
  5.  
  6. #include 'Vogle.h'
  7.  
  8. const
  9.     pi = 3.14159265358979;
  10.  
  11. var
  12.     fonts: array [1..22] of string_t;
  13.     str1, str2, str3, str4, buf, device: string_t;
  14.     dum, i: integer;
  15.         
  16.  
  17.     procedure init;
  18.     begin
  19.         str1 := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  20.         str2 := 'abcdefghijklmnopqrstuvwxyz';
  21.         str3 := '1234567890+-=!@#$%^&*(){}[]';
  22.         str4 := '<>,./?~`\\|_BONK,blark';
  23.  
  24.         fonts[1] := 'astrology';
  25.         fonts[2] := 'cursive';
  26.         fonts[3] := 'futura.l';
  27.         fonts[4] := 'futura.m';
  28.         fonts[5] := 'gothic.eng';
  29.         fonts[6] := 'gothic.ger';
  30.         fonts[7] := 'gothic.ita';
  31.         fonts[8] := 'greek';
  32.         fonts[9] := 'japanese';
  33.         fonts[10] := 'markers';
  34.         fonts[11] := 'math.low';
  35.         fonts[12] := 'math.upp';
  36.         fonts[13] := 'meteorology';
  37.         fonts[14] := 'music';
  38.         fonts[15] := 'cyrillic';
  39.         fonts[16] := 'script';
  40.         fonts[17] := 'symbolic';
  41.         fonts[18] := 'times.g';
  42.         fonts[19] := 'times.ib';
  43.         fonts[20] := 'times.i';
  44.         fonts[21] := 'times.r';
  45.         fonts[22] := 'times.rb'
  46.     end;
  47.  
  48.     procedure ShowCircularText(r: real; str: string_t);
  49.     (*
  50.      * ShowCircularText
  51.      *
  52.      *    show a ring of text
  53.      *)
  54.     var
  55.         a, j, inc, x, y: real;
  56.         slen, c, ii: integer;
  57.  
  58.     begin
  59.  
  60.         slen := length(str);
  61.         inc := 360.0 / slen;
  62.  
  63.         c := 1;
  64.         j := 0.0;
  65.  
  66.         for ii := 1 to slen do
  67.         begin
  68.  
  69.             j := j + inc;
  70.             (*
  71.              * calculate the next drawing position
  72.              *)
  73.             x := r * cos(j * pi / 180.0);
  74.             y := r * sin(j * pi / 180.0);
  75.             Move2(x, y);
  76.             (*
  77.              * calculate angle for next character
  78.              *)
  79.             a := (90 + j);
  80.             (*
  81.              * set the orientation of the next character
  82.              *)
  83.             TextAng(a);
  84.             (*
  85.              * draw the character
  86.              *)
  87.             DrawChar(str[c]);
  88.             c := c + 1
  89.         end
  90.     end;
  91.  
  92. begin
  93.  
  94.     init;
  95.  
  96.     write('Enter device name: ');
  97.     readln(buf);
  98.  
  99.     Vinit(buf);
  100.     VsetFlush(false);
  101.  
  102.     Color(BLACK);
  103.     Clear;
  104.  
  105.     Ortho2(-14.0, 14.0, -14.0, 14.0);    (* define the world space *)
  106.  
  107.     for i := 1 to 22 do
  108.     begin
  109.  
  110.         (*
  111.          * textang is used to specify the orientation of text. As
  112.          * we want the title to come out straight we make sure it is
  113.          * zero each time we go through this loop.
  114.          *)
  115.         TextAng(0.0);
  116.  
  117.         (*
  118.          * do the title
  119.          *)
  120.         Color(YELLOW);
  121.         Font('futura.m');
  122.         buf := 'This is hershey font ' + fonts[i];
  123.         BoxText(-11.0, 12.0, 20.0, 1.0, buf);
  124.  
  125.         (*
  126.          * draw a box around the title
  127.          *)
  128.         Rect(-11.0, 12.0, 9.0, 13.0);
  129.  
  130.         Color(GREEN);
  131.  
  132.         writeln('font: ', fonts[i]);
  133.         Font(fonts[i]);        (* grab a font from the table *)
  134.  
  135.         TextSize(1.5, 1.5);        (* show the outer ring *)
  136.         ShowCircularText(11.0, str1);
  137.  
  138.         TextSize(1.3, 1.3);        (* show the second ring *)
  139.         ShowCircularText(8.5, str2);
  140.  
  141.         TextSize(1.1, 1.1);        (* show the third ring *)
  142.         ShowCircularText(7.0, str3);
  143.  
  144.         TextSize(0.9, 0.9);        (* show the inside ring *)
  145.         ShowCircularText(5.0, str4);
  146.  
  147.         dum := GetKey;
  148.  
  149.         Color(BLACK);
  150.         Clear
  151.     end;
  152.  
  153.     Vexit
  154. end.
  155.  
  156.