Skip to content

Commit

Permalink
[makeotf] Add 'features.fea' to list of default FEA file names, and g…
Browse files Browse the repository at this point in the history
…ive preference to it
  • Loading branch information
miguelsousa committed Feb 23, 2019
1 parent ae5c1b4 commit a30fbae
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions python/afdko/makeotf.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,7 @@
kLicenseCode = "LicenseCode"
# Will look for all.
kDefaultFontPathList = ["font.ufo", "font.pfa", "font.ps", "font.txt"]
kDefaultFeaturesPath = "features"
kDefaultUFOFeaturesPath = "features.fea"
kDefaultFeaturesList = ["features.fea", "features"]
kDefaultOptionsFile = "current.fpr"
kDefaultFMNDBPath = "FontMenuNameDB"
GOADB_NAME = "GlyphOrderAndAliasDB"
Expand Down Expand Up @@ -1805,14 +1804,19 @@ def setMissingParams(makeOTFParams):
# features path.
fea_path = getattr(makeOTFParams, kFileOptPrefix + kFeature)
if not fea_path:
# look in font's home dir.
path1 = os.path.join(makeOTFParams.fontDirPath, kDefaultFeaturesPath)
if os.path.exists(path1):
fea_path = path1
elif makeOTFParams.srcIsUFO:
path1 = os.path.join(srcFontPath, kDefaultUFOFeaturesPath)
# First look for FEA file inside UFO
if makeOTFParams.srcIsUFO:
path1 = os.path.join(srcFontPath, 'features.fea')
if os.path.exists(path1):
fea_path = path1
# Then look for FEA file in the font's home directory,
# regardless if the input font is UFO or not
if not fea_path:
for fea_file_name in kDefaultFeaturesList:
path1 = os.path.join(makeOTFParams.fontDirPath, fea_file_name)
if os.path.exists(path1):
fea_path = path1
break
if not fea_path:
print("makeotf [Warning] Could not find default features file. "
"Font will be built without any layout features.")
Expand Down

1 comment on commit a30fbae

@benkiel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just bit me: now there isn't a way to set a preference for features files inside a UFO vs outside the UFO, this will always prefer the file inside the UFO, regardless of extension. At least this change should be documented.

Please sign in to comment.