You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/pitfall/fontkit/glyphrun.rkt

36 lines
1.4 KiB
Racket

#lang fontkit/racket
(require "bbox.rkt" (prefix-in Script- "script.rkt"))
(provide (all-defined-out))
;; Represents a run of Glyph and GlyphPosition objects.
;; Returned by the font layout method.
(define-subclass object% (GlyphRun
glyphs ; An array of Glyph objects in the run
features-in
script ; The script that was requested for shaping. This was either passed in or detected automatically.
language) ; The language requested for shaping, as passed in. If `null`, the default language for the script was used.
;; An array of GlyphPosition objects for each glyph in the run
(field [positions #f])
;; The directionality of the requested script (either ltr or rtl).
(field [direction (Script-direction script)])
;; The features requested during shaping. This is a combination of user
;; specified features and features chosen by the shaper.
(field [features (cond
[(hash? features-in) features-in]
;; Convert features to an object
[(list? features-in)
(define f (mhash))
(for ([tag (in-list features)])
(hash-set! f tag #t))
f]
[(not features-in) (mhash)]
[else (error 'glyphrun:unknown-features-type)])])
)