File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -970,20 +970,21 @@ def print_figure_impl(fh):
970
970
971
971
# give ttconv a subsetted font
972
972
# along with updated glyph_ids
973
- with tempfile .NamedTemporaryFile (
974
- suffix = ".ttf"
975
- ) as tmp :
973
+ with TemporaryDirectory () as tmpdir :
974
+ tmpfile = os .path .join (tmpdir , "tmp.ttf" )
976
975
font = FT2Font (fontdata )
977
976
glyph_ids = [
978
977
font .get_char_index (c ) for c in chars
979
978
]
980
- tmp .write (fontdata .getvalue ())
981
- tmp .flush ()
979
+
980
+ with open (tmpfile , 'wb' ) as tmp :
981
+ tmp .write (fontdata .getvalue ())
982
+ tmp .flush ()
982
983
983
984
# TODO: allow convert_ttf_to_ps
984
985
# to input file objects (BytesIO)
985
986
convert_ttf_to_ps (
986
- os .fsencode (tmp . name ),
987
+ os .fsencode (tmpfile ),
987
988
fh ,
988
989
fonttype ,
989
990
glyph_ids ,
You can’t perform that action at this time.
0 commit comments