ligature appears but pos is wrong

main
Matthew Butterick 7 years ago
parent f0ef666b42
commit b5855e7ee1

@ -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)

@ -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 . _)

@ -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))]))))

@ -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

Binary file not shown.

@ -12,7 +12,7 @@
(send* doc
[font "the-font"]
[fontSize 100]
[text "fi" 100 100 (hash 'width #f)]))
[text "afic" 100 100 (hash 'width #f)]))
(define-runtime-path this "test16rkt.pdf")

Loading…
Cancel
Save