You've already forked nerd-fonts
							
							
				mirror of
				https://github.com/ryanoasis/nerd-fonts.git
				synced 2025-10-30 23:43:47 +02:00 
			
		
		
		
	font-patcher: Fix patching of fonts with slashes in name
[why] When trying to patch Anka/Coder fontforge reports it can not open the font file. [how] When opening a font file we open all fonts within that file. For a ttf or otf that is one font, but ttc can contain multiple fonts (of course). The fontforge open function takes the font filename and the subfont name in parenteses appended to the font filename. For example `directory/folder/myfont.ttf` which contains just MyFont, it opens via `directory/folder/myfont.ttf(MyFont)`. That algorithm is not very smart, and so this fails `directory/folder/AnkaCoder-r.ttf(Anka/Coder)` because it assumes the directory goes up to the last slash and takes `Coder)` as filename. But instead of using the concrete subfont name we can also specify the index of the subfont in the font file, and that circumvents the problem. [note] The TTC opening feature is not well documented in Fontforge, best described here: https://fontforge.org/docs/ui/menus/filemenu.html#the-file-menu Fixes: #1879 Reported-by: @oktoling Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
		| @@ -6,7 +6,7 @@ | ||||
| from __future__ import absolute_import, print_function, unicode_literals | ||||
|  | ||||
| # Change the script version when you edit this script: | ||||
| script_version = "4.20.3" | ||||
| script_version = "4.20.4" | ||||
|  | ||||
| version = "3.4.0" | ||||
| projectName = "Nerd Fonts" | ||||
| @@ -2273,7 +2273,7 @@ def main(): | ||||
|           print("\n") | ||||
|           logger.info("Processing %s (%d/%d)", subfont, i + 1, len(all_fonts)) | ||||
|         try: | ||||
|             sourceFonts.append(fontforge.open("{}({})".format(args.font, subfont), 1)) # 1 = ("fstypepermitted",)) | ||||
|             sourceFonts.append(fontforge.open("{}({})".format(args.font, i), 1)) # 1 = ("fstypepermitted",)) | ||||
|         except Exception: | ||||
|             logger.critical("Can not open font '%s', try to open with fontforge interactively to get more information", | ||||
|                 subfont) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user