start GPOS
parent
53e1ab3334
commit
ff8e2f867b
@ -0,0 +1,7 @@
|
||||
#lang fontkit/racket
|
||||
(require "font.rkt" "directory.rkt" "gpos.rkt")
|
||||
|
||||
(define f (openSync fira-path))
|
||||
(define ds (send f _getTableStream 'GPOS))
|
||||
|
||||
(send GPOS decode ds)
|
@ -0,0 +1,62 @@
|
||||
#lang fontkit/racket
|
||||
(require restructure)
|
||||
(provide (all-defined-out))
|
||||
|
||||
(define LookupRecord (+Struct
|
||||
(dictify
|
||||
'sequenceIndex uint16be
|
||||
'lookupListIndex uint16be)))
|
||||
|
||||
(define Context
|
||||
(+VersionedStruct
|
||||
uint16be
|
||||
(dictify
|
||||
;; Simple context
|
||||
1 (dictify
|
||||
'coverage uint16be ; pointer
|
||||
'ruleSetCount uint16be
|
||||
'ruleSets (+Array uint16be 'ruleSetCount)) ; pointer
|
||||
|
||||
;; Class-based context
|
||||
2 (dictify
|
||||
'coverage uint16be ; pointer
|
||||
'classDef uint16be ; pointer
|
||||
'classSetCnt uint16be
|
||||
'classSet (+Array uint16be 'classSetCnt)) ; pointer
|
||||
|
||||
3 (dictify
|
||||
'glyphCount uint16be
|
||||
'lookupCount uint16be
|
||||
'coverages (+Array uint16be 'glyphCount) ; pointer
|
||||
'lookupRecords (+Array LookupRecord 'lookupCount)))))
|
||||
|
||||
|
||||
(define ChainingContext
|
||||
(+VersionedStruct
|
||||
uint16be
|
||||
(dictify
|
||||
;; Simple context glyph substitution
|
||||
1 (dictify
|
||||
'coverage uint16be ; pointer
|
||||
'chainCount uint16be
|
||||
'chainRuelSets (+Array uint16be 'chainCount)) ; pointer
|
||||
|
||||
;; Class-based chaining context
|
||||
2 (dictify
|
||||
'coverage uint16be ; pointer
|
||||
'backtrackClassDef uint16be ; pointer
|
||||
'inputClassDef uint16be ; pointer
|
||||
'lookaheadClassDef uint16be ; pointer
|
||||
'chainCount uint16be
|
||||
'chainClassSet (+Array uint16be 'chainCount)) ; pointer
|
||||
|
||||
;; Coverage-based chaining context
|
||||
3 (dictify
|
||||
'backtrackGlyphCount uint16be
|
||||
'backtrackCoverage (+Array uint16be 'backtrackGlyphCount) ; pointer
|
||||
'inputGlyphCount uint16be
|
||||
'inputCoverage (+Array uint16be 'inputGlyphCount) ; pointer
|
||||
'lookaheadGlyphCount uint16be
|
||||
'lookaheadCoverage (+Array uint16be 'lookaheadGlyphCount) ; pointer
|
||||
'lookupCount uint16be
|
||||
'lookupRecords (+Array LookupRecord 'lookupCount)))))
|
@ -0,0 +1,14 @@
|
||||
#lang racket/base
|
||||
(require racket/class)
|
||||
(provide (all-defined-out))
|
||||
|
||||
(define RestructureBase
|
||||
(class object%
|
||||
(super-new)
|
||||
(abstract decode)
|
||||
(abstract encode)
|
||||
(abstract size)
|
||||
(define/public (process . args) (void))
|
||||
(define/public (preEncode . args) (void))))
|
||||
|
||||
(define (RestructureBase? x) (is-a? x RestructureBase))
|
@ -1,5 +1,25 @@
|
||||
#lang racket/base
|
||||
(require racket/contract)
|
||||
(require racket/contract racket/class)
|
||||
(provide (all-defined-out))
|
||||
|
||||
(define (option/c x) (or/c #f x))
|
||||
(define (option/c x) (or/c #f x))
|
||||
|
||||
(module+ main
|
||||
|
||||
(define-syntax-rule (define/public/contract (ID . ARGS) CONTRACT . BODY)
|
||||
(define/public (ID . ARGS)
|
||||
(define/contract (ID . ARGS)
|
||||
CONTRACT . BODY)
|
||||
(ID . ARGS)))
|
||||
|
||||
(define c% (class object%
|
||||
(super-new)
|
||||
|
||||
(define/public/contract (add x y)
|
||||
(integer? integer? . -> . integer?)
|
||||
(+ x y))))
|
||||
|
||||
|
||||
(define c (make-object c%))
|
||||
|
||||
(send c add 12 21))
|
Loading…
Reference in New Issue