Wiki source for FontForge


Show raw source

=== FontForge ===

一个强大的公开源代码的字库编辑工具。

网址: http://fontforge.sourceforge.net

----
== [[CTeXFonts CTeX-Fonts]] 中使用的加粗脚本 ==

~- v2.4.5
~- 将使用如下脚本%%
#!/usr/bin/fontforge -script

if ($argc !=3)
Print("")
Print("Usage: ", $0, " infont outfont")
Print("")
Quit()
else
Open($1)
endif

SelectAll()

foreach
# ExpandStroke(width, line cap, line join, 0, remove internal/external flag)
# flag: 1=remove internal, 2=remove external
# FindIntersections()
# RemoveOverlap()
# Simplify()
CorrectDirection()
ExpandStroke(10, 0, 0, 0, 1)
Simplify()
endloop

Generate($2)
%%
~- v2.4.4
~- 使用 FontForge 20040808
~- 宋体使用的脚本%%
#!/usr/bin/fontforge -script

if ($argc !=3)
Print("")
Print("Usage: ", $0, " infont outfont")
Print("")
Quit()
else
Open($1)
endif

SelectAll()

foreach
# ExpandStroke(width, line cap, line join, 0, remove internal/external flag)
# flag: 1=remove internal, 2=remove external
# FindIntersections()
# RemoveOverlap()
# Simplify()
ExpandStroke(10, 0, 0, 0, 1)
Simplify()
endloop

Generate($2)
%%
~- 其他字体因为走向错误,要使用不同的脚本%%
#!/usr/bin/fontforge -script

if ($argc !=3)
Print("")
Print("Usage: ", $0, " infont outfont")
Print("")
Quit()
else
Open($1)
endif

SelectAll()

foreach
# ExpandStroke(width, line cap, line join, 0, remove internal/external flag)
# flag: 1=remove internal, 2=remove external
# FindIntersections()
# RemoveOverlap()
# Simplify()
ExpandStroke(10, 0, 0, 0, 2)
Simplify()
endloop

Generate($2)
%%
~- 脚本使用方式举例%%
fontforge -script stroke.pe Fonts-old/gbkfs/fonts/type1/chinese/gbkfs/gbkfs01.pfb New-Fonts/gbkfs/gbkfs01.pfb
%%

----
== TTF2PFB 的脚本 ==

~- 用于 [[CTeXFonts CTeX-Fonts]] v2.4.3-FZ 中的脚本%%
#!/usr/bin/fontforge -script

if ($argc !=6)
Print("")
Print("Usage: ", $0, " sfd_file ttf_file pfbname fontname uid")
Print("")
Quit()
endif

sfd_file = $1
ttf_file = $2
pfbname = $3
fontname = $4
uid = Strtol($5, 10)

Open(ttf_file)
SelectAll()
Generate(pfbname + "%s.pfb", "", -1, -1, sfd_file)
Close()

i = 1
while (i <= 94)
subfont = "0" + i
subfont = Strsub(subfont, Strlen(subfont)-2, Strlen(subfont))

filename = pfbname + subfont + ".pfb"

Open(filename)

SetFontNames(fontname + subfont)
SetUniqueID(uid)

SelectAll()

Generate(filename)

Close()

i = i + 1
endloop
%%
~- 脚本使用方式举例%%
fontforge -script ttf2pfb.pe UGBK.sfd FZSSK.TTF gbksong/gbksong GBK-Song 8000
%%
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki