name-parser: Make PS length limit more lenient

[why]
The postscript font name length limit of 31 is only present in very old
post script printers. And even then it depends on the printing method.

Some of our well knows source fonts have longer PS names (Noto etc).

And the limit exists regardless of windows or not.

[how]
Let limit depend on PS name part (font name or family name).
Remove reference to windows compat mode.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-04-07 10:39:29 +02:00
parent ae656bad83
commit 619214c9ee

View file

@ -26,13 +26,14 @@ class FontnameParser:
def _make_ps_name(self, n, is_family):
"""Helper to limit font name length in PS names"""
fam = 'family ' if is_family else ''
if not self.for_windows or len(n) <= 31:
limit = 31 if is_family else 63
if len(n) <= limit:
return n
r = re.search('(.*)(-.*)', n)
if not r:
new_n = n[:31]
new_n = n[:limit]
else:
q = 31 - len(r.groups()[1])
q = limit - len(r.groups()[1])
if q < 1:
q = 1
print('Shortening too long PS {}name: Garbage warning'. format(fam))