Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
13th May 2012, 04:15 | #1 | Link |
Registered User
Join Date: May 2007
Posts: 146
|
Preview fonts, textcolors, halocolors and background colors automatically
Hi
I've created a script that allows the user to preview fonts, textcolors, halocolors and background colors automatically. First of all I would like to thank Gavino for his GScript plugin -> http://forum.doom9.org/showthread.php?t=147846 Just download and place in your Avisynth plugins folder The GScript plugin is required which permits use of loops and if else statements Here's the script: boffset=0 /* backgroundcolor[blankclip] offset in pixels */ toffset=8 /* text offset in pixels */ hoffset=18 /* halo offset in pixels */ fontsize=18 /* fontsize in pixels */ xspace=4 /* leftmargin in pixels */ vwidth=1460 /* clipwidth in pixels */ font1=f15 /* font name 1st&last blankclip */ r=2 /* rowspace */ n=(fontsize+r) /* height of rows*/ loop=20 /* # of iterations */ nfonts=34 /*# of fonts */ vheight=(loop+r)*n /* clipheight in pixels */ textstring="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz" blankclip(1,vwidth,n,color=$ffffff) s1=subtitle(last," Resolution=" + string(vwidth) + "x" + string(vheight) + " BGOffset:" +string(boffset)+ " TOffset:" +string(toffset)+ " HOffset:" +string(hoffset), x=xspace,y=1,font=font1,size=fontsize,text_color=$ffffff, halo_color=$000000) s1 GScript(""" for ( i = 1, loop ) { c = Eval("c"+String(i)) if (i > loop-boffset ) { cinc=Eval("c"+String(i-(loop-boffset))) } else { cinc=Eval("c"+String(i+boffset)) } c = Eval("c"+String(i)) z= blankclip(1,vwidth,n,color=cinc) stackvertical(z) } for ( i = 1, loop ) { if (i > nfonts*4 < loop+1 ) { l=i-(nfonts*4) f=Eval("f"+String(l)) } else { if (i > nfonts*3 < (nfonts*4)+1 ) { k=i-(nfonts*3) f=Eval("f"+String(k)) } else { if (i > nfonts*2 < (nfonts*3)+1 ) { j=i-(nfonts*2) f=Eval("f"+String(j)) } else { if (i > nfonts < (nfonts*2)+1 ) { f=Eval("f"+String(i-nfonts)) } else { f=Eval("f"+String(i)) } } } } if (i > loop-boffset ) { dinc=Eval("d"+String(i-(loop-boffset))) } else { dinc=Eval("d"+String(i+boffset)) } if (i > (loop-hoffset) ) { cinc2=Eval("c"+String(i-(loop-hoffset))) dinc2=Eval("d"+String(i-(loop-hoffset))) } else { cinc2=Eval("c"+String(i+hoffset)) dinc2=Eval("d"+String(i+hoffset)) } if (i > loop-toffset ) { cinc1=Eval("c"+String(i-(loop-toffset))) dinc1=Eval("d"+String(i-(loop-toffset))) } else { cinc1=Eval("c"+String(i+toffset)) dinc1=Eval("d"+String(i+toffset)) } s2=subtitle(last," " +textstring+ " BGColor:" + dinc +" Font:" + f + " TextColor:" + dinc1+ " HaloColor:" +dinc2,x=xspace,y=n*i,font=f,size=fontsize,text_color=cinc1, halo_color=cinc2) s2 } stackvertical(s2,s1) """) I am attaching colors-fonts.avsi which contains color value, color name and fontname information for 144 colors and 34 fonts Here are the variables: boffset /* backgroundcolor[blankclip] offset in pixels */ toffset /* text offset in pixels */ hoffset=16 /* halo offset in pixels */ The offset refers to the starting number re backgroundcolor, textcolor, and halocolor The values range from 1 to 144, i.e. 144 colors By using different offsets the backgroundcolor, textcolor, and halocolor will all be different fontsize /* fontsize in pixels */ xspace /* leftmargin in pixels */ vwidth /* clipwidth in pixels */ font1 /* font name 1st&last blankclip */ r /* rowspace */ n=(fontsize+r) /* height of rows*/ loop /* # of iterations */ nfonts /*# of fonts */ vheight=(loop+r)*n /* clipheight in pixels */ textstring="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz" The process 1. The first loop creates blankclips 2. The next loop "prints" the textstring and shows the backgroundcolor, textcolor, and halocolor on each blankclip The number of rows will equal the value of loop + 2, i.e. the 1st blankclip + 34 textstrings + last blankclip. Example boffset=1 the blankclip background colors will start with color1 toffset=2 the text color of the textstring will start with color2 hoffset=3 the halo color of the textstring will start with color3 fontsize=16 the fontsize r=2 loop=34 there will be 34 rows of textstring with 34 unique colors for backgroundcolor, textcolor, and halocolor [the maximum number for loop will be the number of colors] nfonts=34 [maximum number is 34] textstring="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz" [can be any text string] Here's a link to 34.gif and 144.gif http://imageshack.us/g/214/28102179.gif/ Showing 34 colors/fonts and 144 colors/fonts (I used gif for minimal filesize) I have done all 144 colors and simply repeated the 34 fonts sequentially - it took awhile to render the preview. It is best to start with a low value of loop for quick previews and to see how the script works wiseant |
|
|