resume in ValueRecord:buildStruct

main
Matthew Butterick 8 years ago
parent a283ee11b7
commit cf7e0a633b

@ -24,7 +24,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/GPOS.js
(define/public (buildStruct parent)
(define struct parent)
(while (and (not (hash-ref struct (· this key))) (hash-ref struct parent))
(while (and (not (· struct (· this key))) (· struct parent))
(hash-set! struct (hash-ref struct parent)))
(cond
@ -100,7 +100,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/GPOS.js
(define-subclass VersionedStruct (GPOSLookup-VersionedStruct))
(define GPOSLookup
(+GPOSLookup-VersionedStruct
(λ (parent) (or (· parent parent res )
(λ (parent) (or (· parent parent res lookupType)
(raise-argument-error 'GPOSLookup "parent object" #f)))
(dictify
;; Single Adjustment
@ -108,7 +108,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/GPOS.js
(dictify
;; Single positioning value
1 (dictify
'coverage uint16be ; pointer
'coverage (+Pointer uint16be Coverage)
'valueFormat ValueFormat
'value (+ValueRecord))
2 (dictify

@ -52,11 +52,34 @@
'lookupType uint16be
'flags LookupFlags
'subTableCount uint16be
'subTables (+Array (+Pointer uint16be SubTable) 'subTableCount)
;'subTables (+Array uint16be 'subTableCount)
'subTables (+Array (+Pointer uint16be SubTable 'parent) 'subTableCount)
'markFilteringSet uint16be)))
(+Array (+Pointer uint16be Lookup) uint16be))
;;#################
;; Coverage Table #
;;#################
(define RangeRecord
(+Struct
(dictify
'start uint16be
'end uint16be
'startCoverageIndex uint16be)))
(define Coverage
(+VersionedStruct uint16be
(dictify
1 (dictify
'glyphCount uint16be
'glyphs (+Array uint16be 'glyphCount))
2 (dictify
'rangeCount uint16be
'rangeRecords (+Array RangeRecord 'rangeCount)))))
;;#############################################
;; Contextual Substitution/Positioning Tables #
;;#############################################

@ -56,6 +56,7 @@
relative += this.relativeToGetter(ctx);
}
ptr = offset + relative;
console.log("ptr="+ptr+" type="+this.offsetType.size());
if (this.type != null) {
val = null;
decodeValue = (function(_this) {

@ -47,6 +47,8 @@
var key, type, val;
for (key in fields) {
type = fields[key];
console.log("key=" + key + " type="+type);
if (typeof type === 'function') {
val = type.call(res, res);
} else {

@ -8,14 +8,17 @@ https://github.com/mbutterick/restructure/blob/master/src/Pointer.coffee
(define-subclass RestructureBase (Pointer offsetType type [scope 'local])
(and (symbol? scope) (caseq scope
[(local parent) 'yay]
[(local parent grandparent immediate) 'yay]
[else (raise-argument-error 'Pointer "local or parent" scope)]))
(define/augride (decode stream ctx)
(define offset (send offsetType decode stream ctx))
(define ptr (+ offset (caseq scope
[(immediate) (· this starting-offset)]
[(local) (· this parent starting-offset)]
[(parent) (· this parent parent starting-offset)])))
[(parent) (· this parent parent starting-offset)]
[(grandparent) (· this parent parent parent starting-offset)])))
(report* ptr (send offsetType size))
(cond
[type (define orig-pos (send stream pos))
(send stream pos ptr)

@ -42,6 +42,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Struct.coffee
(unless (assocs? fields)
(raise-argument-error '_parseFields "assocs" fields))
(for ([(key type) (in-dict fields)])
(report* key type)
(define val
(if (procedure? type)
(type res)

Loading…
Cancel
Save