don't panic about unhinted ttf fonts

main
Matthew Butterick 6 years ago
parent 33ca3ccb07
commit af0dfda4f4

@ -284,15 +284,23 @@ https://github.com/mbutterick/fontkit/blob/master/src/subset/TTFSubset.js
(define new-tables
(let ()
;; unhinted ttfs don't have `cvt_` `prep` or `fpgm`;
;; so fill in dummy data
(define kvs (dictify 'head new-head-table
'hhea new-hhea-table
'loca (ttf-subset-loca ss)
'maxp new-maxp-table
'cvt_ (get-cvt_-table (subset-font ss))
'prep (get-prep-table (subset-font ss))
'cvt_ (if (has-table? (subset-font ss) 'cvt_)
(get-cvt_-table (subset-font ss))
(hash 'controlValues (list 0)))
'prep (if (has-table? (subset-font ss) 'prep)
(get-prep-table (subset-font ss))
(hash 'controlValueProgram (list 0)))
'glyf (ttf-subset-glyf ss)
'hmtx (ttf-subset-hmtx ss)
'fpgm (get-fpgm-table (subset-font ss))))
'fpgm (if (has-table? (subset-font ss) 'fpgm)
(get-fpgm-table (subset-font ss))
(hash 'instructions (list 0)))))
(for ([(k v) (in-dict kvs)]
#:unless v)
(error 'encode (format "missing value for ~a" k)))

Loading…
Cancel
Save