Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#14 merge Deja Vu LGC #16

Merged
merged 2 commits into from
May 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ Juglans フォント、生成スクリプト共に SIL OPEN FONT LICENSE Version
## 利用フォント
Myrica (生成スクリプトおよび ReplaceParts の一部)
Inconsolata (ASCII 文字)
源真ゴシック (ASCII 文字以外)
源真ゴシック (全角文字)
DejaVu LGC (Inconsolata に未収録の半角文字)

## 利用フォントのライセンス
サードパーティーライセンス.txt を参照してください。
85 changes: 60 additions & 25 deletions Source/juglans_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# 以下のように構成されます。
# ・英数字記号は、Inconsolata
# ・他の文字は、源真ゴシック
# ・一部の文字を視認性向上のために migu の特徴を取込み
# ~〜(FULLWIDTH TILDE・WAVE DASH)の区別

# version
newfont_version = "2.001.20210516"
Expand All @@ -30,6 +28,8 @@
srcfont_GenShin_bold = "../SourceTTF/GenShinGothic-Monospace-Bold.ttf"
srcfont_MyricaReplaceParts = "../SourceTTF/myrica_ReplaceParts.ttf"
srcfont_MyricaReplaceParts_bold = "../SourceTTF/myrica_ReplaceParts_bold.ttf"
srcfont_dejavu = "../SourceTTF/DejaVuLGCSansMono.ttf"
srcfont_dejavu_bold = "../SourceTTF/DejaVuLGCSansMono-Bold.ttf"

# out file
outfontNoHint = "../Work/Juglans_NoHint.ttf"
Expand Down Expand Up @@ -66,8 +66,10 @@

import os
import sys

import fontforge
import psMat
import unicodedata

# 縦書きのために指定する
fontforge.setPrefs('CoverageFormatsAllowed', 1)
Expand Down Expand Up @@ -261,6 +263,7 @@ def setFontProp(font, fontInfo):
font.copyright += "Copyright (c) 2006 The Inconsolata Project Authors (Inconsolata)\n"
font.copyright += "Copyright (c) 2014 MM (GenShinGothic)\n"
font.copyright += "Copyright (c) 2014 Adobe Systems Incorporated. (NotoSansJP)\n"
font.copyright += "Copyright (c) Bitstream. DejaVu changes are in public domain. Glyphs imported from Arev fonts are (c) Tavmjong Bah. (DejaVu LGC)\n"
font.copyright += "Licenses:\n"
font.copyright += "SIL Open Font License Version 1.1 "
font.copyright += "(http://scripts.sil.org/ofl)\n"
Expand Down Expand Up @@ -339,25 +342,53 @@ def setFontProp(font, fontInfo):
# 文字の置換え
print("merge ReplaceParts")
for glyph in fRp.glyphs():
if glyph.unicode in (0x002a,): # ASTERISK
if glyph.unicode in (0x002a,): # ASTERISK
select(fRp, glyph.glyphname)
fRp.copy()
select(fIn, glyph.glyphname)
fIn.paste()

# 必要文字(半角英数字記号)だけを残して削除
select(fIn, rng(0x0021, 0x007E))
selectMore(fIn, 0x00B7) # MIDDLE DOT
selectMore(fIn, 0x0307) # CONBINING DOT ABOVE (for i and j)
fIn.selection.invert()
fIn.clear()

fIn.selection.all()
fIn.round()

fIn.generate("../Work/modIncosolata.ttf", '', generate_flags)
fIn.close()


########################################
# modify DejaVu LGC
########################################

print("\nOpen " + srcfont_dejavu)
de_font = fontforge.open(srcfont_dejavu)

# modify
print("modify")

print("remove Glyphs")
de_font.selection.none()
# EastAsianWidthで全角(WまたはF)のグリフを削除
for glyph in de_font.glyphs():
if glyph.unicode > 0 and unicodedata.east_asian_width(chr(glyph.unicode)) in ("W", "F"):
de_font.selection.select(("more",), glyph.glyphname)
de_font.clear()

# modify em
de_font.em = newfont_em
de_font.ascent = newfont_ascent
de_font.descent = newfont_descent

# scale down
for glyph in de_font.glyphs():
glyph.transform(psMat.scale(0.83))
glyph.width = 500

de_font.selection.all()
de_font.round()

de_font.generate("../Work/modDejaVu.ttf", '', generate_flags)
de_font.close()

########################################
# modified GenShin
########################################
Expand All @@ -377,17 +408,13 @@ def setFontProp(font, fontInfo):
# 文字の置換え
print("merge ReplaceParts")
for glyph in fRp.glyphs():
if glyph.unicode in (0x2013, 0x2014, 0x301c): # EN DASH, EM DASH, WAVE DASH
if glyph.unicode in (0x2013, 0x2014, 0x301c): # EN DASH, EM DASH, WAVE DASH
select(fRp, glyph.glyphname)
fRp.copy()
select(fGs, glyph.glyphname)
fGs.paste()

# 半角英数字記号を削除
select(fGs, rng(0x0021, 0x007E))
fGs.clear()

# scaling down
# scale down
if scalingDownIfWidth_flag == True:
print("While scaling, wait a little...")
# 0.91はRictyに準じた。
Expand Down Expand Up @@ -418,27 +445,35 @@ def setFontProp(font, fontInfo):
########################################
# create Juglans
########################################
fMm = fontforge.open("../Work/modIncosolata.ttf")
ju_font = fontforge.open("../Work/modIncosolata.ttf")
de_font = fontforge.open("../Work/modDejaVu.ttf")
ge_font = fontforge.open("../Work/modGenShin.ttf")

print()
print("Build " + newfont_name[0])

# pre-process
setFontProp(fMm, newfont_name)
setFontProp(ju_font, newfont_name)

# merge DejaVu
print("merge DejaVu")
# マージ
ju_font.mergeFonts("../Work/modDejaVu.ttf")

# merge GenShin
print("merge GenShin")
# マージ
fMm.mergeFonts("../Work/modGenShin.ttf")
fMm.os2_unicoderanges = os2_unicoderanges
fMm.os2_codepages = os2_codepages
ju_font.mergeFonts("../Work/modGenShin.ttf")

ju_font.os2_unicoderanges = os2_unicoderanges
ju_font.os2_codepages = os2_codepages

# post-process
fMm.selection.all()
fMm.round()
ju_font.selection.all()
ju_font.round()

# generate
print("Generate " + newfont_name[0])
fMm.generate(newfont_name[0], '', generate_flags)
ju_font.generate(newfont_name[0], '', generate_flags)

fMm.close()
ju_font.close()
187 changes: 187 additions & 0 deletions SourceTTF/DejaVu-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)


Bitstream Vera Fonts Copyright
------------------------------

Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:

The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.

The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".

This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.

The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.

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 BITSTREAM OR THE GNOME
FOUNDATION 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.

Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org.

Arev Fonts Copyright
------------------------------

Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and
associated documentation files (the "Font Software"), to reproduce
and distribute the modifications to the Bitstream Vera Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to
the following conditions:

The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.

The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Tavmjong Bah" or the word "Arev".

This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Tavmjong Bah Arev" names.

The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.

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
TAVMJONG BAH 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.

Except as contained in this notice, the name of Tavmjong Bah shall not
be used in advertising or otherwise to promote the sale, use or other
dealings in this Font Software without prior written authorization
from Tavmjong Bah. For further information, contact: tavmjong @ free
. fr.

TeX Gyre DJV Math
-----------------
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.

Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski
(on behalf of TeX users groups) are in public domain.

Letters imported from Euler Fraktur from AMSfonts are (c) American
Mathematical Society (see below).
Bitstream Vera Fonts Copyright
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera
is a trademark of Bitstream, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license (“Fonts”) and associated
documentation
files (the “Font Software”), to reproduce and distribute the Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute,
and/or sell copies of the Font Software, and to permit persons to whom
the Font Software is furnished to do so, subject to the following
conditions:

The above copyright and trademark notices and this permission notice
shall be
included in all copies of one or more of the Font Software typefaces.

The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional
glyphs or characters may be added to the Fonts, only if the fonts are
renamed
to names not containing either the words “Bitstream” or the word “Vera”.

This License becomes null and void to the extent applicable to Fonts or
Font Software
that has been modified and is distributed under the “Bitstream Vera”
names.

The Font Software may be sold as part of a larger software package but
no copy
of one or more of the Font Software typefaces may be sold by itself.

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 BITSTREAM OR THE GNOME
FOUNDATION
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.
Except as contained in this notice, the names of GNOME, the GNOME
Foundation,
and Bitstream Inc., shall not be used in advertising or otherwise to promote
the sale, use or other dealings in this Font Software without prior written
authorization from the GNOME Foundation or Bitstream Inc., respectively.
For further information, contact: fonts at gnome dot org.

AMSFonts (v. 2.2) copyright

The PostScript Type 1 implementation of the AMSFonts produced by and
previously distributed by Blue Sky Research and Y&Y, Inc. are now freely
available for general use. This has been accomplished through the
cooperation
of a consortium of scientific publishers with Blue Sky Research and Y&Y.
Members of this consortium include:

Elsevier Science IBM Corporation Society for Industrial and Applied
Mathematics (SIAM) Springer-Verlag American Mathematical Society (AMS)

In order to assure the authenticity of these fonts, copyright will be
held by
the American Mathematical Society. This is not meant to restrict in any way
the legitimate use of the fonts, such as (but not limited to) electronic
distribution of documents containing these fonts, inclusion of these fonts
into other public domain or commercial font collections or computer
applications, use of the outline data to create derivative fonts and/or
faces, etc. However, the AMS does require that the AMS copyright notice be
removed from any derivative versions of the fonts which have been altered in
any way. In addition, to ensure the fidelity of TeX documents using Computer
Modern fonts, Professor Donald Knuth, creator of the Computer Modern faces,
has requested that any alterations which yield different font metrics be
given a different name.

$Id$
Binary file added SourceTTF/DejaVuLGCSansMono-Bold.ttf
Binary file not shown.
Binary file added SourceTTF/DejaVuLGCSansMono.ttf
Binary file not shown.
Loading