gsllchb / handright Goto Github PK
View Code? Open in Web Editor NEWA lightweight Python library for simulating Chinese handwriting
License: BSD 3-Clause "New" or "Revised" License
A lightweight Python library for simulating Chinese handwriting
License: BSD 3-Clause "New" or "Revised" License
是不是少了些参数?
想调整字间距咋做?
希望可以判断是符号后把word_spaceing减少,不是符号则还原
Considering this project is aiming to simulate Chinese Characters, so this issue report is writing in Chinese.
写字机一般是使用gcode来描述刀头(笔)的运动的方向的。gcode是一连串的向量组成的文件,也就是模拟了人手在写字时的笔尖的移动。
Handright模拟出来的手写笔记非常非常的真实,而将这些模拟的图片使用写字机还原到纸上却有比较大的问题:
潜在的解决方案:
P.S.商业软件的单线字解决方案很简单粗暴,直接读取人手写的路径创建专门的字库,但这种做法也破坏了人手写的随机性.
P.S.2Handright对笔画的区分,受限于笔者代码水平,实在没看懂[doge]
推荐个iOS版的手写模拟APP——快笔。和Handright不同的是,它的字迹是靠用户自己录入的。因此,如果你找不到像自己字迹的字体的话,可以考虑下这个APP~~~
请详尽地陈述您的想法,最好附上相关示例。
在真实写字过程中,无论多大字,笔画并不会遍粗。请问如何在不缩小字体的情况下使笔画变细。
参考examples/out/荷塘月色/0.jpg
Traceback (most recent call last):
File "k:\python\handwrite\main.py", line 8, in
font=ImageFont.truetype("font.ttf", size=100),
File "C:\Users\ZK\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\ImageFont.py", line 878, in truetype
return freetype(font)
File "C:\Users\ZK\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\ImageFont.py", line 875, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "C:\Users\ZK\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\ImageFont.py", line 226, in init
self.font = core.getfont(
OSError: cannot open resource
按照指示后,为什么会有OSError
请附上重现该bug的代码、图片(如果有的话)以及其它重现该bug所必须的东西。此外,重现bug的脚本应尽量使用最精简的代码以及最少的依赖项。
axidraw这个画图机器人网上很多。由于普通打印机智能打印一张一张纸,不能打印整本的笔记本,但是axidraw可以,而且还有笔的压痕,强烈建议加入axidraw支持
我想统计一下PyLf的实际用户数。
倘若您曾经使用过此Python库,请给这个帖子:+1:。
由于:+1:是匿名的,因此你们也无需有任何顾虑。
突然发现发送表情并不是匿名的,对不起大家。。。
不知道能不能设置随机字体,在多个字体之间随机选择,这样能够让生成的文章更像是手写的
alpha和字体大小等扰动,我都试了一下,alpha大了点,字就飞了,小了效果几乎没有。
我觉得还是随机选择几个相似的手写字体比较好。 font参数传入一个列表,在_draw_text函数中每个字随机使用一个字体,这样是不是更加真实一点。
参数调整好后,已经很难分辨单个文字是否是手写还是打印的了
但是当A4纸打印出来整篇的文字后,会发现整体看上去还是不像手写的
因为行的水平角度太直了,一般白纸上手写文字,都会越写越向上偏,很难都是水平的
希望能添加一个行水平角度扰动参数,取值范围可能在 (90°, -90°) 之间,当然不可能这么大角度,一般就正负5°以内估计就差不多了
正数表示行越往右越向上偏,负数表示行越往右越向下偏
只是大概这么个想法,还不太完善,如果作者还会继续完善,那么可以深入讨论一下,谢谢
没有配图,不好意思
请附上重现该bug的代码、图片(如果有的话)以及其它重现该bug所必须的东西。此外,重现bug的脚本应尽量使用最精简的代码以及最少的依赖项。
用打印机打出来,感觉有点点阵的感觉,没有直接打字清晰,咋处理?
本人门外汉,正在努力入门python,提几条不成熟的建议
比如,找几个相似的字体, 混合映射,效果较佳
是否有可能引入字体的形变,使得高频率的字符相邻出现时显得更真实?
一种可能的方法也许是对字体先进行变形,再随机使用其中的字形?
进一步的,能否通过输入,学习出字体,从而解除对字体文件的依赖?
[huaji]也许会成为有趣的中文验证码生成/识别库?[/huaji]
想知道在params_visualizing一图中所用到的字体是,然后有没有比较好的仿手写体推荐
支持个人自建字体吗?
请简明扼要地陈述您的问题。
想问大佬要下,字体font文件,谢谢。[email protected]
请简明扼要地陈述您的问题。
请问下字体颜色只能是黑白么?其他颜色该怎么选啊
我想通过handright输出表格内容
代码如下
import handright as hr
# 定义表格的行列数和内容
rows = 4
cols = 5
data = [
['姓名', '年龄', '性别', '地址', '电话'],
['张三', '20', '男', '北京市朝阳区', '010-12345678'],
['李四', '22', '女', '上海市浦东新区', '021-87654321'],
['王五', '25', '男', '广州市天河区', '020-55555555']
]
# 创建表格对象,并设置表格的样式
table = hr.TableWriter(rows, cols, font_size=30, line_spacing=60, cell_width=180, cell_height=80, margin_top=100,
margin_left=100)
# 绘制表格
table.draw_table()
# 写入内容
for i in range(rows):
for j in range(cols):
table.write_text(data[i][j], i + 1, j + 1)
# 显示表格
table.show()
但是报错
table = hr.TableWriter(rows, cols, font_size=30, line_spacing=60, cell_width=180, cell_height=80, margin_top=100,
^^^^^^^^^^^^^^
AttributeError: module 'handright' has no attribute 'TableWriter'
请问正常的表格应该怎么写
目前我遇到了一个两难的局面:继续走点阵图形这条路还是走矢量图形的路线?
我觉得对字形进行扰动的选择是对的,但我也觉得对矢量图形的路线貌似更自然也更优雅。你们觉得呢?
请在下面通过点赞的方式进行投票。欢迎发表自己的看法!
如何获取更像手写的字体,谢谢作者!
常规的字体,如黑体,宋体,等怎样模拟手写效果?
在处理大量数据的时候,可能会涉及到多个字体ttf,但每个ttf中的字种类并不相同,如果在绘制时出现了不存在的字,请问会返回什么呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.