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 ;; Substitute and position the glyphs
(set! glyphs (send this substitute glyphs features script language)) (set! glyphs (send this substitute glyphs features script language))
(report*/file 'end-sub glyphs) (report*/file 'end-sub glyphs)
(error 'stop) #;(error 'stop)
(report/file 'ready-position) (report/file 'ready-position)
(define positions (send this position glyphs features script language)) (define positions (send this position glyphs features script language))
(report/file 'fired-position) (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?) #;((is-a?/c GlyphRun) . ->m . void?)
;; Call the advanced layout engine to make substitutions ;; Call the advanced layout engine to make substitutions
(when (and (· this engine) #;(· this engine substitute)) (when (and (· this engine) #;(· this engine substitute))
(send (· this engine) substitute glyphs features script language)) (set! glyphs (send (· this engine) substitute glyphs features script language)))
glyphs) (report/file glyphs))
(define/contract (position this glyphs features script language) (define/contract (position this glyphs features script language)

@ -38,11 +38,12 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/OTLayoutEngine.js
(cond (cond
[(· this GSUBProcessor) [(· this GSUBProcessor)
#;(report/file (· this glyphInfos)) #;(report/file (· this glyphInfos))
(send (· this plan) process (· this GSUBProcessor) (· this glyphInfos)) (define new-glyphinfos
#;(report/file (· this glyphInfos)) (send (· this plan) process (· this GSUBProcessor) (· this glyphInfos)))
(report/file new-glyphinfos)
;; Map glyph infos back to normal Glyph objects ;; Map glyph infos back to normal Glyph objects
(for/list ([glyphInfo (in-list (· this glyphInfos))]) (report/file (for/list ([glyphInfo (in-list new-glyphinfos)])
(send (· this font) getGlyph (· glyphInfo id) (· glyphInfo codePoints)))] (send (· this font) getGlyph (· glyphInfo id) (· glyphInfo codePoints))))]
[else glyphs])) [else glyphs]))
(define/public (position glyphs positions . _) (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) #;(report*/file 'shaping-plan-process processor)
(send processor selectScript (· this script) (· this language)) (send processor selectScript (· this script) (· this language))
#;(report/file stages) (report/file stages)
(for ([stage (in-list stages)]) (for/fold ([glyphs glyphs])
([stage (in-list stages)])
(cond (cond
[(and (procedure? stage) (not positions)) [(and (procedure? stage) (not positions))
(stage (· this font) glyphs positions)] (stage (· this font) glyphs positions)]
[(> (length stage) 0) [(> (length stage) 0)
#;(report*/file 'shaping-plan:applying-features processor) #;(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 // Substitute and position the glyphs
glyphs = this.substitute(glyphs, features, script, language); glyphs = this.substitute(glyphs, features, script, language);
console.log("DONE WITH SUBS");
throw new Error("fark");
var positions = this.position(glyphs, features, script, language); var positions = this.position(glyphs, features, script, language);
// Let the layout engine clean up any state it might have // Let the layout engine clean up any state it might have

Binary file not shown.

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

Loading…
Cancel
Save