previewing a font in a textbox - 28/05/07 02:30 PM
can someone show me how to make a preview font thing, where i can select a font on my system, and it will show the font in a preview?
dialog fontlist { ... list 25 1 1 1 1 } alias grabfonts { $findfile(c:\,*.ttf,0,did -a fontlist 25 $1-) }
alias grabfonts { $findfile(c:\windows\fonts\,*.ttf,0,0,did -a fontlist 25 $1-) }
alias grabfonts { noop $findfile(c:\windows\fonts\,*.fon;*.ttf,0,did -a fontlist 25 $1-) }
alias listfonts { if (!$hget(fontcache)) { noop $findfile(c:\windows\fonts\,*.fon;*.ttf,0,hadd -m fontcache $calc($hget(fontcache,0).item + 1) $1-) } var %i = 1 while ($hget(fontcache,%i)) { did -a <dialog> <id> $v1 inc %i } }
alias listfonts { did -r dialog 15 .filter -k $shortfn(Font.dat) load_font } alias load_font { if ($1 == [FONTS]) return tokenize 61 $1- did -a dialog 15 $2 }
alias load_fonts { did -r dialog 15 if !$lines(font.dat) { listfonts } loadbuf -o dialog 15 font.dat }
alias listfonts { var %a = f. $+ $ticks .comopen %a WScript.Shell if $comerr { return } if $com(%a,ExpandEnvironmentStrings,3,bstr*,% $+ SystemRoot%) && $com(%a).result { noop } .comclose %a if *% iswm $v1 { return } %a = $v2 $+ \Fonts .fopen -no fontlist font.dat noop $findfile(%a,*.fon;*.ttf,0,.fwrite -n fontlist $nopath($1-)) .fclose fontlist filter -ffctn 1 1 font.dat font.dat }