示例腳本應保存爲utf8格式
Code: [全選] [展開/收縮] [Download] (Untitled.pl)windows
use GD; use utf8; my $gd = GD::Image->new(40, 20); #1 my $black = $gd->colorAllocate( 0, 0, 0); my $white = $gd->colorAllocate(255, 255, 255); $gd->stringTTF($white, "C:\\windows\\fonts\\msyh.ttf", 20, 0, 0, 20, "中"); my $dt = $gd->wbmp( $black ); my @dts = map { ord($_) } split('', $dt); for my $e (4 .. $#dts) { printf "%08b", $dts[$e]; if (($e-4+1) % 5 == 0 ) { print "\n"; } }
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
0011111111111111111111111000000000000000
0011111111111111111111111000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011000000001100000000011000000000000000
0011111111111111111111111000000000000000
0011111111111111111111111000000000000000
0011000000001100000000011000000000000000
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000
0000000000001100000000000000000000000000code
再來個
.get
**** ***** ******* ************ **************** * *********** *** *** * ************ ***** *** *** * ************** ***** ***** **** * *************** ******* **** ******* ** * ***** ******** **** ******** *** *** ********* ***** ********** ** ********* **** *********** ** ******** *** ************* *** ******* ******** **** *** ******** ******** **** **** *********** ******** **** **** ******* **** **** ** *** **** ****** **** ** *** **** **** ***** ** **** **** *** **** ** ** *** *** * **** ** ** *** ** ******* *** * **** ** ****** **** ** *** *** ***** **** ************** *** ****** **** * *********** ******* *** * ********* ********** *** ** ********* ************ ** * ********** ************** ** * ************** ***************** ** ** ***** ********** ********* ******** ** ** ***** ********** ********* ******* ** ** ****** ********* ******** **** ** *** ********** ******** ******* ** ** *** ******* ******* ***** ** * *** ** ****** **** ** * *** **** *** ** ***** **** * *** **** * ***