mirror of
https://github.com/nicoverbruggen/kobo-font-fix.git
synced 2026-03-29 13:30:08 +02:00
Remove WWS family names to avoid confusion
This commit is contained in:
11
kobofix.py
11
kobofix.py
@@ -563,7 +563,7 @@ class FontProcessor:
|
|||||||
remove_gpos: bool,
|
remove_gpos: bool,
|
||||||
font_path: str,
|
font_path: str,
|
||||||
new_name: Optional[str] = None,
|
new_name: Optional[str] = None,
|
||||||
remove_prefix: Optional[str] = None
|
remove_prefix: Optional[str] = None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""
|
"""
|
||||||
Process a single font file.
|
Process a single font file.
|
||||||
@@ -577,6 +577,15 @@ class FontProcessor:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f" Failed to open font: {e}")
|
logger.error(f" Failed to open font: {e}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Remove WWS family names (IDs 21 and 22) to prevent confusion when determining best family name
|
||||||
|
if font["name"]:
|
||||||
|
old_names_list = font["name"].names
|
||||||
|
names_to_remove = [21, 22]
|
||||||
|
new_names_list = [n for n in old_names_list if n.nameID not in names_to_remove]
|
||||||
|
if len(new_names_list) < len(old_names_list):
|
||||||
|
font["name"].names = new_names_list
|
||||||
|
logger.info(" Removed WWS Family Name (ID 21) and WWS Subfamily Name (ID 22).")
|
||||||
|
|
||||||
# Determine the effective font name, checking for `--remove-prefix` first
|
# Determine the effective font name, checking for `--remove-prefix` first
|
||||||
effective_name = new_name
|
effective_name = new_name
|
||||||
|
|||||||
Reference in New Issue
Block a user