Fix some font directories from fonts.conf being ignored on linux when scanning the system for installed fonts. Fixes #1339257 [some font directories are ignored](https://bugs.launchpad.net/calibre/+bug/1339257)

This commit is contained in:
Kovid Goyal 2014-07-09 09:19:14 +05:30
parent 4b20fbbf10
commit da29398a26

View File

@ -78,15 +78,20 @@ def fc_list():
end(str_list)
if len(ans) < 3:
return default_font_dirs()
parents = []
parents, visited = [], set()
for f in ans:
found = False
for p in parents:
if f.startswith(p):
found = True
path = os.path.normpath(os.path.abspath(os.path.realpath(f)))
if path == '/':
continue
head, tail = os.path.split(path)
while head and tail:
if head in visited:
break
if not found:
parents.append(f)
head, tail = os.path.split(head)
else:
parents.append(path)
visited.add(path)
return parents