diff options
author | Eevee (Lexy Munroe) <eevee.git@veekun.com> | 2016-06-08 16:48:10 -0700 |
---|---|---|
committer | Eevee (Lexy Munroe) <eevee.git@veekun.com> | 2016-06-08 16:48:10 -0700 |
commit | afff3b44df67a20845559eb33e723039fa501afe (patch) | |
tree | 94a51609b752fb711eed3573f21c7807a632873b | |
parent | 5ea9f2b58faa9b15da840da978632cbafcb550fa (diff) | |
download | pyscss-afff3b44df67a20845559eb33e723039fa501afe.tar.gz |
Fix fonts extension under Python 3, and fix expected output
-rw-r--r-- | scss/extension/fonts.py | 10 | ||||
-rw-r--r-- | scss/tests/files/fonts/fonts.css | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/scss/extension/fonts.py b/scss/extension/fonts.py index b772ceb..bc06e42 100644 --- a/scss/extension/fonts.py +++ b/scss/extension/fonts.py @@ -260,7 +260,7 @@ def font_sheet(g, **kwargs): height = float(m.group(1)) else: height = None - _glyph = tempfile.NamedTemporaryFile(delete=False, suffix=".svg") + _glyph = tempfile.NamedTemporaryFile(delete=False, suffix=".svg", mode='w') _glyph.file.write(svgtext) _glyph.file.close() yield _glyph.name, width, height @@ -294,7 +294,7 @@ def font_sheet(g, **kwargs): try: if type_ == 'eot': ttf_path = asset_paths['ttf'] - with open(ttf_path) as ttf_fh: + with open(ttf_path, 'rb') as ttf_fh: contents = ttf2eot(ttf_fh.read()) if contents is not None: with open(asset_path, 'wb') as asset_fh: @@ -304,7 +304,7 @@ def font_sheet(g, **kwargs): if type_ == 'ttf': contents = None if autohint: - with open(asset_path) as asset_fh: + with open(asset_path, 'rb') as asset_fh: contents = ttfautohint(asset_fh.read()) if contents is not None: with open(asset_path, 'wb') as asset_fh: @@ -330,7 +330,7 @@ def font_sheet(g, **kwargs): contents = None if type_ == 'eot': ttf_path = asset_paths['ttf'] - with open(ttf_path) as ttf_fh: + with open(ttf_path, 'rb') as ttf_fh: contents = ttf2eot(ttf_fh.read()) if contents is None: continue @@ -338,7 +338,7 @@ def font_sheet(g, **kwargs): _tmp = tempfile.NamedTemporaryFile(delete=False, suffix='.' + type_) _tmp.file.close() font.generate(_tmp.name) - with open(_tmp.name) as asset_fh: + with open(_tmp.name, 'rb') as asset_fh: if autohint: if type_ == 'ttf': _contents = asset_fh.read() diff --git a/scss/tests/files/fonts/fonts.css b/scss/tests/files/fonts/fonts.css index b6d3215..77ce3a9 100644 --- a/scss/tests/files/fonts/fonts.css +++ b/scss/tests/files/fonts/fonts.css @@ -1,10 +1,10 @@ @font-face { font-family: 'FontSheet'; src: url(static/assets/fontsheet-g7MrCA_HKKgVf2zD68L54g.eot); - src: url(static/assets/fontsheet-g7MrCA_HKKgVf2zD68L54g.svg?#iefix&#fontsheet) format('svg'), + src: url(static/assets/fontsheet-g7MrCA_HKKgVf2zD68L54g.eot) format('embedded-opentype'), url(static/assets/fontsheet-g7MrCA_HKKgVf2zD68L54g.woff) format('woff'), url(static/assets/fontsheet-g7MrCA_HKKgVf2zD68L54g.ttf) format('truetype'), - url(static/assets/fontsheet-g7MrCA_HKKgVf2zD68L54g.eot) format('embedded-opentype'); + url(static/assets/fontsheet-g7MrCA_HKKgVf2zD68L54g.svg?#iefix&#fontsheet) format('svg'); font-weight: normal; font-style: normal; } |