From b5855e7ee1d8b00e3aea8fd4d3062e6b52b3efd5 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Fri, 7 Jul 2017 15:12:00 -0700 Subject: [PATCH] ligature appears but pos is wrong --- pitfall/fontkit/layout-engine.rkt | 6 +++--- pitfall/fontkit/ot-layout-engine.rkt | 9 +++++---- pitfall/fontkit/shaping-plan.rkt | 7 ++++--- pitfall/pdfkit/node_modules/fontkit/index.js | 2 -- pitfall/pitfall/test/test16.pdf | Bin 0 -> 5890 bytes pitfall/pitfall/test/test16.rkt | 2 +- pitfall/pitfall/test/test16rkt.pdf | Bin 0 -> 5892 bytes 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pitfall/fontkit/layout-engine.rkt b/pitfall/fontkit/layout-engine.rkt index 463dd92f..8803e35e 100644 --- a/pitfall/fontkit/layout-engine.rkt +++ b/pitfall/fontkit/layout-engine.rkt @@ -54,7 +54,7 @@ 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) - (error 'stop) + #;(error 'stop) (report/file 'ready-position) (define positions (send this position glyphs features script language)) (report/file 'fired-position) @@ -69,8 +69,8 @@ https://github.com/mbutterick/fontkit/blob/master/src/layout/LayoutEngine.js #;((is-a?/c GlyphRun) . ->m . void?) ;; Call the advanced layout engine to make substitutions (when (and (· this engine) #;(· this engine substitute)) - (send (· this engine) substitute glyphs features script language)) - glyphs) + (set! glyphs (send (· this engine) substitute glyphs features script language))) + (report/file glyphs)) (define/contract (position this glyphs features script language) diff --git a/pitfall/fontkit/ot-layout-engine.rkt b/pitfall/fontkit/ot-layout-engine.rkt index 6e6077db..fd118f96 100644 --- a/pitfall/fontkit/ot-layout-engine.rkt +++ b/pitfall/fontkit/ot-layout-engine.rkt @@ -38,11 +38,12 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/OTLayoutEngine.js (cond [(· this GSUBProcessor) #;(report/file (· this glyphInfos)) - (send (· this plan) process (· this GSUBProcessor) (· this glyphInfos)) - #;(report/file (· this glyphInfos)) + (define new-glyphinfos + (send (· this plan) process (· this GSUBProcessor) (· this glyphInfos))) + (report/file new-glyphinfos) ;; Map glyph infos back to normal Glyph objects - (for/list ([glyphInfo (in-list (· this 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))))] [else glyphs])) (define/public (position glyphs positions . _) diff --git a/pitfall/fontkit/shaping-plan.rkt b/pitfall/fontkit/shaping-plan.rkt index 9b87fa14..5cf173bb 100644 --- a/pitfall/fontkit/shaping-plan.rkt +++ b/pitfall/fontkit/shaping-plan.rkt @@ -80,13 +80,14 @@ 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) - (for ([stage (in-list stages)]) + (report/file stages) + (for/fold ([glyphs glyphs]) + ([stage (in-list stages)]) (cond [(and (procedure? stage) (not positions)) (stage (· this font) glyphs positions)] [(> (length stage) 0) #;(report*/file 'shaping-plan:applying-features processor) - (send processor applyFeatures stage glyphs positions)])))) + (report/file (send processor applyFeatures stage glyphs positions))])))) diff --git a/pitfall/pdfkit/node_modules/fontkit/index.js b/pitfall/pdfkit/node_modules/fontkit/index.js index 2def1a49..d8b73962 100644 --- a/pitfall/pdfkit/node_modules/fontkit/index.js +++ b/pitfall/pdfkit/node_modules/fontkit/index.js @@ -9199,8 +9199,6 @@ var LayoutEngine = function () { // Substitute and position the glyphs glyphs = this.substitute(glyphs, features, script, language); - console.log("DONE WITH SUBS"); - throw new Error("fark"); var positions = this.position(glyphs, features, script, language); // Let the layout engine clean up any state it might have diff --git a/pitfall/pitfall/test/test16.pdf b/pitfall/pitfall/test/test16.pdf index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..cb6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