Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Fix g j y
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfly2000 committed Mar 20, 2022
0 parents commit 783643b
Show file tree
Hide file tree
Showing 66 changed files with 700 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.otf
*.sfd
afdko_env/
*.ttx
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Adobe-GB1"]
path = Adobe-GB1
url = https://github.com/adobe-type-tools/Adobe-GB1
1 change: 1 addition & 0 deletions Adobe-GB1
Submodule Adobe-GB1 added at 463318
Binary file added CMapLatin.xlsx
Binary file not shown.
1 change: 1 addition & 0 deletions ClearImageFiles.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
del *.png
131 changes: 131 additions & 0 deletions Divide.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
nx=20
ny=25

require("alien")

alien.user32.SetProcessDPIAware:types{ret="int",abi="stdcall"}
alien.user32.SetProcessDPIAware()

local strpath
local noclip=false
if arg[1]==nil then
require("wx")
strpath=wx.wxFileSelector("选择文件",".","","png","便携式网络图像文件|*.png|所有文件|*",wx.wxFD_OPEN+wx.wxFD_FILE_MUST_EXIST)
else
strpath=arg[1]
end
if strpath==nil or strpath=='' then
os.exit()
end

if arg[2]==nil then
noclip=wx.wxMessageBox("是否需要裁切空白?","裁切",wx.wxYES_NO)==wx.wxNO
else
noclip=arg[2]=='noclip'
end

local _,sppos=strpath:reverse():find('%.')
local dpn=strpath:sub(1,#strpath-sppos)

require("gd")

function clipToChar(imgTable,x,y,w,h,clipBlankPx)
local clipX,clipY,clipW,clipH=x,y,w,h
if not noclip then
local blankColor=imgTable:colorAllocate(255,255,255)
if clipBlankPx~=-1 then
--Clip left border
for ix=x,x+w-1,1 do
local nbFound=false
for iy=y,y+h-1,1 do
if blankColor~=imgTable:getPixel(ix,iy) then
nbFound=true
break
end
end
if nbFound then
clipX=math.max(x,ix-clipBlankPx)
break
end
if ix==x+w-1 then
return 0,0,0,0
end
end
--Clip top border
for iy=y,y+h-1,1 do
local nbFound=false
for ix=x,x+w-1,1 do
if blankColor~=imgTable:getPixel(ix,iy) then
nbFound=true
break
end
end
if nbFound then
clipY=math.max(y,iy-clipBlankPx)
break
end
end
--Clip right border
for ix=x+w-1,x,-1 do
local nbFound=false
for iy=y,y+h-1,1 do
if blankColor~=imgTable:getPixel(ix,iy) then
nbFound=true
break
end
end
if nbFound then
clipW=math.min(x+w-clipX,ix-clipX+clipBlankPx)
break
end
end
--Clip bottom border
for iy=y+h-1,y,-1 do
local nbFound=false
for ix=x,x+w-1,1 do
if blankColor~=imgTable:getPixel(ix,iy) then
nbFound=true
break
end
end
if nbFound then
clipH=math.min(y+h-clipY,iy-clipY+clipBlankPx)
break
end
end
--调整尺寸以符合原图比例w/h
local ratio=w/h
local clipRatio=clipW/clipH
if clipRatio>ratio then--补充高度
local newH=h*clipW/w
clipY=clipY+(clipH-newH)/2
clipH=newH
--看补充后是否出界
clipY=math.max(clipY,y)
clipY=math.min(clipY,y+h-clipH)
elseif clipRatio<ratio then--补充宽度
local newW=w*clipH/h
clipX=clipX+(clipW-newW)/2
clipW=newW
--看补充后是否出界
clipX=math.max(clipX,x)
clipX=math.min(clipX,x+w-clipW)
end
end
end
return clipX,clipY,clipW,clipH
end

img=gd.createFromPng(strpath)
local dw=img:sizeX()/nx
local dh=img:sizeY()/ny
local charImg=gd.createTrueColor(dw,dh)
for j=0,ny-1,1 do
for i=0,nx-1,1 do
local x,y,w,h=clipToChar(img,i*dw,j*dh,dw,dh,5)
if w~=0 then
charImg:copyResampled(img,0,0,x,y,dw,dh,w,h)
charImg:png(string.format("%s_%02d_%02d.png",dpn,j,i))
end
end
end
25 changes: 25 additions & 0 deletions DrawGrid.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require("gd")

width=8000
height=10000

nx=20
ny=25

img=gd.createTrueColor(width,height)
white=img:colorAllocate(255,255,255)
gridColor=img:colorAllocate(200,91,252)
img:fill(0,0,white)

local ew=width/nx
local eh=height/ny

for x=0,width-1,ew do
img:line(x,0,x,height-1,gridColor)
end

for y=0,height-1,eh do
img:line(0,y,width-1,y,gridColor)
end

img:png("bg.png")
94 changes: 94 additions & 0 deletions LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Copyright (c) 2019-2022, lxfly2000 (lxfly2000@outlook.com),
with Reserved Font Name Acy.

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
36 changes: 36 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Acy-Font
字体包含:

|字体名|文件名|笔刷|
|-|-|-|
|Acy Regular|Acy-Regular.otf|35px铅笔(硬边缘)、固定透明度、粗细变化、最小宽度0|
|Acy Medium|Acy-Medium.otf|135%的Regular笔刷(+17em)|
|Acy Bold|Acy-Bold.otf|175%的Regular笔刷(+35em)|
* 因个人书写习惯、各地汉字差异等原因,某些字的写法可能不是标准写法。
* 本字体支持Adobe GB 1-1, Adobe Latin 1标准、同时包含Adobe GB 1-2与Adobe Japan 1-1交集部分的字符,即支持基本上所有常用的简/繁/日文/拉丁字符。

授权使用许可条款:
* 本项目字体采用 SIL Open Font License, Version 1.1 授权许可,具体以 [LICENSE.TXT](LICENSE.TXT) 文件中的描述为准;
* 提示信息:该字体可免费用于商业和非商业用途,您在使用时应当在应用了本项目字体的软件/媒体/文档等场景的明显位置中注明作者版权信息并保留 LICENSE.TXT 中的授权许可全文。

使用软件:
* [Lua for Windows](https://github.com/rjpcomputing/luaforwindows)
* [SAI2](https://www.systemax.jp)
* [FontForge](https://fontforge.github.io)
* [AFDKO](https://github.com/adobe-type-tools/afdko)

参考文档:
* [Adobe-GB1](https://github.com/adobe-type-tools/Adobe-GB1)
* [Adobe-Japan1](https://github.com/adobe-type-tools/Adobe-Japan1)
* [Adobe-Latin](https://github.com/adobe-type-tools/adobe-latin-charsets)

## 导出字体方法
用FontForge打开sfd文件,选择 Generate Fonts 用默认设置生成otf文件。

*由于sfd文件过大放在Github Release中。*

## 下载
[GitHub Release](https://github.com/lxfly2000/Acy-Font/releases)

## FontForge 使用教程视频
[Bilibili](https://www.bilibili.com/video/av22009352)
Binary file added Regular/Acy-Adobe-GB1-Regular-0-499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-1000-1499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-10000-10499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-10500-10999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-11000-11499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-11500-11999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-12000-12499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-12500-12999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-13000-13499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-13500-13999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-14000-14499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-14500-14999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-1500-1999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-15000-15499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-15500-15999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-16000-16499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-16500-16999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-17000-17499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-17500-17999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-18000-18499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-18500-18999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-19000-19499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-19500-19999.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-2000-2499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-20000-20499.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Regular/Acy-Adobe-GB1-Regular-20500-20999.png
Binary file added Regular/Acy-Adobe-GB1-Regular-21000-21499.png
Binary file added Regular/Acy-Adobe-GB1-Regular-21500-21999.png
Binary file added Regular/Acy-Adobe-GB1-Regular-22000-22126.png
Binary file added Regular/Acy-Adobe-GB1-Regular-2500-2999.png
Binary file added Regular/Acy-Adobe-GB1-Regular-3000-3499.png
Binary file added Regular/Acy-Adobe-GB1-Regular-3500-3999.png
Binary file added Regular/Acy-Adobe-GB1-Regular-4000-4499.png
Binary file added Regular/Acy-Adobe-GB1-Regular-4500-4999.png
Binary file added Regular/Acy-Adobe-GB1-Regular-500-999.png
Binary file added Regular/Acy-Adobe-GB1-Regular-5000-5499.png
Binary file added Regular/Acy-Adobe-GB1-Regular-5500-5999.png
Binary file added Regular/Acy-Adobe-GB1-Regular-6000-6499.png
Binary file added Regular/Acy-Adobe-GB1-Regular-6500-6999.png
Binary file added Regular/Acy-Adobe-GB1-Regular-7000-7499.png
Binary file added Regular/Acy-Adobe-GB1-Regular-7500-7999.png
Binary file added Regular/Acy-Adobe-GB1-Regular-8000-8499.png
Binary file added Regular/Acy-Adobe-GB1-Regular-8500-8999.png
Binary file added Regular/Acy-Adobe-GB1-Regular-9000-9499.png
Binary file added Regular/Acy-Adobe-GB1-Regular-9500-9999.png
Binary file added Regular/Acy-Adobe-Latin-Regular-Supplement.png
35 changes: 35 additions & 0 deletions autoimport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#python 3.7.3
#encoding=utf-8
#在 FontForge 中选择File,Execute Script...右键导入该脚本执行

#脚本参考:http://dmtr.org/ff.php

a=0 #起始字符位置
b=499 #结束字符位置

cx=20 #每行字符数量

import fontforge

font=fontforge.activeFont()
for i in range(a,b+1):
glyph=font.createMappedChar(i)
font.selection.select(glyph.originalgid)
#导入
y=int((glyph.originalgid-a)/cx)
x=glyph.originalgid-a-y*cx
img='Acy-Adobe-GB1-Regular-%d-%d_%02d_%02d.png'%(a,b,y,x)
try:
glyph.importOutlines(img)
#提取字形
font.autoTrace()
#去除重叠(我发现FontForge在提取字形时有可能会生成重复的轮廓造成导出的字体显示不正常,所以需要这一步)
font.removeOverlap()
#删除背景图像
#因 FontForge 未提供删除图像接口所以需要执行完后手动删除
except FileNotFoundError:
fontforge.logWarning(img+' 未找到,跳过')

#选择字形
font.selection.select(("ranges",None),a,b)
#之后需要手动选择Edit, Clear Background
Loading

0 comments on commit 783643b

Please sign in to comment.