Skip to content

Commit

Permalink
Version 1.5.4 update
Browse files Browse the repository at this point in the history
1. Change abbreviation of "Semibold" from "DB" to "SB".
2. Rebuilder.__rebuildName(): Re-write style-links handling for Windows
legacy family.
  • Loading branch information
Pal3love committed Sep 10, 2017
1 parent 85c4554 commit 8df44aa
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
6 changes: 4 additions & 2 deletions Package/otRebuilder/Lib/Constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,19 @@

# Style Strings
REGULAR_STYLES = ("Regular", "Rg", "Roman", "Rm", "R", "Normal", "Norm", "Nm", "Book", "Bk")
CJK_REGULAR_WEIGHTS = ("W3", "W4", "507R", "508R", "50J", "50F", "50JF", "50W", "50S", "55J", "55F", "55JF", "55W", "55S")
BOLD_STYLES = ("Bold", "Bd", "B")
ITALIC_STYLES = ("Italic", "It", "Oblique", "Obl")
LEGACY_WIN_STYLES = ("Regular", "Bold", "Italic", "Bold Italic")
CJK_REGULAR_WEIGHTS = ("W3", "W4", "507R", "508R", "50J", "50F", "50JF", "50W", "50S", "55J", "55F", "55JF", "55W", "55S")
CJK_BOLD_WEIGHTS = ("W6", "W7", "511M", "512B", "70J", "70F", "70JF", "70W", "70S", "75J", "75F", "75JF", "75W", "75S")

# Weight/Width Scales and Strings
WIDTH_SCALES = (1, 2, 3, 4, 5, 6, 7, 8, 9)
ABBREVIATED_WIDTHS = ("UCond", "XCond", "Cond", "DCond", "M", "DExt", "Ext", "XExt", "UExt")
STANDARD_WIDTHS = ("Ultra-condensed ", "Extra-condensed", "Condensed", "Semi-condensed", "Medium", "Semi-expanded", "Expanded", "Extra-expanded", "Ultra-expanded")
WIN_SAFE_WEIGHT_SCALES = (250, 275, 300, 400, 500, 600, 700, 800, 900, 950)
STANDARD_WEIGHT_SCALES = (100, 200, 300, 400, 500, 600, 700, 800, 900, 1000)
ABBREVIATED_WEIGHTS = ("UL", "EL", "L", "R", "M", "DB", "B", "EB", "H", "BL")
ABBREVIATED_WEIGHTS = ("UL", "EL", "L", "R", "M", "SB", "B", "EB", "H", "BL")
STANDARD_WEIGHTS = ("Ultralight", "Extralight", "Light", "Regular", "Medium", "Semibold", "Bold", "Extrabold", "Heavy", "Black")


Expand Down
22 changes: 18 additions & 4 deletions Package/otRebuilder/Lib/Rebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,15 +630,29 @@ def __rebuildName(self):
enLgcFmly = enFamily + u" " + enSubfamily
if style:
slCode = style.get("styleLink")
if slCode in [2, 4]:
enLgcFmly = enFamily
elif slCode == Constants.STYLELINK_REGULAR:
if slCode == Constants.STYLELINK_REGULAR:
for styl in Constants.REGULAR_STYLES:
# Use regex for case-insensitive removal
enLgcFmly = re.sub(r"(?i)\b" + styl + r"\b", "", enLgcFmly)
for styl in Constants.CJK_REGULAR_WEIGHTS:
enLgcFmly = re.sub(r"(?i)\b" + styl + r"\b", "", enLgcFmly)
elif slCode == Constants.STYLELINK_ITALIC:
elif slCode == Constants.STYLELINK_BOLD:
for styl in Constants.BOLD_STYLES:
enLgcFmly = re.sub(r"(?i)\b" + styl + r"\b", "", enLgcFmly)
for styl in Constants.CJK_BOLD_WEIGHTS:
enLgcFmly = re.sub(r"(?i)\b" + styl + r"\b", "", enLgcFmly)
elif slCode == Constants.STYLELINK_ITALIC: # Which represents for "Regular Italic"
for styl in Constants.REGULAR_STYLES:
enLgcFmly = re.sub(r"(?i)\b" + styl + r"\b", "", enLgcFmly)
for styl in Constants.CJK_REGULAR_WEIGHTS:
enLgcFmly = re.sub(r"(?i)\b" + styl + r"\b", "", enLgcFmly)
for styl in Constants.ITALIC_STYLES:
enLgcFmly = re.sub(r"(?i)\b" + styl + r"\b", "", enLgcFmly)
elif slCode == Constants.STYLELINK_BOLDITALIC:
for styl in Constants.BOLD_STYLES:
enLgcFmly = re.sub(r"(?i)\b" + styl + r"\b", "", enLgcFmly)
for styl in Constants.CJK_BOLD_WEIGHTS:
enLgcFmly = re.sub(r"(?i)\b" + styl + r"\b", "", enLgcFmly)
for styl in Constants.ITALIC_STYLES:
enLgcFmly = re.sub(r"(?i)\b" + styl + r"\b", "", enLgcFmly)
else:
Expand Down
4 changes: 2 additions & 2 deletions Package/otRebuilder/otrebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


usageStr = "usage: otrebuild [options] <inputFont>"
descriptionStr = """ OpenType Font Rebuilder: Version 1.5.3, powered by fontTools
descriptionStr = """ OpenType Font Rebuilder: Version 1.5.4, powered by fontTools
This is a simple tool to resolve naming, styling and mapping issues
among OpenType fonts. Without any options given, it can scan and
Expand All @@ -50,7 +50,7 @@
such as InDesign and Illustrator. `MATH` table is currently
not supported; please rebuild it after application.
--otf2ttf: For CFF-based font only. Convert a CFF-based font
into TrueType-outline font. Glyph bounding boxes and
into a TrueType-outline font. Glyph bounding boxes and
min/max values will be automatically recalculated. This
option would be ignored if a TrueType font is specified.
--macOffice: Add standard weight strings onto Mac English
Expand Down
2 changes: 1 addition & 1 deletion Package/otrebuilder.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: otrebuilder
Version: 1.5.3
Version: 1.5.4
Summary: A simple tool to resolve OpenType fonts' mapping and naming issues, powered by fontTools.
Home-page: https://github.com/Pal3love/otRebuilder
Author: Pal3love
Expand Down
1 change: 1 addition & 0 deletions config_template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -- Version: 1.5 --
# -- Format: TOML --
# -- Encoding: UTF-8(with/without BOM) --
# -- This configuration file is CASE-SENSITIVE. --
# -- Almost all options are **optional**. Just comment or delete any unnecessary options.--


Expand Down
1 change: 1 addition & 0 deletions config_template_CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -- 版本: 1.5 --
# -- 格式: TOML --
# -- 编码: UTF-8(有无 BOM 均可)--
# -- 该配置文件区分大小写。--
# -- 配置文件中的所有项都是**可选的**,将不必要的选项注释掉或者干脆删掉即可。--


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name = "otrebuilder",
version = "1.5.3",
version = "1.5.4",
description = "A simple tool to resolve OpenType fonts' mapping and naming issues, powered by fontTools.",
author = "Pal3love",
author_email = "pal3love@gmail.com",
Expand Down

0 comments on commit 8df44aa

Please sign in to comment.