suppress some debug msgs

main
Matthew Butterick 7 years ago
parent 1b4a93214c
commit 1341eeb906

@ -22,38 +22,40 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GPOSProcessor.js
(define/override (applyLookup lookupType table)
(case lookupType
[(1) ;; Single positioning value
(report/file 'single-positioning-value)
#;(report/file 'single-positioning-value)
(define index (send this coverageIndex (· table coverage)))
(report/file index)
#;(report/file index)
(cond
[(= index -1) #f]
[else (case (report (· table version))
[else #;(report (· table version))
(case (· table version)
[(1) (send this applyPositionValue 0 (· table value))]
[(2) (send this applyPositionValue 0 (send (· table values) get index))])
#t])]
[(2) ;; Pair Adjustment Positioning
(report/file 'applyLookup:pair-adjustment)
#;(report/file 'applyLookup:pair-adjustment)
(define nextGlyph (· this glyphIterator peek))
(cond
[(not nextGlyph) #f]
[else
(report 'getting-pair-coverage-for)
(report* (· this glyphIterator cur id) (· this glyphIterator peek id) (· table coverage))
#;(report 'getting-pair-coverage-for)
#;(report* (· this glyphIterator cur id) (· this glyphIterator peek id) (· table coverage))
(define index (send this coverageIndex (· table coverage)))
(report index)
#;(report index)
(cond
[(= index -1) #f]
[else
(case (report (· table version))
#;(report (· table version))
(case (· table version)
[(1) ;; Adjustments for glyph pairs
(report 'glyph-pair)
#;(report 'glyph-pair)
(define set (send (· table pairSets) get index))
(for/first ([pair (in-list set)]
#:when (= (· pair secondGlyph) (· nextGlyph id)))
(send this applyPositionValue 0 (· pair value1))
(send this applyPositionValue 0 (· pair value2)))]
[(2) ;; Class pair adjustment
(report/file 'class-pair)
#;(report/file 'class-pair)
(define class1 (send this getClassID (· this glyphIterator cur id) (· table classDef1)))
(define class2 (send this getClassID (· nextGlyph id) (· table classDef2)))
(cond
@ -63,25 +65,25 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GPOSProcessor.js
(send this applyPositionValue 0 (· pair value2))
#t])])])])]
[(3) ;; Cursive Attachment Positioning
(report/file 'cursive-attachment-positioning-unimplemented)
#;(report/file 'cursive-attachment-positioning-unimplemented)
(void)]
[(4) ;; Mark to base positioning
(report/file 'mark-to-base-positioning-unimplemented)
#;(report/file 'mark-to-base-positioning-unimplemented)
(void)]
[(5) ;; Mark to ligature positioning
(report/file 'mark-to-ligature-positioning-unimplemented)
#;(report/file 'mark-to-ligature-positioning-unimplemented)
(void)]
[(6) ;; Mark to mark positioning
(report/file 'mark-to-mark-positioning-unimplemented)
#;(report/file 'mark-to-mark-positioning-unimplemented)
(void)]
[(7) ;; Contextual positioning
(report/file 'contextual-positioning-unimplemented)
#;(report/file 'contextual-positioning-unimplemented)
(void)]
[(8) ;; Chaining contextual positioning
(report/file 'chaining-contextual-positioning-unimplemented)
#;(report/file 'chaining-contextual-positioning-unimplemented)
(void)]
[(9) ;; Extension positioning
(report/file 'extension-contextual-positioning-unimplemented)
#;(report/file 'extension-contextual-positioning-unimplemented)
(void)]
[else
(raise-argument-error 'GPOSProcessor:applyLookup "supported GPOS table" lookupType)]))
@ -91,10 +93,10 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GPOSProcessor.js
(define/override (applyFeatures userFeatures glyphs advances)
(super applyFeatures userFeatures glyphs advances)
(report/file 'fixCursiveAttachment-unimplemented)
#;(report/file 'fixCursiveAttachment-unimplemented)
#;(for ([i (in-range (length (· this glyphs)))])
(send this fixCursiveAttachment i))
(report/file 'fixMarkAttachment-unimplemented)
#;(report/file 'fixMarkAttachment-unimplemented)
#;(send this fixMarkAttachment))

@ -10,10 +10,10 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GSUBProcessor.js
(define-subclass OTProcessor (GSUBProcessor)
(define/override (applyLookup lookupType table)
(report lookupType 'GSUBProcessor:applyLookup)
#;(report lookupType 'GSUBProcessor:applyLookup)
(case lookupType
[(1) ;; Single Substitution
(report 'single-substitution)
#;(report 'single-substitution)
(define index (send this coverageIndex (· table coverage)))
(cond
[(= index -1) #f]
@ -24,7 +24,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GSUBProcessor.js
[(2) (send (· table substitute) get index)]))
#t])]
[(2) ;; Multiple Substitution
(report 'multiple-substitution)
#;(report 'multiple-substitution)
(define index (send this coverageIndex (· table coverage)))
(cond
[(= index -1) #f]
@ -47,7 +47,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GSUBProcessor.js
#t])]
[(3) ;; Alternate substitution
(report 'alternate-substitution)
#;(report 'alternate-substitution)
(define index (send this coverageIndex (· table coverage)))
(cond
[(= index -1) #f]
@ -56,29 +56,29 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GSUBProcessor.js
#t])]
[(4) ;; Ligature substitution
(report '---------------------------)
(report 'ligature-substitution)
(report* lookupType (· table coverage glyphs))
#;(report '---------------------------)
#;(report 'ligature-substitution)
#;(report* lookupType (· table coverage glyphs))
(define index (send this coverageIndex (· table coverage)))
(report index 'forker)
#;(report index 'forker)
(cond
[(= index -1) #f]
[(for*/or ([ligature (in-list (report (send (· table ligatureSets) get (report index 'starting-index))))]
[matched (in-value (send this sequenceMatchIndices 1 (report (· ligature components))))]
#:when (report matched))
[(for*/or ([ligature (in-list (send (· table ligatureSets) get index))]
[matched (in-value (send this sequenceMatchIndices 1 (· ligature components)))]
#:when matched)
(define curGlyph (· this glyphIterator cur))
;; Concatenate all of the characters the new ligature will represent
(define characters
(append (· curGlyph codePoints)
(append* (for/list ([index (in-list matched)])
(report index)
index
(get-field codePoints (list-ref (· this glyphs) index))))))
(report characters)
characters
;; Create the replacement ligature glyph
(define ligatureGlyph (+GlyphInfo (· this font) (· ligature glyph) characters (· curGlyph features)))
(report (· ligatureGlyph id))
(· ligatureGlyph id)
(set-field! shaperInfo ligatureGlyph (· curGlyph shaperInfo))
(set-field! isLigated ligatureGlyph #t)
(set-field! substituted ligatureGlyph #t)
@ -124,9 +124,9 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GSUBProcessor.js
(set-field! ligatureComponent (list-ref (· this glyphs) i) ligatureComponent)))
;; Delete the matched glyphs, and replace the current glyph with the ligature glyph
(report (for/list ([g (· this glyphs)]) (· g id)) 'step-a)
(report matched)
(report (· this glyphIterator index))
#;(report (for/list ([g (· this glyphs)]) (· g id)) 'step-a)
#;(report matched)
#;(report (· this glyphIterator index))
(set-field! glyphs this (for*/list ([(glyph idx) (in-indexed (· this glyphs))]
[midx (in-list matched)]
#:unless (= idx midx))
@ -134,8 +134,8 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GSUBProcessor.js
ligatureGlyph
glyph)))
(set-field! glyphs (· this glyphIterator) (· this glyphs)) ; update glyph iterator to keep it in sync <sigh>
(report (for/list ([g (· this glyphs)]) (· g id)) 'step-c)
(report (· this glyphIterator index))
#;(report (for/list ([g (· this glyphs)]) (· g id)) 'step-c)
#;(report (· this glyphIterator index))
#t)]
[else #f])]
[(5) ;; Contextual Substitution

@ -53,13 +53,13 @@ https://github.com/mbutterick/fontkit/blob/master/src/layout/LayoutEngine.js
;; Substitute and position the glyphs
(set! glyphs (send this substitute glyphs features script language))
(report*/file 'end-sub glyphs)
#;(report*/file 'end-sub glyphs)
#;(error 'stop)
(report/file 'ready-position)
(report (for/list ((g (in-list glyphs))) (· g id)) 'shecky)
#;(report/file 'ready-position)
#;(report (for/list ((g (in-list glyphs))) (· g id)) 'shecky)
(define positions (send this position glyphs features script language))
(report (for/list ((p (in-list positions))) (list (· p xAdvance) (· p xOffset))))
(report/file 'fired-position)
#;(report (for/list ((p (in-list positions))) (list (· p xAdvance) (· p xOffset))))
#;(report/file 'fired-position)
;; Let the layout engine clean up any state it might have
(when (and (· this engine) #;(·? this engine cleanup))
@ -72,7 +72,8 @@ https://github.com/mbutterick/fontkit/blob/master/src/layout/LayoutEngine.js
;; Call the advanced layout engine to make substitutions
(when (and (· this engine) #;(· this engine substitute))
(set! glyphs (send (· this engine) substitute glyphs features script language)))
(report/file glyphs))
#;(report/file glyphs)
glyphs)
(define/contract (position this glyphs features script language)

@ -41,20 +41,22 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/OTLayoutEngine.js
(define new-glyphinfos
(send (· this plan) process (· this GSUBProcessor) (· this glyphInfos)))
(set! glyphInfos new-glyphinfos) ; update OTLayoutEngine state for positioning pass
(report/file new-glyphinfos)
#;(report/file new-glyphinfos)
;; Map glyph infos back to normal Glyph objects
(report/file (for/list ([glyphInfo (in-list new-glyphinfos)])
(send (· this font) getGlyph (· glyphInfo id) (· glyphInfo codePoints))))]
#;(report/file (for/list ([glyphInfo (in-list new-glyphinfos)])
(send (· this font) getGlyph (· glyphInfo id) (· glyphInfo codePoints))))
(for/list ([glyphInfo (in-list new-glyphinfos)])
(send (· this font) getGlyph (· glyphInfo id) (· glyphInfo codePoints)))]
[else glyphs]))
(define/public (position glyphs positions . _)
(report*/file glyphs positions shaper)
#;(report*/file glyphs positions shaper)
(define static-shaper (make-object shaper))
(when (eq? (· static-shaper zeroMarkWidths) 'BEFORE_GPOS)
(zeroMarkAdvances positions))
(when GPOSProcessor
(report/file GPOSProcessor)
#;(report/file GPOSProcessor)
(send (· this plan) process GPOSProcessor glyphInfos positions))
(when (eq? (· static-shaper zeroMarkWidths) 'AFTER_GPOS)
@ -65,7 +67,8 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/OTLayoutEngine.js
(set! glyphs (reverse glyphs))
(set! positions (reverse positions)))
(report/file (and GPOSProcessor (· GPOSProcessor features))))
#;(report/file (and GPOSProcessor (· GPOSProcessor features)))
(and GPOSProcessor (· GPOSProcessor features)))
(define/public (zeroMarkAdvances positions)

@ -91,9 +91,9 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/OTProcessor.js
#;(report/file 'ot-proc:applyFeatures-part1)
(define lookups (send this lookupsForFeatures userFeatures))
#;(report/file 'ot-proc:applyFeatures-part2)
(report/file (length glyphs))
#;(report/file (length glyphs))
(send this applyLookups lookups glyphs advances)
(report*/file (length glyphs) (length (· this glyphs)))
#;(report*/file (length glyphs) (length (· this glyphs)))
(· this glyphs))
@ -101,33 +101,34 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/OTProcessor.js
(set-field! glyphs this glyphs)
(set-field! positions this positions)
#;(report/file 'ot-proc:applyLookups)
(report (for/list ([g (· this glyphs)]) (· g id)) 'glyph-ids)
#;(report (for/list ([g (· this glyphs)]) (· g id)) 'glyph-ids)
(set-field! glyphIterator this (+GlyphIterator glyphs))
(for* ([lookup-entry (in-list lookups)])
(define feature (· lookup-entry feature))
(define lookup (· lookup-entry lookup))
(report 'resetting-iterator)
#;(report 'resetting-iterator)
(send (· this glyphIterator) reset (· lookup flags))
(while (< (or (· this glyphIterator index) 0) (length (· this glyphs)))
(report/file 'start-while++++++++++++++++++)
(report (length (· this glyphs)) 'glyphs-length-top)
(report (for/list ([g (· this glyphs)]) (· g id)) 'gids-top)
(report (· this glyphIterator index) giterator-idx-top)
(report* feature (dict-keys (· this glyphIterator cur features)))
(report (dict-has-key? (· this glyphIterator cur features) feature))
#;(report/file 'start-while++++++++++++++++++)
#;(report (length (· this glyphs)) 'glyphs-length-top)
#;(report (for/list ([g (· this glyphs)]) (· g id)) 'gids-top)
#;(report (· this glyphIterator index) giterator-idx-top)
#;(report* feature (dict-keys (· this glyphIterator cur features)))
#;(report (dict-has-key? (· this glyphIterator cur features) feature))
(cond
[(not (dict-has-key? (· this glyphIterator cur features) feature))
(send (· this glyphIterator) next)]
[else
(report 'start-lookup-branch=================)
(report* (for/list ([g glyphs]) (· g id)) (for/list ([g (· this glyphs)]) (· g id)) (for/list ([g (· this glyphIterator glyphs)]) (· g id)) (· this glyphIterator index) (· this glyphIterator cur id) (· this glyphIterator peekIndex))
#;(report 'start-lookup-branch=================)
#;(report* (for/list ([g glyphs]) (· g id)) (for/list ([g (· this glyphs)]) (· g id)) (for/list ([g (· this glyphIterator glyphs)]) (· g id)) (· this glyphIterator index) (· this glyphIterator cur id) (· this glyphIterator peekIndex))
(for/or ([table (in-list (· lookup subTables))])
(send this applyLookup (· lookup lookupType) table))
(report 'incrementing-iterator-at-bottom)
#;(report 'incrementing-iterator-at-bottom)
(send (· this glyphIterator) next)
(report* (· this glyphIterator cur) (· this glyphIterator index))]))))
#;(report* (· this glyphIterator cur) (· this glyphIterator index))
(· this glyphIterator index)]))))
(abstract applyLookup)
@ -151,7 +152,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/OTProcessor.js
#;(report*/file (and (pair? sequence) (list-ref sequence idx)) glyph (and glyph (· glyph id)))
(while (and (< idx (length sequence)) glyph (fn (list-ref sequence idx) (· glyph id)))
(report* 'in-match-loop idx (· glyph id))
#;(report* 'in-match-loop idx (· glyph id))
(when matched
(push-end! matched (· this glyphIterator index)))
(increment! idx)

@ -80,7 +80,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/ShapingPlan.js
#;(report*/file 'shaping-plan-process processor)
(send processor selectScript (· this script) (· this language))
(report/file stages)
#;(report/file stages)
(for/fold ([glyphs glyphs])
([stage (in-list stages)])
(cond
@ -88,7 +88,8 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/ShapingPlan.js
(stage (· this font) glyphs positions)]
[(> (length stage) 0)
#;(report*/file 'shaping-plan:applying-features processor)
(report/file positions)
(report/file (send processor applyFeatures stage glyphs positions))]))))
#;(report/file positions)
#;(report/file (send processor applyFeatures stage glyphs positions))
(send processor applyFeatures stage glyphs positions)]))))

Loading…
Cancel
Save