diff --git a/setup/sfntly.py b/setup/sfntly.py index 60d7808d5f..79a25a53f0 100644 --- a/setup/sfntly.py +++ b/setup/sfntly.py @@ -45,9 +45,9 @@ class SfntlyBuilderMixin(object): if iswindows: self.sfntly_cflags += [ '-D_UNICODE', '-DUNICODE', - ] + shlex.split('/Zi /nologo /W4 /WX /O2 /Ob2 /Oy /GF /Gm- /MT /GS /Gy ' - '/fp:precise /Zc:wchar_t /Zc:forScope /GR-') + ] + shlex.split('/W4 /WX /Gm- /Gy /GR-') else: + # Possibly add -fno-inline (slower, but more robust) self.sfntly_cflags += [ '-Werror', '-fno-exceptions', @@ -59,6 +59,11 @@ class SfntlyBuilderMixin(object): def __call__(self, obj_dir, compiler, linker, builder, cflags, ldflags): self.sfntly_build_dir = os.path.join(obj_dir, 'sfntly') + if '/Ox' in cflags: + cflags.remove('/Ox') + if '-O3' in cflags: + cflags.remove('-O3') + cflags.insert(0, '/O2' if iswindows else '-O2') groups = [] all_headers = set() diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index d6b3c9a400..2b00d63163 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -37,6 +37,11 @@ def test_freetype(): test() print ('FreeType OK!') +def test_sfntly(): + from calibre.utils.fonts.subset import test + test() + print ('sfntly OK!') + def test_winutil(): from calibre.devices.scanner import win_pnp_drives matches = win_pnp_drives.scanner() @@ -115,6 +120,7 @@ def test(): test_plugins() test_lxml() test_freetype() + test_sfntly() test_sqlite() test_qt() test_imaging() diff --git a/src/calibre/utils/fonts/subset.py b/src/calibre/utils/fonts/subset.py index 30d0109b30..41f0365cdf 100644 --- a/src/calibre/utils/fonts/subset.py +++ b/src/calibre/utils/fonts/subset.py @@ -93,6 +93,11 @@ def test_mem(): for i in xrange(3): gc.collect() print ('Leaked memory per call:', (memory() - start_mem)/calls*1024, 'KB') +def test(): + raw = P('fonts/liberation/LiberationSerif-Regular.ttf', data=True) + sf, old_stats, new_stats = subset(raw, set(('a', 'b', 'c')), ()) + if len(sf) > 0.3 * len(raw): + raise Exception('Subsetting failed') def main(args): import sys, time