mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2025-01-25 03:32:02 +02:00
name-parser: Allow generic renaming parts
[why] Some name parts occur in several fonts but they take too much length that we need to add 'Nerd Font' to the font name. This can be handled as 'generic' SIL table parts, but the algorithm stops searching for replacements one it has found one. [how] Always evaluate all rules of the SIL table. Add entries for generics to the SIL table. Add rule for BigBlueTerminal (437TT). Also fix rule for MPlus that underwent a naming change with its update. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
909a54ab5a
commit
725df33434
@ -81,18 +81,17 @@ class FontnameParser:
|
||||
self.name_subst = table
|
||||
self.basename = self._basename
|
||||
self.rest = self._rest
|
||||
base_and_rest = self._basename + (' ' + self._rest if len(self._rest) else '')
|
||||
for regex, replacement in self.name_subst:
|
||||
base_and_rest = self.basename + (' ' + self.rest if len(self.rest) else '')
|
||||
m = re.match(regex, base_and_rest, re.IGNORECASE)
|
||||
if not m:
|
||||
continue
|
||||
i = len(self._basename) - len(m.group(0))
|
||||
i = len(self.basename) - len(m.group(0))
|
||||
if i < 0:
|
||||
self.basename = m.expand(replacement)
|
||||
self.rest = self._rest[-(i+1):].lstrip()
|
||||
self.rest = self.rest[-(i+1):].lstrip()
|
||||
else:
|
||||
self.basename = m.expand(replacement) + self._basename[len(m.group(0)):]
|
||||
break
|
||||
self.basename = m.expand(replacement) + self.basename[len(m.group(0)):]
|
||||
return self
|
||||
|
||||
def drop_for_powerline(self):
|
||||
|
@ -186,10 +186,15 @@ class FontnameTools:
|
||||
( '(a)nka/(c)oder', r'\1na\2onder' ),
|
||||
( '(c)ascadia( ?)(c)ode', r'\1askaydia\2\3ove' ),
|
||||
( '(c)ascadia( ?)(m)ono', r'\1askaydia\2\3ono' ),
|
||||
( '(m)plus', r'\1+'), # Added this, because they use a plus symbol :->
|
||||
( '(m)( ?)plus', r'\1+'), # Added this, because they use a plus symbol :->
|
||||
( 'Gohufont', r'GohuFont'), # Correct to CamelCase
|
||||
# Noone cares that font names starting with a digit are forbidden:
|
||||
( 'IBM 3270', r'3270'), # for historical reasons and 'IBM' is a TM or something
|
||||
# Some name parts that are too long for us
|
||||
( '(.*)Latin Expanded', r'\1LatinX'), # for 'M PLUS Code Latin Expanded'
|
||||
( '(.*)Sans Mono', r'\1SM'), # Various SomenameSansMono fonts
|
||||
( '(b)ig( ?)(b)lue( ?)(t)erminal', r'\1ig\3lue\5erm'), # Shorten BigBlueTerminal
|
||||
( '(.*)437TT', r'\1437'), # Shorten BigBlueTerminal 437 TT even further
|
||||
]
|
||||
|
||||
# From https://adobe-type-tools.github.io/font-tech-notes/pdfs/5088.FontNames.pdf
|
||||
|
Loading…
x
Reference in New Issue
Block a user