[Perl]通过GD模块获取字符/汉字的点阵
示例脚本应保存为utf8格式
Code: [全选] [展开/收缩] [Download] (Untitled.pl)
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
0000000000001100000000000000000000000000
再来个
.
****
*****
*******
************
****************
* *********** ***
*** * ************ *****
*** *** * ************** *****
***** **** * *************** *******
**** ******* ** * ***** ********
**** ******** *** *** *********
***** ********** ** *********
**** *********** ** ********
*** ************* *** *******
******** **** *** ********
******** **** **** ***********
******** **** **** ******* ****
**** ** *** **** ****** ****
** *** **** **** *****
** **** **** *** ****
** ** *** *** * ****
** ** *** ** *******
*** * **** ** ******
**** ** *** *** *****
**** ************** *** ******
**** * *********** *******
*** * ********* **********
*** ** ********* ************
** * ********** **************
** * ************** *****************
** ** ***** ********** ********* ********
** ** ***** ********** ********* *******
** ** ****** ********* ******** ****
** *** ********** ******** ******* **
** *** ******* ******* ***** **
* *** ** ****** **** **
* *** **** *** **
***** **** * ***
**** * ***
[Perl]通过GD模块获取字符/汉字的点阵的更多相关文章
- MySQL通过函数获取字符串汉字拼音首字母大写字符串
DELIMITER $$ DROP FUNCTION IF EXISTS `Fun_GetPY`$$ CREATE FUNCTION `HIS`.`Fun_GetPY` (in_string VARC ...
- Swift3.0语言教程获取字符
Swift3.0语言教程获取字符 Swift3.0语言教程获取字符,在字符串中获取某一下标位置(下标索引)处的字符是很常见的功能,在NSString中使用character(at:)方法实现,其语法形 ...
- C#获取字符首字母
///<summary> /// 获取字符首字母 /// </summary> public static string GetPyChar(string c) { if (s ...
- 获取字符宽度:并非自适应。coretext去计算
获取字符宽度:并非自适应.coretext去计算 UniChar ch = [ns_str characterAtIndex:0]; CGGlyph glyph = 0; CTFontGetGlyph ...
- lastIndexOf方法——获取字符最后的索引
1.2.20 lastIndexOf方法——获取字符最后的索引 2013-08-29 14:55:18 我来说两句 收藏 我要投稿 本文所属图书 > Java程序开发参考手册 ...
- javascript 获取字符递增
比如A->B,AA->AB,Z->AA 参考https://blog.csdn.net/xiaotao2004/article/details/75096607 C#版本,改写为ja ...
- python封装configparser模块获取conf.ini值(优化版)
昨天晚上封装了configparser模块,是根据keyname获取的value.python封装configparser模块获取conf.ini值 我原本是想通过config.ini文件中的sect ...
- python使用wmi模块获取windows下的系统信息监控系统-乾颐堂
Python用WMI模块获取Windows系统的硬件信息:硬盘分区.使用情况,内存大小,CPU型号,当前运行的进程,自启动程序及位置,系统的版本等信息. 本文实例讲述了python使用wmi模块获取w ...
- perl HTML::LinkExtor模块(1)
use LWP::Simple; use HTML::LinkExtor; $html = get("http://www.baidu.com"); $link = HTML::L ...
随机推荐
- ffmpeg源码分析二:main函数和transcode函数 (转2)
原帖地址:http://blog.csdn.net/austinblog/article/details/24804455 首先从main函数看起,关键解释部分已加注释,该函数在ffmpeg.c文件中 ...
- vertex shader(3)
之前我们学习了如何声明顶点着色器.如何设置常量寄存器中的常量.接下来我们学习如何写和编译一个顶点着色器程序. 在我们编译一个顶点着色器之前,首先需要写一个. 有17种不同的指令(instruction ...
- MaperReduce实验
目录 MaperReduce实现WordCount程序二次排序 前期准备 1. 工程结构 2. 编写自定义NewKey类 3. 编写WCMapper类 4. 编写WCReduer类 5. 编写作业描述 ...
- python's descriptor
[python's descriptor] 1.实现了以下三个方法任意一个的,且作为成员变量存在的对象,就是descriptor. 1)object.__get__(self, instance, o ...
- java tomcat报错: Starting Tomcat v7.0 Server at localhost' has encountered a problem问题
运行web项目的时候出现下面错误: 出现这个问题的原因是 这个tomcat在其他项目中正在运行 关掉即可.
- Tp3.1 文件上传到七牛云
TP3.1 中不支持Composer 就无法用composer 安装 下载历史的SDK https://github.com/qiniu/php-sdk/releases/tag/v7.0.8 下载下 ...
- Redis只作为缓存,不做持久化的配置
#1.配置缓存内存限制和清理策略 #作为缓存服务器,如果不加以限制内存的话,就很有可能出现将整台服务器内存都耗光的情况,可以在redis的配置文件里面设置: #example: # 限定最多使用1.5 ...
- Ubuntu14.04下FTP服务器的搭建配置 标签: ubuntuftp服务器虚拟机 2017-06-13 15:24 161人阅读 评
首先说明一下,我是在虚拟机中装的Ubuntu14.04,物理机是Win10,最初只是为了在两个系统间传输文件才在Ubuntu中安装了ftp服务器,从Windows端登陆其即可.最初也是按照网上的各种教 ...
- Webstorm 10.0.4 配置
1. 更换为sublime text的keymaps: https://github.com/ekaragodin/idea-sublime-keymap (idea-sublime-keymap- ...
- myeclipse如何将项目打包成war包
打包步骤如下: 详细介绍请查看全文:https://cnblogs.com/qianzf/ 原文博客的链接地址:https://cnblogs.com/qzf/