POV-Ray : Newsgroups : povray.binaries.images : Alphabet blocks : Re: Alphabet blocks Server Time
7 Aug 2024 07:14:28 EDT (-0400)
  Re: Alphabet blocks  
From: John VanSickle
Date: 4 May 2006 19:20:40
Message: <445a8c48$1@news.povray.org>
PM 2Ring wrote:
> I've been playing with John VanSickle's old Alphabet Blocks include file
> that was posted a few days back in scene-files, in the 'blocks.inc' thread.
> As I mentioned in that thread, some letters don't line up properly using the
> "timrom.tff" font on my Windows 2000pro system.
> 
> I started doing minor adjustments, but then I decided that a major revision
> using modern syntax would simplify it and make it easier to use a different
> font, if desired.
> 
> I'll post a couple of examples of my progress now, and would be interested
> in any feed back. I'll eventually post the new AlphaBlocks.inc file back in
> the original thread, with a scene file or two.
> 
> For now, here's the header:
> 
> ----------------------------------------------------------------------------
> Alphabet Blocks
> 
> This file creates wooden blocks with letters of the alphabet on them.
> Each defined block has one letter on its front (+z) side and its ROT13
> equivalent letter on the -z side. For instance, BlockA and Block N have both
> A and N on a side. This is not entirely redundant because BlockA and BlockN
> come with different pigments. This file uses the TIMROM.TTF font by default,
> but you can use a different one if you want, although the letters might not
> align properly with other fonts.
>    The blocks are one unit cubes, with their bottom on the y=0 plane,
> centered on the y-axis. They are designed for the left-hand coordinate
> system, in which y is up.
> 
> http://www.erols.com/vansickl/povray.htm

Ye goodness, that's an old post!  I haven't used that web site in over 
five years.  I've updated my macros to make use of the new SDL features. 
  The new macro looks like this:

#macro AlphaBlock(strL,colB)
#local rR=.15;
#local xW=1.5;
#local yH=3;
#local yB=0;
#local letT=text { ttf "timrom.ttf",strL,.1,0 }

#ifndef(BlockRand) #declare BlockRand=seed(0); #end
#local transW=transform {
   rotate <rand(BlockRand),rand(BlockRand),rand(BlockRand)>*10-5
   translate <rand(BlockRand),rand(BlockRand),rand(BlockRand)>*10-5
}

union {
   CutCylinder(<xW-rR,yH-rR,-1.5>,<xW-rR,yH-rR,1.5>,rR,0, x+y)
   CutCylinder(<xW-rR,yB+rR,-1.5>,<xW-rR,yB+rR,1.5>,rR,0, x-y)
   CutCylinder(<rR-xW,yH-rR,-1.5>,<rR-xW,yH-rR,1.5>,rR,0,-x+y)
   CutCylinder(<rR-xW,yB+rR,-1.5>,<rR-xW,yB+rR,1.5>,rR,0,-x-y)
   box { <rR-xW,yB,-1.5>,<xW-rR,yB+rR,1.5> }
   box { <rR-xW,yH-rR,-1.5>,<xW-rR,yH,1.5> }
   box { <-xW,yB+rR,-1.5>,<rR-xW,yH-rR,1.5> }
   box { <xW-rR,yB+rR,-1.5>,< xW,yH-rR,1.5> }

   box { <rR-xW,rR,-1.4>,<xW-rR,yH-rR, 1.4> }
   object { letT translate (min_extent(letT)-max_extent(letT))*<.5,.5,0> 
scale 3 translate -z*1.5+y*1.5 }
   object { letT translate (min_extent(letT)-max_extent(letT))*<.5,.5,0> 
scale <-3,3,-3> translate z*1.5+y*1.5 }
   pigment {
     gradient z translate -.5 scale 3
     pigment_map {
       [.02 colB]
       [.02 wood
         scale <.1,.1,1> transform transW
         turbulence .05
         color_map { [.5, rgb <1,.7,.4> ] [1, rgb <.7,.4,.1> ] }
       ]
       [.98 wood
         scale <.1,.1,1> transform transW
         turbulence .05
         color_map { [.5, rgb <1,.7,.4> ] [1, rgb <.7,.4,.1> ] }
       ]
       [.98 colB ]
     }
   }
}
#end

It still uses the timrom.ttf font, but I am sure that the interested 
student could modify the macro to change it.

Regards,
John


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.