Adjust italic angle from 10 to 12 and change spacing delta to -8
This commit is contained in:
parent
b31b188709
commit
a95c991daa
3 changed files with 36 additions and 19 deletions
|
|
@ -16,6 +16,7 @@
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import math
|
||||||
|
|
||||||
from booleanOperations import BooleanOperationManager
|
from booleanOperations import BooleanOperationManager
|
||||||
|
|
||||||
|
|
@ -86,7 +87,7 @@ class FontProject:
|
||||||
return os.path.join(path, "%s-%s.%s" % (family, style, ext))
|
return os.path.join(path, "%s-%s.%s" % (family, style, ext))
|
||||||
|
|
||||||
def generateFont(self, mix, names, italic=False, swapSuffixes=None, stemWidth=185,
|
def generateFont(self, mix, names, italic=False, swapSuffixes=None, stemWidth=185,
|
||||||
italicMeanYCenter=-825, italicNarrowAmount=1, panose=[]):
|
italicMeanYCenter=-825, scaleX=1, panose=[]):
|
||||||
|
|
||||||
n = names.split("/")
|
n = names.split("/")
|
||||||
log("---------------------\n%s, %s\n----------------------" %(n[0],n[1]))
|
log("---------------------\n%s, %s\n----------------------" %(n[0],n[1]))
|
||||||
|
|
@ -109,16 +110,15 @@ class FontProject:
|
||||||
i += 1
|
i += 1
|
||||||
if i % 10 == 0: print g.name
|
if i % 10 == 0: print g.name
|
||||||
|
|
||||||
if g.name in self.lessItalic:
|
if g.name not in self.noItalic:
|
||||||
italicizeGlyph(f, g, 9, stemWidth=stemWidth,
|
if g.name in self.lessItalic:
|
||||||
meanYCenter=italicMeanYCenter,
|
italicizeGlyph(f, g, 10, stemWidth=stemWidth,
|
||||||
narrowAmount=italicNarrowAmount)
|
meanYCenter=italicMeanYCenter,
|
||||||
elif g.name not in self.noItalic:
|
scaleX=scaleX)
|
||||||
italicizeGlyph(f, g, 10, stemWidth=stemWidth,
|
else:
|
||||||
meanYCenter=italicMeanYCenter,
|
italicizeGlyph(f, g, 12, stemWidth=stemWidth,
|
||||||
narrowAmount=italicNarrowAmount)
|
meanYCenter=italicMeanYCenter,
|
||||||
if g.width != 0:
|
scaleX=scaleX)
|
||||||
g.width += 10
|
|
||||||
|
|
||||||
# set the oblique flag in fsSelection
|
# set the oblique flag in fsSelection
|
||||||
f.info.openTypeOS2Selection.append(9)
|
f.info.openTypeOS2Selection.append(9)
|
||||||
|
|
@ -144,6 +144,23 @@ class FontProject:
|
||||||
generateGlyphs(f, self.diacriticList, self.adobeGlyphList)
|
generateGlyphs(f, self.diacriticList, self.adobeGlyphList)
|
||||||
# log(">> Reading features")
|
# log(">> Reading features")
|
||||||
# readFeatureFile(f, f.features.text)
|
# readFeatureFile(f, f.features.text)
|
||||||
|
|
||||||
|
# adjust width of italic glyphs
|
||||||
|
if italic == True:
|
||||||
|
widthAdjustment = -8
|
||||||
|
leftAdjustment = math.floor(widthAdjustment / 2)
|
||||||
|
rightAdjustment = math.ceil(widthAdjustment / 2)
|
||||||
|
for g in f:
|
||||||
|
if g.name not in self.noItalic:
|
||||||
|
if g.width != 0:
|
||||||
|
if g.box is None:
|
||||||
|
g.width += widthAdjustment
|
||||||
|
else:
|
||||||
|
newLeftMargin = int(g.leftMargin + leftAdjustment)
|
||||||
|
newRightMargin = int(g.rightMargin + rightAdjustment)
|
||||||
|
g.leftMargin = newLeftMargin
|
||||||
|
g.rightMargin = newRightMargin
|
||||||
|
|
||||||
log(">> Decomposing")
|
log(">> Decomposing")
|
||||||
# for g in f:
|
# for g in f:
|
||||||
# if len(g.components) > 0:
|
# if len(g.components) > 0:
|
||||||
|
|
@ -151,7 +168,7 @@ class FontProject:
|
||||||
for gname in self.decompose:
|
for gname in self.decompose:
|
||||||
if f.has_key(gname):
|
if f.has_key(gname):
|
||||||
decomposeGlyph(f, f[gname])
|
decomposeGlyph(f, f[gname])
|
||||||
|
|
||||||
copyrightHolderName = ''
|
copyrightHolderName = ''
|
||||||
if self.config.has_option('main', 'copyrightHolderName'):
|
if self.config.has_option('main', 'copyrightHolderName'):
|
||||||
copyrightHolderName = self.config.get('main', 'copyrightHolderName')
|
copyrightHolderName = self.config.get('main', 'copyrightHolderName')
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ from fontbuild.alignpoints import alignCorners
|
||||||
from fontbuild.curveFitPen import fitGlyph, segmentGlyph
|
from fontbuild.curveFitPen import fitGlyph, segmentGlyph
|
||||||
|
|
||||||
|
|
||||||
def italicizeGlyph(f, g, angle=10, stemWidth=185, meanYCenter=-825, narrowAmount=1):
|
def italicizeGlyph(f, g, angle=10, stemWidth=185, meanYCenter=-825, scaleX=1):
|
||||||
unic = g.unicode #save unicode
|
unic = g.unicode #save unicode
|
||||||
|
|
||||||
glyph = f[g.name]
|
glyph = f[g.name]
|
||||||
|
|
@ -39,7 +39,7 @@ def italicizeGlyph(f, g, angle=10, stemWidth=185, meanYCenter=-825, narrowAmount
|
||||||
# and -825 for a 2816 unit em square. (UPM*0.29296875)
|
# and -825 for a 2816 unit em square. (UPM*0.29296875)
|
||||||
m = Transform(1, 0, slope, 1, 0, 0)
|
m = Transform(1, 0, slope, 1, 0, 0)
|
||||||
xoffset, junk = m.transformPoint((0, meanYCenter))
|
xoffset, junk = m.transformPoint((0, meanYCenter))
|
||||||
m = Transform(narrowAmount, 0, slope, 1, xoffset, 0)
|
m = Transform(scaleX, 0, slope, 1, xoffset, 0)
|
||||||
|
|
||||||
if len(glyph) > 0:
|
if len(glyph) > 0:
|
||||||
g2 = italicize(f[g.name], angle, xoffset=xoffset, stemWidth=stemWidth)
|
g2 = italicize(f[g.name], angle, xoffset=xoffset, stemWidth=stemWidth)
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ def main():
|
||||||
# styleCode should be one of:
|
# styleCode should be one of:
|
||||||
# Regular, Italic, Bold, Bold Italic
|
# Regular, Italic, Bold, Bold Italic
|
||||||
#
|
#
|
||||||
# italicNarrowAmount controls scale on the x axis. 1.0 means no scaling.
|
# scaleX controls scale on the x axis, used for italics. 1.0 means no scaling.
|
||||||
# italicMeanYCenter controls how far on the x axis the glyph should slide
|
# italicMeanYCenter controls how far on the x axis the glyph should slide
|
||||||
# to compensate for the slant.
|
# to compensate for the slant.
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@ def main():
|
||||||
handledStyles.append('italic')
|
handledStyles.append('italic')
|
||||||
proj.generateFont(
|
proj.generateFont(
|
||||||
rg.font, "%s/Italic/Italic/Rg" % FAMILYNAME,
|
rg.font, "%s/Italic/Italic/Rg" % FAMILYNAME,
|
||||||
italic=True, stemWidth=232, italicMeanYCenter=-825, italicNarrowAmount=1,
|
italic=True, stemWidth=232, italicMeanYCenter=-825,
|
||||||
panose=mkpanose(5))
|
panose=mkpanose(5))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ def main():
|
||||||
proj.generateFont(
|
proj.generateFont(
|
||||||
Mix2([rg, bl], 0.32, glyphSpecializations.get('medium', {})),
|
Mix2([rg, bl], 0.32, glyphSpecializations.get('medium', {})),
|
||||||
"%s/Medium Italic/Italic/Me" % FAMILYNAME,
|
"%s/Medium Italic/Italic/Me" % FAMILYNAME,
|
||||||
italic=True, stemWidth=300, italicMeanYCenter=-825, italicNarrowAmount=1,
|
italic=True, stemWidth=300, italicMeanYCenter=-825,
|
||||||
panose=mkpanose(6))
|
panose=mkpanose(6))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -206,7 +206,7 @@ def main():
|
||||||
proj.generateFont(
|
proj.generateFont(
|
||||||
Mix2([rg, bl], 0.68, glyphSpecializations.get('bold', {})),
|
Mix2([rg, bl], 0.68, glyphSpecializations.get('bold', {})),
|
||||||
"%s/Bold Italic/Bold Italic/Rg" % FAMILYNAME,
|
"%s/Bold Italic/Bold Italic/Rg" % FAMILYNAME,
|
||||||
italic=True, stemWidth=350, italicMeanYCenter=-825, italicNarrowAmount=1,
|
italic=True, stemWidth=350, italicMeanYCenter=-825,
|
||||||
panose=mkpanose(8))
|
panose=mkpanose(8))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -219,7 +219,7 @@ def main():
|
||||||
handledStyles.append('blackitalic')
|
handledStyles.append('blackitalic')
|
||||||
proj.generateFont(
|
proj.generateFont(
|
||||||
bl.font, "%s/Black Italic/Italic/Bl" % FAMILYNAME,
|
bl.font, "%s/Black Italic/Italic/Bl" % FAMILYNAME,
|
||||||
italic=True, stemWidth=400, italicMeanYCenter=-825, italicNarrowAmount=1,
|
italic=True, stemWidth=400, italicMeanYCenter=-825,
|
||||||
panose=mkpanose(9))
|
panose=mkpanose(9))
|
||||||
|
|
||||||
# generate TTFs
|
# generate TTFs
|
||||||
|
|
|
||||||
Reference in a new issue