/* Test coin image */ #include "colors.inc" #include "textures.inc" camera {location -z*10 direction z*1.5 right x up y look_at 0} light_source {<-5,10,-20>,color White} // Ron Parker's three macros // Find the advance width of character C in font F #macro WidthWithSpacing( C, F ) #local T=text {ttf F concat("|",C,"|") 1 0} #local W1=max_extent(T).x-min_extent(T).x; #local T=text {ttf F "||" 1 0} (W1-max_extent(T).x+min_extent(T).x) #end // Find the width of the glyph for character C in font F #macro WidthNoSpacing( C, F ) #local T=text {ttf F C 1 0} (max_extent(T).x-min_extent(T).x) #end // Find the kern for characters A and B from font F #macro Kern( A, B, F ) (WidthWithSpacing( concat(A, B), F)-WidthWithSpacing(A,F) -WidthWithSpacing(B,F)) #end // other macros #macro MaxHeight( A, F ) #local T=text {ttf F A 1 0} max_extent(T).y #end #macro MaxDescent( A, F ) #local T=text {ttf F A 1 0} -min_extent(T).y #end // s1 - string // scl - scaling factor // r1 - inner radius of text // F - font name // NOTE: There is no error checking in this macro! k*scl<=2*r1 must be true #macro AngleOf(s1,scl,r1,F) #local i=0; #local j=0; #while (iprec) //#debug concat(str(rmin,0,8),"-",str(rmax,0,8),"\n") #local rg=(rmin+rmax)/2; #local ag=AngleOf(s1,scl,rg,F); //#debug concat(" ",str(ag,0,8),"\n") #if (ag>a1) #local rmin=rg; #else #if (ag translate (r2+radj)*y rotate rotvec*(j*360/pi)} #if (i+1 translate -z*0.45 rotate -z*0.5*340 } //texture {pigment {color White} /*finish {ambient 1 diffuse 0}*/} texture {Gold_Texture} }