resume in layout-engine, ot-layout-engine
parent
3aba76f338
commit
1f2e685e8b
@ -0,0 +1,43 @@
|
||||
#lang fontkit/racket
|
||||
(provide (all-defined-out))
|
||||
|
||||
(define VARIATION_FEATURES '(rvrn))
|
||||
(define COMMON_FEATURES '(ccmp locl rlig mark mkmk))
|
||||
(define FRACTIONAL_FEATURES '(frac numr dnom))
|
||||
(define HORIZONTAL_FEATURES '(calt clig liga rclt curs kern))
|
||||
(define VERTICAL_FEATURES '(vert))
|
||||
(define DIRECTIONAL_FEATURES (mhasheq
|
||||
'ltr '(ltra ltrm)
|
||||
'rtl '(rtla rtlm)))
|
||||
|
||||
(define zeroMarkWidths 'AFTER_GPOS)
|
||||
|
||||
(define-subclass object% (DefaultShaper)
|
||||
|
||||
(define/public (plan plan_ glyphs features)
|
||||
;; Plan the features we want to apply
|
||||
(planPreprocessing plan_)
|
||||
(planFeatures plan_)
|
||||
(planPostprocessing plan_ features)
|
||||
|
||||
;; Assign the global features to all the glyphs
|
||||
(send plan_ assignGlobalFeatures glyphs)
|
||||
|
||||
;; Assign local features to glyphs
|
||||
(assignFeatures plan_ glyphs))
|
||||
|
||||
(define/public (planPreprocessing plan)
|
||||
(send plan add (mhasheq
|
||||
'global (append VARIATION_FEATURES (dict-ref DIRECTIONAL_FEATURES (· plan direction)))
|
||||
'local FRACTIONAL_FEATURES)))
|
||||
|
||||
(define/public (planFeatures plan)
|
||||
;; Do nothing by default. Let subclasses override this.
|
||||
(void))
|
||||
|
||||
(define/public (planPostprocessing plan userFeatures)
|
||||
(send plan add (append COMMON_FEATURES HORIZONTAL_FEATURES userFeatures)))
|
||||
|
||||
(define/public (assignFeatures plan glyphs)
|
||||
;; todo: Enable contextual fractions
|
||||
(void)))
|
@ -0,0 +1,24 @@
|
||||
#lang fontkit/racket
|
||||
(provide (all-defined-out))
|
||||
|
||||
(define-subclass object% (GlyphInfo font-in id-in [codePoints-in empty] [features-in (mhasheq)])
|
||||
(field [_font font-in]
|
||||
[codePoints codePoints-in]
|
||||
[id id-in]
|
||||
[features (mhasheq)])
|
||||
|
||||
(cond
|
||||
[(list? features-in)
|
||||
(for ([feature (in-list features-in)])
|
||||
(hash-set! features feature #t))]
|
||||
[(object? features-in)
|
||||
(hash-set! features (· features-in features))])
|
||||
|
||||
(field [ligatureID #f]
|
||||
[ligatureComponent #f]
|
||||
[ligated #f]
|
||||
[cursiveAttachment #f]
|
||||
[markattachment #f]
|
||||
[shaperInfo #f]
|
||||
[substituted #f]))
|
||||
|
@ -0,0 +1,9 @@
|
||||
#lang fontkit/racket
|
||||
(provide (all-defined-out))
|
||||
|
||||
; * ShapingPlans are used by the OpenType shapers to store which
|
||||
; * features should by applied, and in what order to apply them.
|
||||
; * The features are applied in groups called stages. A feature
|
||||
; * can be applied globally to all glyphs, or locally to only
|
||||
; * specific glyphs.
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue