home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / povray3a / POV3Demo / Objects / pov / TTFTest < prev   
Text File  |  1996-05-03  |  3KB  |  101 lines

  1. // Persistence Of Vision raytracer version 3.0 sample file.
  2.  
  3. // Author:  Andreas Dilger, Feb 1996
  4.  
  5. #version 3.0
  6. global_settings { assumed_gamma 1.0 }
  7.  
  8. camera {
  9.    location  <0, 0, -14>
  10.    direction <0, 0,  1>
  11.    up        <0,  1,  0>
  12.    right     <4/3, 0,  0>
  13.    look_at   <0, 0, 0>
  14.    }
  15.  
  16. light_source {<-100, 100, -100> colour rgb <1.5, 1.5, 1.5>}
  17.  
  18. #declare FontName = "cyrvetic.ttf"
  19.  
  20. #declare FontTexture =
  21. texture {
  22.   pigment { color rgb <0.1, 0.2, 0.5> }
  23.   finish {
  24.     ambient 0.2
  25.     diffuse 0.6
  26.     phong 0.3
  27.     phong_size 100
  28.   }
  29. }
  30.  
  31. #declare height =  1          // Size of characters
  32. #declare length = 16          // Number of characters in a row
  33.  
  34. // ISO 8859-1 only defines printable characters in the range 32-126 and 160-255
  35. #declare startchar1 = 32      // First character to render
  36. #declare endchar1   = 126     // Last character to render in the first group
  37. #declare startchar2 = 160     // First character to render in the second group
  38. #declare endchar2   = 255     // Last characrer to render
  39.  
  40. #render concat("\nThis file renders the characters from ",
  41.            str(startchar1, 0, 0), " - ", str(endchar1, 0, 0), " and ",
  42.                str(startchar2, 0, 0), " - ", str(endchar2, 0, 0), "\n")
  43. #render "using the ISO 8859-1 (Latin-1) character set (if available).\n\n"
  44.  
  45. #render "Some of the characters may not be rendered properly (usually\n"
  46. #render "shown by a hollow box []), usually because they do not exist, or\n"
  47. #render "sometimes because the POV-Ray code does not yet support the\n"
  48. #render "encoding format used by these characters.\n\n"
  49.  
  50. #declare Xoff = -9
  51.  
  52. // Calculate the starting Y offset based on how many rows there are
  53. #declare Yoff =  ((int((endchar1 - startchar1 + length)/length) +
  54.            int((endchar2 - startchar2 + length)/length))/2-1)*height 
  55.  
  56. plane { -z, -0.01 pigment { checker color rgb <0.9, 0.9, 0.9>,
  57.                                  color rgb <0.7, 0.7, 0.7>
  58.            translate <0, Yoff, 0> }
  59.       }
  60.  
  61. #declare char = startchar1
  62.  
  63. #while (char <= endchar2)
  64.  
  65. #declare string = concat(str(char, -3, 0), "-")
  66.  
  67. #declare pos = 0
  68. #while (pos < length)
  69.  
  70. // We want only to print the characters from 32 - 126 and 160 - 255
  71. #switch (char + pos)
  72.  
  73. #range (endchar1 + 1, startchar2 - 1)
  74. #declare char = startchar2 - length   // make sure increment is calculated right
  75. #declare pos = length                 // break out of the inner loop
  76. #break
  77.  
  78. #range (startchar1, endchar1)     // These are the printing characters
  79. #range (startchar2, endchar2)
  80. #declare string = concat(string, chr(char + pos))
  81. #break
  82.  
  83. #end // switch (char + pos)
  84.  
  85. #declare pos = pos + 1
  86. #end // while (pos < length)
  87.  
  88. text { ttf
  89.    FontName,
  90.    string,
  91.    1, 0
  92.    texture { FontTexture }
  93.    scale <height, height, 0.5>
  94.    translate <Xoff, Yoff, 0>
  95.    }
  96.  
  97. #declare Yoff = Yoff - height
  98. #declare char = char + length
  99. #end  // while (char <= endchar2)
  100.  
  101.