name-parser: Fix SIL replacements

[why]
If the font name is changed in a way where it now ends in a blank (for
example because 'Name Momo' got 'Momo' dropped: 'Name '), that blank is
not removed immediately.
Well, it is later on, but anyhow.
This can only happen on malformed SIL entries. But we want to have a
correct replacement anyhow.

[how]
Remove trailing whitespace after replacements.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-04-20 15:52:19 +02:00
parent 1da85df08b
commit 848ed2500a

View file

@ -88,7 +88,7 @@ class FontnameParser:
continue
i = len(self.basename) - len(m.group(0))
if i < 0:
self.basename = m.expand(replacement)
self.basename = m.expand(replacement).rstrip()
self.rest = self.rest[-(i+1):].lstrip()
else:
self.basename = m.expand(replacement) + self.basename[len(m.group(0)):]