mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-21 05:31:30 +02:00
Cleanup get_path usage in favor of pkg_resources.
This commit is contained in:
@@ -195,8 +195,7 @@ class FontScanner(Thread):
|
||||
|
||||
def __init__(self, folders=[], allowed_extensions={'ttf', 'otf'}):
|
||||
Thread.__init__(self)
|
||||
self.folders = folders + font_dirs() + [os.path.join(config_dir, 'fonts'),
|
||||
P('fonts/liberation')]
|
||||
self.folders = folders + font_dirs()
|
||||
self.folders = [os.path.normcase(os.path.abspath(font)) for font in
|
||||
self.folders]
|
||||
self.font_families = ()
|
||||
|
||||
@@ -451,6 +451,7 @@ def get_font_for_text(text, candidate_font_data=None):
|
||||
|
||||
def test_glyph_ids():
|
||||
from ebook_converter.utils.fonts.free_type import FreeType
|
||||
# TODO(gryf): move this test to test files
|
||||
data = P('fonts/liberation/LiberationSerif-Regular.ttf', data=True)
|
||||
ft = FreeType()
|
||||
font = ft.load_font(data)
|
||||
@@ -462,6 +463,7 @@ def test_glyph_ids():
|
||||
|
||||
|
||||
def test_supports_text():
|
||||
# TODO(gryf): move this test to test files
|
||||
data = P('fonts/calibreSymbols.otf', data=True)
|
||||
if not supports_text(data, '.★½'):
|
||||
raise RuntimeError('Incorrectly returning that text is not supported')
|
||||
@@ -470,6 +472,7 @@ def test_supports_text():
|
||||
|
||||
|
||||
def test_find_font():
|
||||
# TODO(gryf): move this test to test files
|
||||
from ebook_converter.utils.fonts.scanner import font_scanner
|
||||
abcd = '诶比西迪'
|
||||
family = font_scanner.find_font_for_text(abcd)[0]
|
||||
|
||||
Reference in New Issue
Block a user