Skip to content

Commit

Permalink
0.8.0: pseudo-simplified variants
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanoHao committed May 11, 2020
1 parent 52f5be0 commit fedaf1e
Show file tree
Hide file tree
Showing 6 changed files with 4,167 additions and 31 deletions.
10 changes: 9 additions & 1 deletion README-Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

镜像:[Gitee](https://gitee.com/nowar-fonts/Nowar-Sans)

有爱黑体有 5 种字重和 7 种地区变体,此外还有若干特性。
有爱黑体有 5 种字重和 9 种地区变体,此外还有若干特性。

### 字重

Expand Down Expand Up @@ -48,8 +48,16 @@ CN、TW、HK、JP、CL 中,各语言都采用相同的字形标准。
| JP | 日本字形(UI) | 日本字形 |
| CL | 传统字形(UI) | 传统字形 |

PSimp、PSimpChat 是针对繁体中文的变体,把繁体字重映射为简化字字形。

| | 通用字体 | 繁体中文文本、战斗、工具提示字体 | 繁体中文聊天字体 | 西文、简体中文、韩国语 |
| --------- | --------------------------| --------------------- | --------------------- | ------ |
| PSimp | 中国大陆字形(UI,重映射)| 中国大陆字形(重映射)| 中国大陆字形 | 不可用 |
| PSimpChat | 中国大陆字形(UI,重映射)| 中国大陆字形(重映射)| 中国大陆字形(重映射)| 不可用 |

* 西文:英语、西班牙语(拉丁美洲)、葡萄牙语、德语、西班牙语(欧洲)、法语、意大利语、俄语。
* UI:中西文共用的标点视作西文标点;半角 CJK 标点。
* 通用字体:`FRIZQT__``ARIALN`。某些插件硬编码了此字体。

### 特性

Expand Down
14 changes: 11 additions & 3 deletions README-Hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

鏡像:[Gitee](https://gitee.com/nowar-fonts/Nowar-Sans)

有愛黑體有 5 種字重和 7 種地區變體,此外還有若干特徵。
有愛黑體有 5 種字重和 9 種地區變體,此外還有若干特徵。

### 字重

Expand All @@ -33,23 +33,31 @@

Neut 和 Bliz 中,不同語言採用不同的字形標準。

| | 西文和韩国语 | 简体中文 | 繁體中文 | 备注 |
| | 西文和韓國語 | 簡體中文 | 繁體中文 | 備注 |
| ---- | ----------------- | ------------ | -------- | ------------------------------- |
| Neut | 傳統字形(UI) | 中國大陸字形 | 臺灣字形 | 未指定字形標準時,採用傳統字形。|
| Bliz | 中國大陸字形(UI)| 中國大陸字形 | 臺灣字形 | 遵從《魔獸世界》預設字型設定。 |

CN、TW、HK、JP、CL 中,各語言都採用相同的字形標準。

| | 西文和韩国语 | 中文 |
| | 西文和韓國語 | 中文 |
| -- | ----------------- | ------------ |
| CN | 中國大陸字形(UI)| 中國大陸字形 |
| TW | 臺灣字形(UI) | 臺灣字形 |
| HK | 香港字形(UI) | 香港字形 |
| JP | 日本字形(UI) | 日本字形 |
| CL | 傳統字形(UI) | 傳統字形 |

PSimp、PSimpChat 是針對繁體中文的變體,把繁體字重對映為簡化字字形。

| | 通用字型 | 繁體中文文本、戰鬥、提示訊息字型 | 繁體中文聊天字型 | 西文、簡體中文、韓國語 |
| --------- | --------------------------| --------------------- | --------------------- | ------ |
| PSimp | 中國大陸字形(UI,重對映)| 中國大陸字形(重對映)| 中國大陸字形 | 不適用 |
| PSimpChat | 中國大陸字形(UI,重對映)| 中國大陸字形(重對映)| 中國大陸字形(重對映)| 不適用 |

* 西文:英語、西班牙語(拉丁美洲)、葡萄牙語、德語、西班牙語(歐洲)、法語、義大利語、俄語。
* UI:中西文共用的標點視作西文標點;半形 CJK 標點。
* 通用字型:`FRIZQT__``ARIALN`。某些插件硬編碼了此字型。

### 特徵

Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is Nowar Sans, font packs for _World of Warcraft_ and _WoW Classic_ that su

Mirrors: [Gitee (Release Repo)](https://gitee.com/nowar-fonts/Nowar-Sans)

Nowar Sans is shipped in 5 weights and 7 regional variants, with several features.
Nowar Sans is shipped in 5 weights and 9 regional variants, with several features.

### Weights

Expand Down Expand Up @@ -48,16 +48,24 @@ CN, TW, HK, JP and CL are single-orthography variants.
| JP | Japan (UI) | Japan |
| CL | Classical (UI) | Classical |

PSimp and PSimpChat are special variants for 繁體中文 that remap traditional Chinese character to simplified ones.

| | Common Fonts | 繁體中文 Text, Combat and Tooltip Fonts | 繁體中文 Chat Fonts | European, 简体中文 and 한국어 |
| --------- | ----------------------------- | ------------------------- | ------------------------- | --- |
| PSimp | Mainland China (UI, Remapped) | Mainland China (Remapped) | Mainland China | N/A |
| PSimpChat | Mainland China (UI, Remapped) | Mainland China (Remapped) | Mainland China (Remapped) | N/A |

* European: English, Español (AL), Português, Deutsch, Español (EU), Français, Italiano, and Русский.
* UI: Ambiguous punctations are treated as Western; CJK puctations are half-width.
* Common fonts: `FRIZQT__` and `ARIALN`, which are hard-coded in some addons.

### Features

| Tag | Name | Description |
| --- | ----------- | ---------------------------------------------------------------------- |
| OSF | Oldstyle | Oldstyle (non-lining), propotional figure. |
| SC | Smallcaps | Small capitals for Latin. |
| RP | Roleplaying | `` (U+4E36) is mapped to the same glyph as `·` (U+00B7, MIDDLE DOT). |
| SC | Smallcaps | Small capitals for Latin. |

Pre-built feature variants: `Neut,OSF`, `Neut,SC`, `Bliz,OSF`, `Bliz,SC`, `CN,RP`.

Expand Down Expand Up @@ -91,7 +99,7 @@ Then make a specific variant:
```bash
make <region>,<features>-<weight> -j<threads>
```
Note: Features must be identically sorted as mentioned above. (`OSF`, `SC`, `RP`).
Note: Features must be sorted alphabetically. (`OSF`, `RP`, `SC`).

e.g.
```bash
Expand Down Expand Up @@ -149,3 +157,5 @@ make CNmulti,OSF-400 -j4
Latin, Greek and Cyrillic characters are from [Noto Sans](https://github.com/googlei18n/noto-fonts) by Google.

CJK Ideographs, Kana and Hangul are from [Source Han Sans](https://github.com/adobe-fonts/source-han-sans) by Adobe.

The traditional Chinese to simplified Chinese conversion table is from [Open Chinese Convert project](https://github.com/BYVoid/OpenCC).
114 changes: 90 additions & 24 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@


class Config:
version = "0.7.3"
fontRevision = 0.0703
version = "0.8.0"
fontRevision = 0.0800
vendor = "Nowar Typeface"
vendorId = "NOWR"
vendorUrl = "https://github.com/nowar-fonts"
Expand All @@ -19,12 +19,9 @@ class Config:
licenseUrl = "https://scripts.sil.org/OFL"

fontPackWeight = [300, 372, 400, 500, 700]
fontPackRegion = ["Neut", "Bliz", "CN", "TW", "HK", "JP", "CL"]
fontPackFeature = ["OSF", "SC", "RP"]
# feature tags must be identically ordered as in fontPackFeature
# e.g.
# ("CN", ["OSF", "RP"]), "RP" is ordered after "OSF",
# as it is ordered after "OSF" in fontPackFeature.
fontPackRegion = ["Neut", "Bliz", "CN", "TW", "HK", "JP", "CL", "PSimp", "PSimpChat"]
fontPackFeature = ["OSF", "RP", "SC"]
# feature tags must be sorted alphabetically
fontPackExportFeature = [
("Bliz", ["OSF"]), ("Bliz", ["SC"]),
("Neut", ["OSF"]), ("Neut", ["SC"]),
Expand All @@ -45,7 +42,8 @@ class Config:
config = Config()


# define Chinese characters orthographies for diffrent WoW language:
# define Chinese characters orthographies, and feature mods:
#
# base - common fonts, `FRIZQT__` and `ARIALN`; must be defined
# enUS - fonts for languages in Latin script, `skurri` and `MORPHEUS`
# if set to something to be true, the orthography is considered to be same as `base`
Expand All @@ -54,6 +52,12 @@ class Config:
# zhCN - fonts for 简体中文; can be false
# zhTW - fonts for 繁體中文; can be false
# koKR - fonts for 한국어; can be false
#
# xmod - a list of tuples of feature mod and related parameter list
# available mods:
# PSimp - 伪简体, remap traditional Chinese characters to simplified ones in zhTW text, damage, and note font
# base - also do remapping in common fonts (`FRIZQT__` and `ARIALN`)
# chat - also do remapping in zhTW chat fonts (`arheiuhk_bd` for Battle and `bHEI01B` for Classic)
regionalVariant = {
"Neut": {
"base": "CL",
Expand Down Expand Up @@ -111,6 +115,24 @@ class Config:
"zhTW": "CL",
"koKR": "CL",
},
"PSimp": {
"base": "CN",
"enUS": None,
"ruRU": None,
"zhCN": None,
"zhTW": "CN",
"koKR": None,
"xmod": [("PSimp", ["base"])],
},
"PSimpChat": {
"base": "CN",
"enUS": None,
"ruRU": None,
"zhCN": None,
"zhTW": "CN",
"koKR": None,
"xmod": [("PSimp", ["base", "chat"])],
},
"CNmulti": { # deprecated, previously “CN”
"base": "CN",
"enUS": True,
Expand Down Expand Up @@ -294,11 +316,13 @@ class LanguageId(enum.IntEnum):
"GB": "GB18030",
}

# sorted alphabetically
featureNameMap = {
"UI": "UI",
"OSF": "Oldstyle",
"SC": "Smallcaps",
"RP": "Roleplaying",
"SC": "Smallcaps",
"Simp": "Simplified",
"UI": "UI",
}

tagNameMap = {**regionNameMap, **featureNameMap}
Expand Down Expand Up @@ -362,14 +386,10 @@ def TagListToStr(lst):
return ",".join(lst)


def GetTagStr(p):
return TagListToStr([p["region"]] + p["feature"])


def GenerateFontName(p):
localizedFamily = LocalizedFamily(p)
region = p["region"]
feature = p["feature"]
feature = [*sorted(p["feature"])]

regionName = regionNameMap[region]
subfamily = [tagNameMap[fea] for fea in feature]
Expand Down Expand Up @@ -423,7 +443,7 @@ def formatSubfamily(sf):

subfamily = formatSubfamily(subfamily)
filenameF = localizedFamily[LanguageId.enUS].replace(" ", "")
filenameTag = GetTagStr(p)
filenameTag = TagListToStr([p["region"], *sorted(p["feature"])])
filenameSf = formatSubfamily(filenameSf).replace(" ", "")
wwsF = formatFamily(wwsF)
wwsSf = formatSubfamily(wwsSf)
Expand Down Expand Up @@ -488,6 +508,36 @@ def ResolveDependency(p):
return result


def GetCommonFont(weight, region, feature):
xfea = []
for mod, params in regionalVariant[region].get("xmod", []):
if mod == "PSimp" and "base" in params:
xfea.append("Simp")
return {
"weight": weight,
"width": 7,
"family": "Nowar",
"region": regionalVariant[region]["base"],
"feature": ["UI"] + feature + xfea,
"encoding": "unspec",
}


def GetCommonChatFont(weight, region, feature):
xfea = []
for mod, params in regionalVariant[region].get("xmod", []):
if mod == "PSimp" and "base" in params:
xfea.append("Simp")
return {
"weight": weight,
"width": 3,
"family": "Nowar",
"region": regionalVariant[region]["base"],
"feature": ["UI"] + feature + xfea,
"encoding": "unspec",
}


def GetLatinFont(weight, region, feature):
return {
"weight": weight,
Expand Down Expand Up @@ -544,45 +594,61 @@ def GetHansChatFont(weight, region, feature):


def GetHantFont(weight, region, feature):
xfea = []
for mod, _ in regionalVariant[region].get("xmod", []):
if mod == "PSimp":
xfea.append("Simp")
return {
"weight": weight,
"width": 10,
"family": "Nowar",
"region": regionalVariant[region]["zhTW"],
"feature": feature,
"feature": feature + xfea,
"encoding": "big5",
}


def GetHantCombatFont(weight, region, feature):
xfea = []
for mod, _ in regionalVariant[region].get("xmod", []):
if mod == "PSimp":
xfea.append("Simp")
return {
"weight": weight,
"width": 7,
"family": "Nowar",
"region": regionalVariant[region]["zhTW"],
"feature": feature,
"feature": feature + xfea,
"encoding": "big5",
}


def GetHantNoteFont(weight, region, feature):
xfea = []
for mod, _ in regionalVariant[region].get("xmod", []):
if mod == "PSimp":
xfea.append("Simp")
return {
"weight": weight,
"width": 5,
"family": "Nowar",
"region": regionalVariant[region]["zhTW"],
"feature": feature,
"feature": feature + xfea,
"encoding": "big5",
}


def GetHantChatFont(weight, region, feature):
xfea = []
for mod, params in regionalVariant[region].get("xmod", []):
if mod == "PSimp" and "chat" in params:
xfea.append("Simp")
return {
"weight": weight,
"width": 3,
"family": "Nowar",
"region": regionalVariant[region]["zhTW"],
"feature": feature,
"feature": feature + xfea,
"encoding": "big5",
}

Expand Down Expand Up @@ -670,8 +736,8 @@ def powerset(lst): return reduce(lambda result, x: result +
makefile["rule"]["all"]["depend"].append(pack)

fontlist = {
"ARIALN": GetLatinChatFont(w, r, fea),
"FRIZQT__": GetLatinFont(w, r, fea),
"ARIALN": GetCommonChatFont(w, r, fea),
"FRIZQT__": GetCommonFont(w, r, fea),
}

if regionalVariant[r]["enUS"]:
Expand Down Expand Up @@ -752,7 +818,7 @@ def powerset(lst): return reduce(lambda result, x: result +
}

# naming test
for w, r, wd, fea in product(config.globalFontWeight, ["CN", "CL"], [3, 5, 7, 10], [[], ["UI", "OSF", "SC", "RP"]]):
for w, r, wd, fea in product(config.globalFontWeight, ["CN", "CL"], [3, 5, 7, 10], [[], ["UI", "OSF", "SC", "RP", "Simp"]]):
param = {
"family": "Nowar",
"weight": w,
Expand Down
14 changes: 14 additions & 0 deletions merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ def GenerateAsianSymbolFont(font):
return symbolFont


def Simplify(font):
from opencc_t2s import OpenCC_T2S
cmap = asianFont['cmap']
for t, s in OpenCC_T2S.items():
us = str(ord(s))
if us in cmap:
ut = str(ord(t))
cmap[ut] = cmap[us]


if __name__ == '__main__':
param = sys.argv[1]
param = json.loads(param)
Expand Down Expand Up @@ -303,6 +313,10 @@ def GenerateAsianSymbolFont(font):
asianSymbolFont = GenerateAsianSymbolFont(asianFont)
MergeAbove(baseFont, asianSymbolFont)

# pseudo-simplified font
if "Simp" in param["feature"]:
Simplify(asianFont)

NowarRemoveFeatures(asianFont)
MergeBelow(baseFont, asianFont)

Expand Down
Loading

0 comments on commit fedaf1e

Please sign in to comment.