From 89f694351e502412a4cfec8067ca2cc4292024aa Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 5 Dec 2018 22:13:24 -0800 Subject: [PATCH] next: structify font --- fontland/fontland/cff-glyph.rkt | 20 -------------------- fontland/fontland/subset.rkt | 33 --------------------------------- 2 files changed, 53 deletions(-) delete mode 100644 fontland/fontland/cff-glyph.rkt diff --git a/fontland/fontland/cff-glyph.rkt b/fontland/fontland/cff-glyph.rkt deleted file mode 100644 index 80a1a5c8..00000000 --- a/fontland/fontland/cff-glyph.rkt +++ /dev/null @@ -1,20 +0,0 @@ -#lang racket/base - - -#| -approximates -https://github.com/mbutterick/fontkit/blob/master/src/glyph/CFFGlyph.js -|# - -#;(define-subclass Glyph (CFFGlyph) - (error 'cff-glyph-unimplemented) - - #;(define/override (_getName this) - (->m any/c) - (if (send (· this _font) _getTable 'CFF2) - (super _getName) - (send (send (· this _font) _getTable 'CFF_) getGlyphName (· this id)))) - (as-methods - #;_getName - #;bias - #;_getPath)) diff --git a/fontland/fontland/subset.rkt b/fontland/fontland/subset.rkt index 9a9ce935..85b0a408 100644 --- a/fontland/fontland/subset.rkt +++ b/fontland/fontland/subset.rkt @@ -53,39 +53,6 @@ https://github.com/mbutterick/fontkit/blob/master/src/subset/CFFSubset.js |# -#| -;; no CFF font support for now - -(define-subclass Subset (CFFSubset) - #R (· this font) - (field [cff (send (· this font) _getTable 'CFF_)]) - (unless (· this cff) (error 'not-a-cff-font)) - (field [charStrings #f] - [subrs #f]) - - (as-methods - subsetCharstrings - #;subsetSubrs - #;subsetFontdict - #;createCIDFontdict - #;addString - #;encode)) - -(define/contract (subsetCharstrings this) - (->m void?) - (set-field! charStrings this null) - (define gsubrs (make-hash)) - (for ([gid (in-list (· this glyphs))]) - (push-end-field! charStrings this (· this cff getCharString gid)) - (define glyph (· this font getGlyph gid)) - (define path (· glyph path)) ; this causes the glyph to be parsed - (for ([subr (in-list (· glyph _usedGsubrs))]) - (hash-set! gsubrs subr #true))) - (set-field! this gsubrs (send this subsetSubrs (· this cff globalSubrIndex) gsubrs)) - (void)) - - -|# #| approximates