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 wrong specialities matching
[why] When the name to parse has 'for' in it - even when it is in the middle of a word like 'formidable', 'unfortunate', or, 'forced' the "For" part will be cut off and separated from the rest. [how] The reason is the code to remove 'For Powerline' from font names. Instead of matching 'For' and 'Powerline' individually and then removing the 'Powerline' and 'For' token later on (which fails if there is just a 'For' token like with 'Un' 'For' 'Tunate'), we now match only on a 'For' if it is followed by a 'Powerline'. To make the removal of the other-token easier later on we rename/unify the token to be CamelCase. Fixes: #1877 Reported-by: @mietzen Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
		| @@ -112,10 +112,9 @@ class FontnameParser: | ||||
|     def drop_for_powerline(self): | ||||
|         """Remove 'for Powerline' from all names (can not be undone)""" | ||||
|         if 'Powerline' in self.other_token: | ||||
|             idx = self.other_token.index('Powerline') | ||||
|             self.other_token.pop(idx) | ||||
|             if idx > 0 and self.other_token[idx - 1] == 'For': | ||||
|                 self.other_token.pop(idx - 1) | ||||
|             self.other_token.remove('Powerline') | ||||
|         if 'ForPowerline' in self.other_token: | ||||
|             self.other_token.remove('ForPowerline') | ||||
|         self._basename = re.sub(r'(\b|for\s?)?powerline\b', '', self._basename, 1, re.IGNORECASE).strip() | ||||
|         self.add_name_substitution_table(self.name_subst) # re-evaluate | ||||
|         return self | ||||
|   | ||||
| @@ -67,6 +67,8 @@ class FontnameTools: | ||||
|             'book':         '', | ||||
|             'ce':           'CE', | ||||
|             'normal':       'Regular', | ||||
|             'powerline':    'Powerline', | ||||
|             'forpowerline': 'ForPowerline', | ||||
|         } | ||||
|         return known_names.get(style_name.lower(), style_name) | ||||
|  | ||||
| @@ -421,7 +423,7 @@ class FontnameTools: | ||||
|         weights = [ w for w in weights if w not in FontnameTools.known_styles ] | ||||
|         # Some font specialities: | ||||
|         other = [ | ||||
|             '-', 'Book', 'For', 'Powerline', | ||||
|             '-', 'Book', r'(?:for[- ])?powerline', | ||||
|             'IIx',              # Profont IIx | ||||
|             'LGC',              # Inconsolata LGC | ||||
|             r'\bCE\b',          # ProggycleanTT CE | ||||
|   | ||||
| @@ -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.4" | ||||
| script_version = "4.20.5" | ||||
|  | ||||
| version = "3.4.0" | ||||
| projectName = "Nerd Fonts" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user