History

more logic for reading tables with rather peculiar dependencies

Sigrid Solveig Haflínudóttir committed 2 years ago

Commit f152a7f1 parent 0ce46015 files · +1188 −526Browse files

Unified · Split

5 files
  1. gen.rkt +97 −50
  2. otf.c +818 −349
  3. otf.h +171 −84
  4. otf.rkt +101 −42
  5. test.c +1 −1
gen.rkt+97−50
@@ -4,6 +4,7 @@ · 3 unmodified lines
4(require (for-syntax racket/format))4(require (for-syntax racket/format))
5(require (for-syntax syntax/parse))5(require (for-syntax syntax/parse))
6(require (for-syntax racket/contract))6(require (for-syntax racket/contract))
7(require (for-syntax racket/string))
7 8
8(require racket/contract)9(require racket/contract)
9(require racket/generic)10(require racket/generic)
@@ -26,6 +27,10 @@ · 16 unmodified lines
26 (-> string? boolean?)27 (-> string? boolean?)
27 (string-prefix? s "typedef"))28 (string-prefix? s "typedef"))
28 29
30(define/contract (extra-context-ref? ref)
31 (-> symbol? boolean?)
32 (string-prefix? (symbol->string ref) "o->"))
33
29(define/contract (format f)34(define/contract (format f)
30 (-> procedure? string?)35 (-> procedure? string?)
31 (define-values (a b) (partition c-typedef? (flatten (map f cmplxs))))36 (define-values (a b) (partition c-typedef? (flatten (map f cmplxs))))
@@ -55,10 +60,12 @@ · 23 unmodified lines
55 (if (= (length lst) 1) (list* stmt lst) (list (string-append stmt "{") lst "}")))60 (if (= (length lst) 1) (list* stmt lst) (list (string-append stmt "{") lst "}")))
56 61
57(define (wrap-cond-c cond lst)62(define (wrap-cond-c cond lst)
63 (define (fmt-ref ref)
64 (if (extra-context-ref? ref) ref (~a "v->" ref)))
58 (match cond65 (match cond
59 [#f lst]66 [#f lst]
60 [(list op ref n ...)67 [(list op ref n ...)
61 (block (~a "if(" (string-join (map (λ (n) (~a "v->" ref " " op " " n)) n) " || ") ")")68 (block (~a "if(" (string-join (map (λ (n) (~a (fmt-ref ref) " " op " " n)) n) " || ") ")")
62 (indent lst))]))69 (indent lst))]))
63 70
64(define (invert-c op)71(define (invert-c op)
@@ -98,11 +105,12 @@ · 33 unmodified lines
98 [#f105 [#f
99 (if (or declared (not (field-unused? f)))106 (if (or declared (not (field-unused? f)))
100 (if index107 (if index
101 (~a (if declared (~a (name (field-type f)) " ") "")108 (list (~a (if declared (~a (name (field-type f)) " ") "")
102 ref109 ref
103 " = "110 " = "
104 ((type-parse (field-type f)) b index)111 ((type-parse (field-type f)) b index)
105 ";")112 ";")
113 (if (field-context? f) (~a "o->" (field-name f) " = " ref ";") empty))
106 (list114 (list
107 (if declared115 (if declared
108 (~a (name (field-type f)) " " ref ";")116 (~a (name (field-type f)) " " ref ";")
@@ -186,6 +194,9 @@ · 77 unmodified lines
186 (define v (assoc 'cond (field-attrs f)))194 (define v (assoc 'cond (field-attrs f)))
187 (and v (rest v)))195 (and v (rest v)))
188 196
197(define (field-context? f)
198 (field-attr f '->o))
199
189(define/contract (field-count f)200(define/contract (field-count f)
190 (-> field? (or/c false/c number? string?))201 (-> field? (or/c false/c number? string?))
191 (define (fmt-expr e)202 (define (fmt-expr e)
@@ -193,7 +204,8 @@ · 1 unmodified line
193 [(number? e) e]204 [(number? e) e]
194 [(list? e)205 [(list? e)
195 (match e206 (match e
196 [(list op x y) (~a (fmt-expr x) op (fmt-expr y))])]207 [(list op x y) (~a "(" (fmt-expr x) op (fmt-expr y) ")")])]
208 [(and (symbol? e) (extra-context-ref? e)) (~a e)]
197 [(symbol? e) (~a "v->" e)]))209 [(symbol? e) (~a "v->" e)]))
198 (define e (field-attr f 'count))210 (define e (field-attr f 'count))
199 (and e (fmt-expr e)))211 (and e (fmt-expr e)))
@@ -243,7 +255,7 @@ · 43 unmodified lines
243 (~a (if is-ptr "\t" "")255 (~a (if is-ptr "\t" "")
244 "print_"256 "print_"
245 (cmplx-name t)257 (cmplx-name t)
246 "(f, indent+indentΔ, "258 "(f, indent+indentΔ, o, "
247 (if is-ptr "" "&")259 (if is-ptr "" "&")
248 "v->"260 "v->"
249 (field-name f)261 (field-name f)
@@ -254,23 +266,25 @@ · 4 unmodified lines
254(define (filter-extra extra key)266(define (filter-extra extra key)
255 (flatten (filter-map (λ (e) (and (eq? (car e) key) (cdr e))) extra)))267 (flatten (filter-map (λ (e) (and (eq? (car e) key) (cdr e))) extra)))
256 268
257(define-struct cmplx (name fields tag extra)269(define-struct cmplx (name fields tag extra after)
258 #:transparent270 #:transparent
259 #:methods gen:code271 #:methods gen:code
260 [(define/generic super-gen-h gen-h)272 [(define/generic super-gen-h gen-h)
261 (define/generic super-gen-c gen-c)273 (define/generic super-gen-c gen-c)
262 (define (gen-h c)274 (define (gen-h c)
263 (flatten275 (flatten (append (list (~a "typedef struct " (cmplx-name c) " " (cmplx-name c) ";")
264 (append276 (~a "")
265 (list (~a "typedef struct " (cmplx-name c) " " (cmplx-name c) ";")277 (~a "struct " (cmplx-name c) " {"))
266 (~a "")278 (indent (map super-gen-h (cmplx-fields c)))
267 (~a "struct " (cmplx-name c) " {"))279 (indent (filter-extra (cmplx-extra c) 'field))
268 (indent (map super-gen-h (cmplx-fields c)))280 (list (~a "};")
269 (indent (filter-extra (cmplx-extra c) 'field))281 (~a "")
270 (list (~a "};")282 (~a "int read_" (cmplx-name c) "(Otf *o, " (cmplx-name c) " *v);")
271 (~a "")283 (~a "void print_"
272 (~a "int read_" (cmplx-name c) "(Otf *o, " (cmplx-name c) " *v);")284 (cmplx-name c)
273 (~a "void print_" (cmplx-name c) "(Biobuf *f, int indent, " (cmplx-name c) " *v);")))))285 "(Biobuf *f, int indent, Otf *o, "
286 (cmplx-name c)
287 " *v);")))))
274 (define (gen-c c b index)288 (define (gen-c c b index)
275 (define (no-vla? f)289 (define (no-vla? f)
276 (define cnt (field-count f))290 (define cnt (field-count f))
@@ -323,25 +337,27 @@ · 46 unmodified lines
323 (parse-group fields)))])337 (parse-group fields)))])
324 lst))))338 lst))))
325 (flatten339 (flatten
326 (append (list (~a "")340 (append
327 (~a "int")341 (list (~a "")
328 (~a "read_" (cmplx-name c) "(Otf *o, " (cmplx-name c) " *v)")342 (~a "int")
329 (~a "{")343 (~a "read_" (cmplx-name c) "(Otf *o, " (cmplx-name c) " *v)")
330 (~a "\tu8int *b;"))344 (~a "{")
331 (indent (map gen-group-c (group-fields (cmplx-fields c))))345 (~a "\tu8int *b;"))
332 (indent (filter-extra (cmplx-extra c) 'read))346 (indent (map gen-group-c (group-fields (cmplx-fields c))))
333 (list (~a "\treturn 0;")347 (indent (filter-extra (cmplx-extra c) 'read))
334 (~a "err:")348 (list (~a "\treturn 0;")
335 (~a "\twerrstr(\"%s: %r\", \"" (cmplx-name c) "\");")349 (~a "err:")
336 (~a "\treturn -1;")350 (~a "\twerrstr(\"%s: %r\", \"" (cmplx-name c) "\");")
337 (~a "}"))351 (~a "\treturn -1;")
338 (list (~a "")352 (~a "}"))
339 (~a "void")353 (list (~a "")
340 (~a "print_" (cmplx-name c) "(Biobuf *f, int indent, " (cmplx-name c) " *v)")354 (~a "void")
341 (~a "{")355 (~a "print_" (cmplx-name c) "(Biobuf *f, int indent, Otf *o, " (cmplx-name c) " *v)")
342 (indent (map field-print-c (cmplx-fields c)))356 (~a "{")
343 (indent (filter-extra (cmplx-extra c) 'print))357 (indent (map field-print-c (cmplx-fields c)))
344 (~a "}")))))358 (indent (filter-extra (cmplx-extra c) 'print))
359 (~a "\tUSED(o);")
360 (~a "}")))))
345 (define (c-type c)361 (define (c-type c)
346 (cmplx-name c))])362 (cmplx-name c))])
347 363
@@ -371,13 +387,22 @@ · 23 unmodified lines
371 387
372(define-syntax (mkcmplx stx)388(define-syntax (mkcmplx stx)
373 (syntax-parse stx389 (syntax-parse stx
374 [(_ typ:id fields:expr ...+ (~optional (~seq #:tag tag)) (~optional (~seq #:extra extra:expr)))390 [(_ typ:id
391 fields:expr ...+
392 (~optional (~seq #:tag tag))
393 (~optional (~seq #:extra extra:expr))
394 (~optional (~seq #:after after)))
375 #:declare tag (expr/c #'tag/c #:name "table tag")395 #:declare tag (expr/c #'tag/c #:name "table tag")
376 (begin396 (begin
377 (set! typenames (cons (syntax-e #`typ) typenames))397 (set! typenames (cons (syntax-e #`typ) typenames))
378 #'(begin398 #'(begin
379 (define tag- (~? (~@ tag.c) #f))399 (define tag- (~? (~@ tag.c) #f))
380 (define typ (make-cmplx `typ (mkfields [~@ fields] ...) tag- (~? (~@ extra) empty)))400 (define typ
401 (make-cmplx `typ
402 (mkfields [~@ fields] ...)
403 tag-
404 (~? (~@ extra) empty)
405 (~? (~@ after) empty)))
381 (set! cmplxs (append cmplxs (list typ)))406 (set! cmplxs (append cmplxs (list typ)))
382 (when tag-407 (when tag-
383 (set! tagged (append tagged (list typ))))))]))408 (set! tagged (append tagged (list typ))))))]))
@@ -395,6 +420,11 @@ · 11 unmodified lines
395 (pattern op:id420 (pattern op:id
396 #:when (member (syntax-e #'op) '(+ - / *))))421 #:when (member (syntax-e #'op) '(+ - / *))))
397 422
423 (define-syntax-class oref
424 #:description "extra context field reference"
425 (pattern oref:id
426 #:when (string-prefix? (symbol->string (syntax-e #'oref)) "o->")))
427
398 (define-syntax-class ref428 (define-syntax-class ref
399 #:description "field reference"429 #:description "field reference"
400 (pattern ref:id430 (pattern ref:id
@@ -402,26 +432,32 @@ · 1 unmodified line
402 #:with type (cadr (assoc (syntax-e #'ref) fields))))432 #:with type (cadr (assoc (syntax-e #'ref) fields))))
403 433
404 (syntax-parse stx434 (syntax-parse stx
405 [(_ _ ({~literal at} ref:ref))435 [(_ type name {~literal ->o}) #''(->o #t)]
436 [(_ _ _ ({~literal at} ref:ref))
406 #:fail-when (not (type-offset? (syntax-e #'ref.type))) "can't be used as an offset"437 #:fail-when (not (type-offset? (syntax-e #'ref.type))) "can't be used as an offset"
407 #''(at ref)]438 #''(at ref)]
408 [(_ type {~literal hex})439 [(_ type _ {~literal hex})
409 #:fail-when (not (type-number? (syntax-e #'type))) "not a number type"440 #:fail-when (not (type-number? (syntax-e #'type))) "not a number type"
410 #''(verb "%#ux")]441 #''(verb "%#ux")]
411 [(_ type (p:compop vs:number ...+))442 [(_ type _ (p:compop vs:number ...+))
412 #:fail-when (not (type-comparable? (syntax-e #'type))) "type can't be used in a comparison"443 #:fail-when (not (type-comparable? (syntax-e #'type))) "type can't be used in a comparison"
413 #''(test p vs ...)]444 #''(test p vs ...)]
414 [(_ _ (p:compop ref:ref vs:number ...+))445 [(_ _ _ (p:compop oref:oref vs:number ...+))
446 #''(cond
447 p
448 oref
449 vs ...)]
450 [(_ _ _ (p:compop ref:ref vs:number ...+))
415 #''(cond451 #''(cond
416 p452 p
417 ref453 ref
418 vs ...)]454 vs ...)]
419 [(_ _ {~literal unused}) #''(unused #t)]455 [(_ _ _ {~literal unused}) #''(unused #t)]
420 [(_ _ (ref:ref))456 [(_ _ _ (ref:ref))
421 #:fail-when (not (type-index? (syntax-e #'ref.type))) "can't be used as index to an array"457 #:fail-when (not (type-index? (syntax-e #'ref.type))) "can't be used as index to an array"
422 #''(count ref)]458 #''(count ref)]
423 [(_ _ (n:number)) #''(count n)]459 [(_ _ _ (n:number)) #''(count n)]
424 [(_ _ (p:arithop e:expr ...+)) #''(count (p e ...))])) ; FIXME - check fields and ops/numbers460 [(_ _ _ (p:arithop e:expr ...+)) #''(count (p e ...))])) ; FIXME - check fields and ops/numbers
425 461
426(define-syntax (mkfield stx)462(define-syntax (mkfield stx)
427 (define-syntax-class name463 (define-syntax-class name
@@ -440,7 +476,7 @@ · 12 unmodified lines
440 (set! fields (cons (syntax->datum #'(name type)) fields))476 (set! fields (cons (syntax->datum #'(name type)) fields))
441 #'(field type477 #'(field type
442 `name478 `name
443 (list (mkattr type [~@ attrs]) ...)))]))479 (list (mkattr type `name [~@ attrs]) ...)))]))
444 480
445(define-syntax (mkfields stx)481(define-syntax (mkfields stx)
446 (syntax-parse stx482 (syntax-parse stx
@@ -485,6 +521,11 @@ void otfclose(Otf *o); · 38 unmodified lines
485EOF521EOF
486 )))522 )))
487 523
524(define (extra-context-fields c)
525 (if (cmplx? c)
526 (filter-map (λ (f) (and (field-context? f) (indent (gen-h f)))) (cmplx-fields c))
527 empty))
528
488(out "otf.c"529(out "otf.c"
489 (λ ()530 (λ ()
490 (printf #<<EOF531 (printf #<<EOF
@@ -502,6 +543,12 @@ struct Otf { · 11 unmodified lines
502 u8int *buf;543 u8int *buf;
503 int bufsz;544 int bufsz;
504 int off;545 int off;
546 /* extra fields to simplify parsing */
547
548EOF
549 )
550 (printf (format extra-context-fields))
551 (printf #<<EOF
505};552};
506 553
507struct Range {554struct Range {
otf.c+818−349
@@ -12,6 +12,12 @@ struct Otf { · 11 unmodified lines
12 u8int *buf;12 u8int *buf;
13 int bufsz;13 int bufsz;
14 int off;14 int off;
15 /* extra fields to simplify parsing */
16 s16int indexToLocFormat;
17 u16int numberOfHMetrics;
18 u16int numGlyphs;
19 u16int firstGlyphIndex;
20 u16int lastGlyphIndex;
15};21};
16 22
17struct Range {23struct Range {
@@ -179,12 +185,13 @@ err: · 161 unmodified lines
179}185}
180 186
181void187void
182print_SubHeader(Biobuf *f, int indent, SubHeader *v)188print_SubHeader(Biobuf *f, int indent, Otf *o, SubHeader *v)
183{189{
184 Bprint(f, "%*s%s: %ud\n", indent, "", "firstCode", v->firstCode);190 Bprint(f, "%*s%s: %ud\n", indent, "", "firstCode", v->firstCode);
185 Bprint(f, "%*s%s: %ud\n", indent, "", "entryCode", v->entryCode);191 Bprint(f, "%*s%s: %ud\n", indent, "", "entryCode", v->entryCode);
186 Bprint(f, "%*s%s: %d\n", indent, "", "idDelta", v->idDelta);192 Bprint(f, "%*s%s: %d\n", indent, "", "idDelta", v->idDelta);
187 Bprint(f, "%*s%s: %ud\n", indent, "", "idRangeOffset", v->idRangeOffset);193 Bprint(f, "%*s%s: %ud\n", indent, "", "idRangeOffset", v->idRangeOffset);
194 USED(o);
188}195}
189 196
190int197int
@@ -203,11 +210,12 @@ err: · 12 unmodified lines
203}210}
204 211
205void212void
206print_MapGroup(Biobuf *f, int indent, MapGroup *v)213print_MapGroup(Biobuf *f, int indent, Otf *o, MapGroup *v)
207{214{
208 Bprint(f, "%*s%s: %ud\n", indent, "", "startCharCode", v->startCharCode);215 Bprint(f, "%*s%s: %ud\n", indent, "", "startCharCode", v->startCharCode);
209 Bprint(f, "%*s%s: %ud\n", indent, "", "endCharCode", v->endCharCode);216 Bprint(f, "%*s%s: %ud\n", indent, "", "endCharCode", v->endCharCode);
210 Bprint(f, "%*s%s: %ud\n", indent, "", "startGlyphID", v->startGlyphID);217 Bprint(f, "%*s%s: %ud\n", indent, "", "startGlyphID", v->startGlyphID);
218 USED(o);
211}219}
212 220
213int221int
@@ -227,12 +235,13 @@ err: · 13 unmodified lines
227}235}
228 236
229void237void
230print_SubtableCmap0(Biobuf *f, int indent, SubtableCmap0 *v)238print_SubtableCmap0(Biobuf *f, int indent, Otf *o, SubtableCmap0 *v)
231{239{
232 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);240 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
233 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);241 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);
234 for(int i = 0; i < 256; i++)242 for(int i = 0; i < 256; i++)
235 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "glyphIdArray", i, v->glyphIdArray[i]);243 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "glyphIdArray", i, v->glyphIdArray[i]);
244 USED(o);
236}245}
237 246
238int247int
@@ -252,12 +261,13 @@ err: · 13 unmodified lines
252}261}
253 262
254void263void
255print_SubtableCmap2(Biobuf *f, int indent, SubtableCmap2 *v)264print_SubtableCmap2(Biobuf *f, int indent, Otf *o, SubtableCmap2 *v)
256{265{
257 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);266 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
258 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);267 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);
259 for(int i = 0; i < 256; i++)268 for(int i = 0; i < 256; i++)
260 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "subHeaderKeys", i, v->subHeaderKeys[i]);269 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "subHeaderKeys", i, v->subHeaderKeys[i]);
270 USED(o);
261}271}
262 272
263int273int
@@ -272,28 +282,28 @@ read_SubtableCmap4(Otf *o, SubtableCmap4 *v) · 8 unmodified lines
272 v->searchRange = b[6]<<8 | b[7];282 v->searchRange = b[6]<<8 | b[7];
273 v->entrySelector = b[8]<<8 | b[9];283 v->entrySelector = b[8]<<8 | b[9];
274 v->rangeShift = b[10]<<8 | b[11];284 v->rangeShift = b[10]<<8 | b[11];
275 if((b = otfreadn(o, v->segCountX2/2*2)) == nil)285 if((b = otfreadn(o, (v->segCountX2/2)*2)) == nil)
276 goto err;286 goto err;
277 v->endCode = malloc(v->segCountX2/2*sizeof(*v->endCode));287 v->endCode = malloc((v->segCountX2/2)*sizeof(*v->endCode));
278 for(int i = 0; i < v->segCountX2/2; i++)288 for(int i = 0; i < (v->segCountX2/2); i++)
279 v->endCode[i] = b[0+i*2]<<8 | b[1+i*2];289 v->endCode[i] = b[0+i*2]<<8 | b[1+i*2];
280 if((b = otfreadn(o, 2)) == nil)290 if((b = otfreadn(o, 2)) == nil)
281 goto err;291 goto err;
282 USED(b);292 USED(b);
283 if((b = otfreadn(o, v->segCountX2/2*2)) == nil)293 if((b = otfreadn(o, (v->segCountX2/2)*2)) == nil)
284 goto err;294 goto err;
285 v->startCode = malloc(v->segCountX2/2*sizeof(*v->startCode));295 v->startCode = malloc((v->segCountX2/2)*sizeof(*v->startCode));
286 for(int i = 0; i < v->segCountX2/2; i++)296 for(int i = 0; i < (v->segCountX2/2); i++)
287 v->startCode[i] = b[0+i*2]<<8 | b[1+i*2];297 v->startCode[i] = b[0+i*2]<<8 | b[1+i*2];
288 if((b = otfreadn(o, v->segCountX2/2*2)) == nil)298 if((b = otfreadn(o, (v->segCountX2/2)*2)) == nil)
289 goto err;299 goto err;
290 v->idDelta = malloc(v->segCountX2/2*sizeof(*v->idDelta));300 v->idDelta = malloc((v->segCountX2/2)*sizeof(*v->idDelta));
291 for(int i = 0; i < v->segCountX2/2; i++)301 for(int i = 0; i < (v->segCountX2/2); i++)
292 v->idDelta[i] = b[0+i*2]<<8 | b[1+i*2];302 v->idDelta[i] = b[0+i*2]<<8 | b[1+i*2];
293 if((b = otfreadn(o, v->segCountX2/2*2)) == nil)303 if((b = otfreadn(o, (v->segCountX2/2)*2)) == nil)
294 goto err;304 goto err;
295 v->idRangeOffset = malloc(v->segCountX2/2*sizeof(*v->idRangeOffset));305 v->idRangeOffset = malloc((v->segCountX2/2)*sizeof(*v->idRangeOffset));
296 for(int i = 0; i < v->segCountX2/2; i++)306 for(int i = 0; i < (v->segCountX2/2); i++)
297 v->idRangeOffset[i] = b[0+i*2]<<8 | b[1+i*2];307 v->idRangeOffset[i] = b[0+i*2]<<8 | b[1+i*2];
298 return 0;308 return 0;
299err:309err:
@@ -302,7 +312,7 @@ err: · 2 unmodified lines
302}312}
303 313
304void314void
305print_SubtableCmap4(Biobuf *f, int indent, SubtableCmap4 *v)315print_SubtableCmap4(Biobuf *f, int indent, Otf *o, SubtableCmap4 *v)
306{316{
307 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);317 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
308 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);318 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);
@@ -310,14 +320,15 @@ print_SubtableCmap4(Biobuf *f, int indent, SubtableCmap4 *v) · 1 unmodified line
310 Bprint(f, "%*s%s: %ud\n", indent, "", "searchRange", v->searchRange);320 Bprint(f, "%*s%s: %ud\n", indent, "", "searchRange", v->searchRange);
311 Bprint(f, "%*s%s: %ud\n", indent, "", "entrySelector", v->entrySelector);321 Bprint(f, "%*s%s: %ud\n", indent, "", "entrySelector", v->entrySelector);
312 Bprint(f, "%*s%s: %ud\n", indent, "", "rangeShift", v->rangeShift);322 Bprint(f, "%*s%s: %ud\n", indent, "", "rangeShift", v->rangeShift);
313 for(int i = 0; i < v->segCountX2/2; i++)323 for(int i = 0; i < (v->segCountX2/2); i++)
314 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "endCode", i, v->endCode[i]);324 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "endCode", i, v->endCode[i]);
315 for(int i = 0; i < v->segCountX2/2; i++)325 for(int i = 0; i < (v->segCountX2/2); i++)
316 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "startCode", i, v->startCode[i]);326 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "startCode", i, v->startCode[i]);
317 for(int i = 0; i < v->segCountX2/2; i++)327 for(int i = 0; i < (v->segCountX2/2); i++)
318 Bprint(f, "%*s%s[%d]: %d\n", indent, "", "idDelta", i, v->idDelta[i]);328 Bprint(f, "%*s%s[%d]: %d\n", indent, "", "idDelta", i, v->idDelta[i]);
319 for(int i = 0; i < v->segCountX2/2; i++)329 for(int i = 0; i < (v->segCountX2/2); i++)
320 Bprint(f, "%*s%s[%d]: %d\n", indent, "", "idRangeOffset", i, v->idRangeOffset[i]);330 Bprint(f, "%*s%s[%d]: %d\n", indent, "", "idRangeOffset", i, v->idRangeOffset[i]);
331 USED(o);
321}332}
322 333
323int334int
@@ -342,7 +353,7 @@ err: · 18 unmodified lines
342}353}
343 354
344void355void
345print_SubtableCmap6(Biobuf *f, int indent, SubtableCmap6 *v)356print_SubtableCmap6(Biobuf *f, int indent, Otf *o, SubtableCmap6 *v)
346{357{
347 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);358 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
348 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);359 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);
@@ -350,6 +361,7 @@ print_SubtableCmap6(Biobuf *f, int indent, SubtableCmap6 *v) · 1 unmodified line
350 Bprint(f, "%*s%s: %ud\n", indent, "", "entryCount", v->entryCount);361 Bprint(f, "%*s%s: %ud\n", indent, "", "entryCount", v->entryCount);
351 for(int i = 0; i < v->entryCount; i++)362 for(int i = 0; i < v->entryCount; i++)
352 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "glyphIdArray", i, v->glyphIdArray[i]);363 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "glyphIdArray", i, v->glyphIdArray[i]);
364 USED(o);
353}365}
354 366
355int367int
@@ -374,7 +386,7 @@ err: · 18 unmodified lines
374}386}
375 387
376void388void
377print_SubtableCmap8(Biobuf *f, int indent, SubtableCmap8 *v)389print_SubtableCmap8(Biobuf *f, int indent, Otf *o, SubtableCmap8 *v)
378{390{
379 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);391 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
380 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);392 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);
@@ -383,8 +395,9 @@ print_SubtableCmap8(Biobuf *f, int indent, SubtableCmap8 *v) · 2 unmodified lines
383 Bprint(f, "%*s%s: %ud\n", indent, "", "numGroups", v->numGroups);395 Bprint(f, "%*s%s: %ud\n", indent, "", "numGroups", v->numGroups);
384 for(int i = 0; i < v->numGroups; i++){396 for(int i = 0; i < v->numGroups; i++){
385 Bprint(f, "%*s%s[%d]:\n", indent, "", "groups", i);397 Bprint(f, "%*s%s[%d]:\n", indent, "", "groups", i);
386 print_MapGroup(f, indent+indentΔ, &v->groups[i]);398 print_MapGroup(f, indent+indentΔ, o, &v->groups[i]);
387 }399 }
400 USED(o);
388}401}
389 402
390int403int
@@ -405,13 +418,14 @@ err: · 14 unmodified lines
405}418}
406 419
407void420void
408print_SubtableCmap10(Biobuf *f, int indent, SubtableCmap10 *v)421print_SubtableCmap10(Biobuf *f, int indent, Otf *o, SubtableCmap10 *v)
409{422{
410 Bprint(f, "%*s%s: %ud\n", indent, "", "reserved", v->reserved);423 Bprint(f, "%*s%s: %ud\n", indent, "", "reserved", v->reserved);
411 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);424 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
412 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);425 Bprint(f, "%*s%s: %ud\n", indent, "", "language", v->language);
413 Bprint(f, "%*s%s: %ud\n", indent, "", "startCharCode", v->startCharCode);426 Bprint(f, "%*s%s: %ud\n", indent, "", "startCharCode", v->startCharCode);
414 Bprint(f, "%*s%s: %ud\n", indent, "", "numChars", v->numChars);427 Bprint(f, "%*s%s: %ud\n", indent, "", "numChars", v->numChars);
428 USED(o);
415}429}
416 430
417int431int
@@ -435,7 +449,7 @@ err: · 17 unmodified lines
435}449}
436 450
437void451void
438print_SubtableCmap12or13(Biobuf *f, int indent, SubtableCmap12or13 *v)452print_SubtableCmap12or13(Biobuf *f, int indent, Otf *o, SubtableCmap12or13 *v)
439{453{
440 Bprint(f, "%*s%s: %ud\n", indent, "", "reserved", v->reserved);454 Bprint(f, "%*s%s: %ud\n", indent, "", "reserved", v->reserved);
441 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);455 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
@@ -443,8 +457,9 @@ print_SubtableCmap12or13(Biobuf *f, int indent, SubtableCmap12or13 *v) · 1 unmodified line
443 Bprint(f, "%*s%s: %ud\n", indent, "", "numGroups", v->numGroups);457 Bprint(f, "%*s%s: %ud\n", indent, "", "numGroups", v->numGroups);
444 for(int i = 0; i < v->numGroups; i++){458 for(int i = 0; i < v->numGroups; i++){
445 Bprint(f, "%*s%s[%d]:\n", indent, "", "groups", i);459 Bprint(f, "%*s%s[%d]:\n", indent, "", "groups", i);
446 print_MapGroup(f, indent+indentΔ, &v->groups[i]);460 print_MapGroup(f, indent+indentΔ, o, &v->groups[i]);
447 }461 }
462 USED(o);
448}463}
449 464
450int465int
@@ -462,10 +477,11 @@ err: · 11 unmodified lines
462}477}
463 478
464void479void
465print_UnicodeRange(Biobuf *f, int indent, UnicodeRange *v)480print_UnicodeRange(Biobuf *f, int indent, Otf *o, UnicodeRange *v)
466{481{
467 Bprint(f, "%*s%s: %ud\n", indent, "", "startUnicodeValue", v->startUnicodeValue);482 Bprint(f, "%*s%s: %ud\n", indent, "", "startUnicodeValue", v->startUnicodeValue);
468 Bprint(f, "%*s%s: %ud\n", indent, "", "additionalCount", v->additionalCount);483 Bprint(f, "%*s%s: %ud\n", indent, "", "additionalCount", v->additionalCount);
484 USED(o);
469}485}
470 486
471int487int
@@ -486,13 +502,14 @@ err: · 14 unmodified lines
486}502}
487 503
488void504void
489print_DefaultUVS(Biobuf *f, int indent, DefaultUVS *v)505print_DefaultUVS(Biobuf *f, int indent, Otf *o, DefaultUVS *v)
490{506{
491 Bprint(f, "%*s%s: %ud\n", indent, "", "numUnicodeValueRanges", v->numUnicodeValueRanges);507 Bprint(f, "%*s%s: %ud\n", indent, "", "numUnicodeValueRanges", v->numUnicodeValueRanges);
492 for(int i = 0; i < v->numUnicodeValueRanges; i++){508 for(int i = 0; i < v->numUnicodeValueRanges; i++){
493 Bprint(f, "%*s%s[%d]:\n", indent, "", "ranges", i);509 Bprint(f, "%*s%s[%d]:\n", indent, "", "ranges", i);
494 print_UnicodeRange(f, indent+indentΔ, &v->ranges[i]);510 print_UnicodeRange(f, indent+indentΔ, o, &v->ranges[i]);
495 }511 }
512 USED(o);
496}513}
497 514
498int515int
@@ -510,10 +527,11 @@ err: · 11 unmodified lines
510}527}
511 528
512void529void
513print_UVSMapping(Biobuf *f, int indent, UVSMapping *v)530print_UVSMapping(Biobuf *f, int indent, Otf *o, UVSMapping *v)
514{531{
515 Bprint(f, "%*s%s: %ud\n", indent, "", "unicodeValue", v->unicodeValue);532 Bprint(f, "%*s%s: %ud\n", indent, "", "unicodeValue", v->unicodeValue);
516 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphID", v->glyphID);533 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphID", v->glyphID);
534 USED(o);
517}535}
518 536
519int537int
@@ -534,13 +552,14 @@ err: · 14 unmodified lines
534}552}
535 553
536void554void
537print_NonDefaultUVS(Biobuf *f, int indent, NonDefaultUVS *v)555print_NonDefaultUVS(Biobuf *f, int indent, Otf *o, NonDefaultUVS *v)
538{556{
539 Bprint(f, "%*s%s: %ud\n", indent, "", "numUVSMappings", v->numUVSMappings);557 Bprint(f, "%*s%s: %ud\n", indent, "", "numUVSMappings", v->numUVSMappings);
540 for(int i = 0; i < v->numUVSMappings; i++){558 for(int i = 0; i < v->numUVSMappings; i++){
541 Bprint(f, "%*s%s[%d]:\n", indent, "", "uvsMappings", i);559 Bprint(f, "%*s%s[%d]:\n", indent, "", "uvsMappings", i);
542 print_UVSMapping(f, indent+indentΔ, &v->uvsMappings[i]);560 print_UVSMapping(f, indent+indentΔ, o, &v->uvsMappings[i]);
543 }561 }
562 USED(o);
544}563}
545 564
546int565int
@@ -581,17 +600,18 @@ err: · 34 unmodified lines
581}600}
582 601
583void602void
584print_VariationSelector(Biobuf *f, int indent, VariationSelector *v)603print_VariationSelector(Biobuf *f, int indent, Otf *o, VariationSelector *v)
585{604{
586 Bprint(f, "%*s%s: %ud\n", indent, "", "varSelector", v->varSelector);605 Bprint(f, "%*s%s: %ud\n", indent, "", "varSelector", v->varSelector);
587 Bprint(f, "%*s%s: %ud\n", indent, "", "defaultUVSOffset", v->defaultUVSOffset);606 Bprint(f, "%*s%s: %ud\n", indent, "", "defaultUVSOffset", v->defaultUVSOffset);
588 Bprint(f, "%*s%s: %ud\n", indent, "", "nonDefaultUVSOffset", v->nonDefaultUVSOffset);607 Bprint(f, "%*s%s: %ud\n", indent, "", "nonDefaultUVSOffset", v->nonDefaultUVSOffset);
589 Bprint(f, "%*s%s:\n", indent, "", "defaultUVS");608 Bprint(f, "%*s%s:\n", indent, "", "defaultUVS");
590 if(v->defaultUVS != nil)609 if(v->defaultUVS != nil)
591 print_DefaultUVS(f, indent+indentΔ, v->defaultUVS);610 print_DefaultUVS(f, indent+indentΔ, o, v->defaultUVS);
592 Bprint(f, "%*s%s:\n", indent, "", "nonDefaultUVS");611 Bprint(f, "%*s%s:\n", indent, "", "nonDefaultUVS");
593 if(v->nonDefaultUVS != nil)612 if(v->nonDefaultUVS != nil)
594 print_NonDefaultUVS(f, indent+indentΔ, v->nonDefaultUVS);613 print_NonDefaultUVS(f, indent+indentΔ, o, v->nonDefaultUVS);
614 USED(o);
595}615}
596 616
597int617int
@@ -613,14 +633,15 @@ err: · 15 unmodified lines
613}633}
614 634
615void635void
616print_SubtableCmap14(Biobuf *f, int indent, SubtableCmap14 *v)636print_SubtableCmap14(Biobuf *f, int indent, Otf *o, SubtableCmap14 *v)
617{637{
618 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);638 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
619 Bprint(f, "%*s%s: %ud\n", indent, "", "numVarSelectorRecords", v->numVarSelectorRecords);639 Bprint(f, "%*s%s: %ud\n", indent, "", "numVarSelectorRecords", v->numVarSelectorRecords);
620 for(int i = 0; i < v->numVarSelectorRecords; i++){640 for(int i = 0; i < v->numVarSelectorRecords; i++){
621 Bprint(f, "%*s%s[%d]:\n", indent, "", "varSelector", i);641 Bprint(f, "%*s%s[%d]:\n", indent, "", "varSelector", i);
622 print_VariationSelector(f, indent+indentΔ, &v->varSelector[i]);642 print_VariationSelector(f, indent+indentΔ, o, &v->varSelector[i]);
623 }643 }
644 USED(o);
624}645}
625 646
626int647int
@@ -689,41 +710,42 @@ err: · 62 unmodified lines
689}710}
690 711
691void712void
692print_SubtableCmap(Biobuf *f, int indent, SubtableCmap *v)713print_SubtableCmap(Biobuf *f, int indent, Otf *o, SubtableCmap *v)
693{714{
694 Bprint(f, "%*s%s: %ud\n", indent, "", "format", v->format);715 Bprint(f, "%*s%s: %ud\n", indent, "", "format", v->format);
695 if(v->format == 0){716 if(v->format == 0){
696 Bprint(f, "%*s%s:\n", indent, "", "sub0");717 Bprint(f, "%*s%s:\n", indent, "", "sub0");
697 print_SubtableCmap0(f, indent+indentΔ, &v->sub0);718 print_SubtableCmap0(f, indent+indentΔ, o, &v->sub0);
698 }719 }
699 if(v->format == 2){720 if(v->format == 2){
700 Bprint(f, "%*s%s:\n", indent, "", "sub2");721 Bprint(f, "%*s%s:\n", indent, "", "sub2");
701 print_SubtableCmap2(f, indent+indentΔ, &v->sub2);722 print_SubtableCmap2(f, indent+indentΔ, o, &v->sub2);
702 }723 }
703 if(v->format == 4){724 if(v->format == 4){
704 Bprint(f, "%*s%s:\n", indent, "", "sub4");725 Bprint(f, "%*s%s:\n", indent, "", "sub4");
705 print_SubtableCmap4(f, indent+indentΔ, &v->sub4);726 print_SubtableCmap4(f, indent+indentΔ, o, &v->sub4);
706 }727 }
707 if(v->format == 6){728 if(v->format == 6){
708 Bprint(f, "%*s%s:\n", indent, "", "sub6");729 Bprint(f, "%*s%s:\n", indent, "", "sub6");
709 print_SubtableCmap6(f, indent+indentΔ, &v->sub6);730 print_SubtableCmap6(f, indent+indentΔ, o, &v->sub6);
710 }731 }
711 if(v->format == 8){732 if(v->format == 8){
712 Bprint(f, "%*s%s:\n", indent, "", "sub8");733 Bprint(f, "%*s%s:\n", indent, "", "sub8");
713 print_SubtableCmap8(f, indent+indentΔ, &v->sub8);734 print_SubtableCmap8(f, indent+indentΔ, o, &v->sub8);
714 }735 }
715 if(v->format == 10){736 if(v->format == 10){
716 Bprint(f, "%*s%s:\n", indent, "", "sub10");737 Bprint(f, "%*s%s:\n", indent, "", "sub10");
717 print_SubtableCmap10(f, indent+indentΔ, &v->sub10);738 print_SubtableCmap10(f, indent+indentΔ, o, &v->sub10);
718 }739 }
719 if(v->format == 12 || v->format == 13){740 if(v->format == 12 || v->format == 13){
720 Bprint(f, "%*s%s:\n", indent, "", "sub12or13");741 Bprint(f, "%*s%s:\n", indent, "", "sub12or13");
721 print_SubtableCmap12or13(f, indent+indentΔ, &v->sub12or13);742 print_SubtableCmap12or13(f, indent+indentΔ, o, &v->sub12or13);
722 }743 }
723 if(v->format == 14){744 if(v->format == 14){
724 Bprint(f, "%*s%s:\n", indent, "", "sub14");745 Bprint(f, "%*s%s:\n", indent, "", "sub14");
725 print_SubtableCmap14(f, indent+indentΔ, &v->sub14);746 print_SubtableCmap14(f, indent+indentΔ, o, &v->sub14);
726 }747 }
748 USED(o);
727}749}
728 750
729int751int
@@ -757,14 +779,15 @@ err: · 27 unmodified lines
757}779}
758 780
759void781void
760print_EncodingRecord(Biobuf *f, int indent, EncodingRecord *v)782print_EncodingRecord(Biobuf *f, int indent, Otf *o, EncodingRecord *v)
761{783{
762 Bprint(f, "%*s%s: %ud\n", indent, "", "platformID", v->platformID);784 Bprint(f, "%*s%s: %ud\n", indent, "", "platformID", v->platformID);
763 Bprint(f, "%*s%s: %ud\n", indent, "", "encodingID", v->encodingID);785 Bprint(f, "%*s%s: %ud\n", indent, "", "encodingID", v->encodingID);
764 Bprint(f, "%*s%s: %ud\n", indent, "", "subtableOffset", v->subtableOffset);786 Bprint(f, "%*s%s: %ud\n", indent, "", "subtableOffset", v->subtableOffset);
765 Bprint(f, "%*s%s:\n", indent, "", "subtable");787 Bprint(f, "%*s%s:\n", indent, "", "subtable");
766 if(v->subtable != nil)788 if(v->subtable != nil)
767 print_SubtableCmap(f, indent+indentΔ, v->subtable);789 print_SubtableCmap(f, indent+indentΔ, o, v->subtable);
790 USED(o);
768}791}
769 792
770int793int
@@ -790,13 +813,14 @@ err: · 19 unmodified lines
790}813}
791 814
792void815void
793print_TableCmap(Biobuf *f, int indent, TableCmap *v)816print_TableCmap(Biobuf *f, int indent, Otf *o, TableCmap *v)
794{817{
795 Bprint(f, "%*s%s: %ud\n", indent, "", "numTables", v->numTables);818 Bprint(f, "%*s%s: %ud\n", indent, "", "numTables", v->numTables);
796 for(int i = 0; i < v->numTables; i++){819 for(int i = 0; i < v->numTables; i++){
797 Bprint(f, "%*s%s[%d]:\n", indent, "", "encodingRecords", i);820 Bprint(f, "%*s%s[%d]:\n", indent, "", "encodingRecords", i);
798 print_EncodingRecord(f, indent+indentΔ, &v->encodingRecords[i]);821 print_EncodingRecord(f, indent+indentΔ, o, &v->encodingRecords[i]);
799 }822 }
823 USED(o);
800}824}
801 825
802int826int
@@ -840,6 +864,7 @@ read_TableHead(Otf *o, TableHead *v) · 37 unmodified lines
840 goto err;864 goto err;
841 }865 }
842 v->indexToLocFormat = b[50]<<8 | b[51];866 v->indexToLocFormat = b[50]<<8 | b[51];
867 o->indexToLocFormat = v->indexToLocFormat;
843 if(v->indexToLocFormat > 1){868 if(v->indexToLocFormat > 1){
844 werrstr("%s: invalid value: %d (0x%ux)", "indexToLocFormat", v->indexToLocFormat, v->indexToLocFormat);869 werrstr("%s: invalid value: %d (0x%ux)", "indexToLocFormat", v->indexToLocFormat, v->indexToLocFormat);
845 goto err;870 goto err;
@@ -856,7 +881,7 @@ err: · 10 unmodified lines
856}881}
857 882
858void883void
859print_TableHead(Biobuf *f, int indent, TableHead *v)884print_TableHead(Biobuf *f, int indent, Otf *o, TableHead *v)
860{885{
861 Bprint(f, "%*s%s: %ud\n", indent, "", "flags", v->flags);886 Bprint(f, "%*s%s: %ud\n", indent, "", "flags", v->flags);
862 Bprint(f, "%*s%s: %ud\n", indent, "", "unitsPerEm", v->unitsPerEm);887 Bprint(f, "%*s%s: %ud\n", indent, "", "unitsPerEm", v->unitsPerEm);
@@ -869,6 +894,7 @@ print_TableHead(Biobuf *f, int indent, TableHead *v) · 6 unmodified lines
869 Bprint(f, "%*s%s: %ud\n", indent, "", "macStyle", v->macStyle);894 Bprint(f, "%*s%s: %ud\n", indent, "", "macStyle", v->macStyle);
870 Bprint(f, "%*s%s: %ud\n", indent, "", "lowestRecPPEM", v->lowestRecPPEM);895 Bprint(f, "%*s%s: %ud\n", indent, "", "lowestRecPPEM", v->lowestRecPPEM);
871 Bprint(f, "%*s%s: %d\n", indent, "", "indexToLocFormat", v->indexToLocFormat);896 Bprint(f, "%*s%s: %d\n", indent, "", "indexToLocFormat", v->indexToLocFormat);
897 USED(o);
872}898}
873 899
874int900int
@@ -903,6 +929,7 @@ read_TableHhea(Otf *o, TableHhea *v) · 28 unmodified lines
903 goto err;929 goto err;
904 }930 }
905 v->numberOfHMetrics = b[34]<<8 | b[35];931 v->numberOfHMetrics = b[34]<<8 | b[35];
932 o->numberOfHMetrics = v->numberOfHMetrics;
906 return 0;933 return 0;
907err:934err:
908 werrstr("%s: %r", "TableHhea");935 werrstr("%s: %r", "TableHhea");
@@ -910,7 +937,7 @@ err: · 1 unmodified line
910}937}
911 938
912void939void
913print_TableHhea(Biobuf *f, int indent, TableHhea *v)940print_TableHhea(Biobuf *f, int indent, Otf *o, TableHhea *v)
914{941{
915 Bprint(f, "%*s%s: %ud\n", indent, "", "majorVersion", v->majorVersion);942 Bprint(f, "%*s%s: %ud\n", indent, "", "majorVersion", v->majorVersion);
916 Bprint(f, "%*s%s: %ud\n", indent, "", "minorVersion", v->minorVersion);943 Bprint(f, "%*s%s: %ud\n", indent, "", "minorVersion", v->minorVersion);
@@ -926,6 +953,7 @@ print_TableHhea(Biobuf *f, int indent, TableHhea *v) · 9 unmodified lines
926 Bprint(f, "%*s%s: %d\n", indent, "", "caretOffset", v->caretOffset);953 Bprint(f, "%*s%s: %d\n", indent, "", "caretOffset", v->caretOffset);
927 Bprint(f, "%*s%s: %d\n", indent, "", "metricDataFormat", v->metricDataFormat);954 Bprint(f, "%*s%s: %d\n", indent, "", "metricDataFormat", v->metricDataFormat);
928 Bprint(f, "%*s%s: %ud\n", indent, "", "numberOfHMetrics", v->numberOfHMetrics);955 Bprint(f, "%*s%s: %ud\n", indent, "", "numberOfHMetrics", v->numberOfHMetrics);
956 USED(o);
929}957}
930 958
931int959int
@@ -943,10 +971,11 @@ err: · 11 unmodified lines
943}971}
944 972
945void973void
946print_LongHorMetric(Biobuf *f, int indent, LongHorMetric *v)974print_LongHorMetric(Biobuf *f, int indent, Otf *o, LongHorMetric *v)
947{975{
948 Bprint(f, "%*s%s: %ud\n", indent, "", "advanceWidth", v->advanceWidth);976 Bprint(f, "%*s%s: %ud\n", indent, "", "advanceWidth", v->advanceWidth);
949 Bprint(f, "%*s%s: %d\n", indent, "", "lsb", v->lsb);977 Bprint(f, "%*s%s: %d\n", indent, "", "lsb", v->lsb);
978 USED(o);
950}979}
951 980
952int981int
@@ -961,6 +990,7 @@ read_TableMaxp(Otf *o, TableMaxp *v) · 8 unmodified lines
961 goto err;990 goto err;
962 }991 }
963 v->numGlyphs = b[4]<<8 | b[5];992 v->numGlyphs = b[4]<<8 | b[5];
993 o->numGlyphs = v->numGlyphs;
964 return 0;994 return 0;
965err:995err:
966 werrstr("%s: %r", "TableMaxp");996 werrstr("%s: %r", "TableMaxp");
@@ -968,9 +998,41 @@ err: · 1 unmodified line
968}998}
969 999
970void1000void
971print_TableMaxp(Biobuf *f, int indent, TableMaxp *v)1001print_TableMaxp(Biobuf *f, int indent, Otf *o, TableMaxp *v)
972{1002{
973 Bprint(f, "%*s%s: %ud\n", indent, "", "numGlyphs", v->numGlyphs);1003 Bprint(f, "%*s%s: %ud\n", indent, "", "numGlyphs", v->numGlyphs);
1004 USED(o);
1005}
1006
1007int
1008read_TableHmtx(Otf *o, TableHmtx *v)
1009{
1010 u8int *b;
1011 if(otfarray(o, &v->hMetrics, read_LongHorMetric, sizeof(LongHorMetric), (o->numberOfHMetrics+0)) < 0){
1012 werrstr("%s: %r", "hMetrics");
1013 goto err;
1014 }
1015 if((b = otfreadn(o, (o->numGlyphs-o->numberOfHMetrics)*2)) == nil)
1016 goto err;
1017 v->leftSideBearings = malloc((o->numGlyphs-o->numberOfHMetrics)*sizeof(*v->leftSideBearings));
1018 for(int i = 0; i < (o->numGlyphs-o->numberOfHMetrics); i++)
1019 v->leftSideBearings[i] = b[0+i*2]<<8 | b[1+i*2];
1020 return 0;
1021err:
1022 werrstr("%s: %r", "TableHmtx");
1023 return -1;
1024}
1025
1026void
1027print_TableHmtx(Biobuf *f, int indent, Otf *o, TableHmtx *v)
1028{
1029 for(int i = 0; i < (o->numberOfHMetrics+0); i++){
1030 Bprint(f, "%*s%s[%d]:\n", indent, "", "hMetrics", i);
1031 print_LongHorMetric(f, indent+indentΔ, o, &v->hMetrics[i]);
1032 }
1033 for(int i = 0; i < (o->numGlyphs-o->numberOfHMetrics); i++)
1034 Bprint(f, "%*s%s[%d]: %d\n", indent, "", "leftSideBearings", i, v->leftSideBearings[i]);
1035 USED(o);
974}1036}
975 1037
976int1038int
@@ -995,12 +1057,13 @@ err: · 18 unmodified lines
995}1057}
996 1058
997void1059void
998print_TablePost(Biobuf *f, int indent, TablePost *v)1060print_TablePost(Biobuf *f, int indent, Otf *o, TablePost *v)
999{1061{
1000 Bprint(f, "%*s%s: %g\n", indent, "", "italicAngle", v->italicAngle);1062 Bprint(f, "%*s%s: %g\n", indent, "", "italicAngle", v->italicAngle);
1001 Bprint(f, "%*s%s: %d\n", indent, "", "underlinePosition", v->underlinePosition);1063 Bprint(f, "%*s%s: %d\n", indent, "", "underlinePosition", v->underlinePosition);
1002 Bprint(f, "%*s%s: %d\n", indent, "", "underlineThickness", v->underlineThickness);1064 Bprint(f, "%*s%s: %d\n", indent, "", "underlineThickness", v->underlineThickness);
1003 Bprint(f, "%*s%s: %ud\n", indent, "", "isFixedPitch", v->isFixedPitch);1065 Bprint(f, "%*s%s: %ud\n", indent, "", "isFixedPitch", v->isFixedPitch);
1066 USED(o);
1004}1067}
1005 1068
1006int1069int
@@ -1022,7 +1085,7 @@ err: · 15 unmodified lines
1022}1085}
1023 1086
1024void1087void
1025print_NameRecord(Biobuf *f, int indent, NameRecord *v)1088print_NameRecord(Biobuf *f, int indent, Otf *o, NameRecord *v)
1026{1089{
1027 Bprint(f, "%*s%s: %ud\n", indent, "", "platformID", v->platformID);1090 Bprint(f, "%*s%s: %ud\n", indent, "", "platformID", v->platformID);
1028 Bprint(f, "%*s%s: %ud\n", indent, "", "encodingID", v->encodingID);1091 Bprint(f, "%*s%s: %ud\n", indent, "", "encodingID", v->encodingID);
@@ -1030,6 +1093,7 @@ print_NameRecord(Biobuf *f, int indent, NameRecord *v) · 1 unmodified line
1030 Bprint(f, "%*s%s: %ud\n", indent, "", "nameID", v->nameID);1093 Bprint(f, "%*s%s: %ud\n", indent, "", "nameID", v->nameID);
1031 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);1094 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
1032 Bprint(f, "%*s%s: %ud\n", indent, "", "stringOffset", v->stringOffset);1095 Bprint(f, "%*s%s: %ud\n", indent, "", "stringOffset", v->stringOffset);
1096 USED(o);
1033}1097}
1034 1098
1035int1099int
@@ -1047,10 +1111,11 @@ err: · 11 unmodified lines
1047}1111}
1048 1112
1049void1113void
1050print_LangTagRecord(Biobuf *f, int indent, LangTagRecord *v)1114print_LangTagRecord(Biobuf *f, int indent, Otf *o, LangTagRecord *v)
1051{1115{
1052 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);1116 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
1053 Bprint(f, "%*s%s: %ud\n", indent, "", "langTagOffset", v->langTagOffset);1117 Bprint(f, "%*s%s: %ud\n", indent, "", "langTagOffset", v->langTagOffset);
1118 USED(o);
1054}1119}
1055 1120
1056int1121int
@@ -1088,23 +1153,24 @@ err: · 31 unmodified lines
1088}1153}
1089 1154
1090void1155void
1091print_TableName(Biobuf *f, int indent, TableName *v)1156print_TableName(Biobuf *f, int indent, Otf *o, TableName *v)
1092{1157{
1093 Bprint(f, "%*s%s: %ud\n", indent, "", "version", v->version);1158 Bprint(f, "%*s%s: %ud\n", indent, "", "version", v->version);
1094 Bprint(f, "%*s%s: %ud\n", indent, "", "count", v->count);1159 Bprint(f, "%*s%s: %ud\n", indent, "", "count", v->count);
1095 Bprint(f, "%*s%s: %ud\n", indent, "", "storageOffset", v->storageOffset);1160 Bprint(f, "%*s%s: %ud\n", indent, "", "storageOffset", v->storageOffset);
1096 for(int i = 0; i < v->count; i++){1161 for(int i = 0; i < v->count; i++){
1097 Bprint(f, "%*s%s[%d]:\n", indent, "", "nameRecord", i);1162 Bprint(f, "%*s%s[%d]:\n", indent, "", "nameRecord", i);
1098 print_NameRecord(f, indent+indentΔ, &v->nameRecord[i]);1163 print_NameRecord(f, indent+indentΔ, o, &v->nameRecord[i]);
1099 }1164 }
1100 if(v->version >= 1)1165 if(v->version >= 1)
1101 Bprint(f, "%*s%s: %ud\n", indent, "", "langTagCount", v->langTagCount);1166 Bprint(f, "%*s%s: %ud\n", indent, "", "langTagCount", v->langTagCount);
1102 if(v->version >= 1){1167 if(v->version >= 1){
1103 for(int i = 0; i < v->langTagCount; i++){1168 for(int i = 0; i < v->langTagCount; i++){
1104 Bprint(f, "%*s%s[%d]:\n", indent, "", "langTagRecord", i);1169 Bprint(f, "%*s%s[%d]:\n", indent, "", "langTagRecord", i);
1105 print_LangTagRecord(f, indent+indentΔ, &v->langTagRecord[i]);1170 print_LangTagRecord(f, indent+indentΔ, o, &v->langTagRecord[i]);
1106 }1171 }
1107 }1172 }
1173 USED(o);
1108}1174}
1109 1175
1110int1176int
@@ -1128,7 +1194,7 @@ err: · 17 unmodified lines
1128}1194}
1129 1195
1130void1196void
1131print_BigGlyphMetrics(Biobuf *f, int indent, BigGlyphMetrics *v)1197print_BigGlyphMetrics(Biobuf *f, int indent, Otf *o, BigGlyphMetrics *v)
1132{1198{
1133 Bprint(f, "%*s%s: %ud\n", indent, "", "height", v->height);1199 Bprint(f, "%*s%s: %ud\n", indent, "", "height", v->height);
1134 Bprint(f, "%*s%s: %ud\n", indent, "", "width", v->width);1200 Bprint(f, "%*s%s: %ud\n", indent, "", "width", v->width);
@@ -1138,6 +1204,7 @@ print_BigGlyphMetrics(Biobuf *f, int indent, BigGlyphMetrics *v) · 3 unmodified lines
1138 Bprint(f, "%*s%s: %d\n", indent, "", "vertBearingX", v->vertBearingX);1204 Bprint(f, "%*s%s: %d\n", indent, "", "vertBearingX", v->vertBearingX);
1139 Bprint(f, "%*s%s: %d\n", indent, "", "vertBearingY", v->vertBearingY);1205 Bprint(f, "%*s%s: %d\n", indent, "", "vertBearingY", v->vertBearingY);
1140 Bprint(f, "%*s%s: %ud\n", indent, "", "vertAdvance", v->vertAdvance);1206 Bprint(f, "%*s%s: %ud\n", indent, "", "vertAdvance", v->vertAdvance);
1207 USED(o);
1141}1208}
1142 1209
1143int1210int
@@ -1158,13 +1225,14 @@ err: · 14 unmodified lines
1158}1225}
1159 1226
1160void1227void
1161print_SmallGlyphMetrics(Biobuf *f, int indent, SmallGlyphMetrics *v)1228print_SmallGlyphMetrics(Biobuf *f, int indent, Otf *o, SmallGlyphMetrics *v)
1162{1229{
1163 Bprint(f, "%*s%s: %ud\n", indent, "", "height", v->height);1230 Bprint(f, "%*s%s: %ud\n", indent, "", "height", v->height);
1164 Bprint(f, "%*s%s: %ud\n", indent, "", "width", v->width);1231 Bprint(f, "%*s%s: %ud\n", indent, "", "width", v->width);
1165 Bprint(f, "%*s%s: %d\n", indent, "", "bearingX", v->bearingX);1232 Bprint(f, "%*s%s: %d\n", indent, "", "bearingX", v->bearingX);
1166 Bprint(f, "%*s%s: %d\n", indent, "", "bearingY", v->bearingY);1233 Bprint(f, "%*s%s: %d\n", indent, "", "bearingY", v->bearingY);
1167 Bprint(f, "%*s%s: %ud\n", indent, "", "advance", v->advance);1234 Bprint(f, "%*s%s: %ud\n", indent, "", "advance", v->advance);
1235 USED(o);
1168}1236}
1169 1237
1170int1238int
@@ -1190,7 +1258,7 @@ err: · 19 unmodified lines
1190}1258}
1191 1259
1192void1260void
1193print_SbitLineMetrics(Biobuf *f, int indent, SbitLineMetrics *v)1261print_SbitLineMetrics(Biobuf *f, int indent, Otf *o, SbitLineMetrics *v)
1194{1262{
1195 Bprint(f, "%*s%s: %d\n", indent, "", "ascender", v->ascender);1263 Bprint(f, "%*s%s: %d\n", indent, "", "ascender", v->ascender);
1196 Bprint(f, "%*s%s: %d\n", indent, "", "descender", v->descender);1264 Bprint(f, "%*s%s: %d\n", indent, "", "descender", v->descender);
@@ -1202,15 +1270,18 @@ print_SbitLineMetrics(Biobuf *f, int indent, SbitLineMetrics *v) · 5 unmodified lines
1202 Bprint(f, "%*s%s: %d\n", indent, "", "minAdvanceSB", v->minAdvanceSB);1270 Bprint(f, "%*s%s: %d\n", indent, "", "minAdvanceSB", v->minAdvanceSB);
1203 Bprint(f, "%*s%s: %d\n", indent, "", "maxBeforeBL", v->maxBeforeBL);1271 Bprint(f, "%*s%s: %d\n", indent, "", "maxBeforeBL", v->maxBeforeBL);
1204 Bprint(f, "%*s%s: %d\n", indent, "", "minAfterBL", v->minAfterBL);1272 Bprint(f, "%*s%s: %d\n", indent, "", "minAfterBL", v->minAfterBL);
1273 USED(o);
1205}1274}
1206 1275
1207int1276int
1208read_IndexSubtable1(Otf *o, IndexSubtable1 *v)1277read_IndexSubtable1(Otf *o, IndexSubtable1 *v)
1209{1278{
1210 u8int *b;1279 u8int *b;
1211 if((b = otfreadn(o, 4)) == nil)1280 if((b = otfreadn(o, ((o->lastGlyphIndex-o->firstGlyphIndex)+2)*4)) == nil)
1212 goto err;1281 goto err;
1213 v->sbitOffsets = b[0]<<24 | b[1]<<16 | b[2]<<8 | b[3];1282 v->sbitOffsets = malloc(((o->lastGlyphIndex-o->firstGlyphIndex)+2)*sizeof(*v->sbitOffsets));
1283 for(int i = 0; i < ((o->lastGlyphIndex-o->firstGlyphIndex)+2); i++)
1284 v->sbitOffsets[i] = b[0+i*4]<<24 | b[1+i*4]<<16 | b[2+i*4]<<8 | b[3+i*4];
1214 return 0;1285 return 0;
1215err:1286err:
1216 werrstr("%s: %r", "IndexSubtable1");1287 werrstr("%s: %r", "IndexSubtable1");
@@ -1218,9 +1289,11 @@ err: · 1 unmodified line
1218}1289}
1219 1290
1220void1291void
1221print_IndexSubtable1(Biobuf *f, int indent, IndexSubtable1 *v)1292print_IndexSubtable1(Biobuf *f, int indent, Otf *o, IndexSubtable1 *v)
1222{1293{
1223 Bprint(f, "%*s%s: %ud\n", indent, "", "sbitOffsets", v->sbitOffsets);1294 for(int i = 0; i < ((o->lastGlyphIndex-o->firstGlyphIndex)+2); i++)
1295 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "sbitOffsets", i, v->sbitOffsets[i]);
1296 USED(o);
1224}1297}
1225 1298
1226int1299int
@@ -1241,20 +1314,23 @@ err: · 14 unmodified lines
1241}1314}
1242 1315
1243void1316void
1244print_IndexSubtable2(Biobuf *f, int indent, IndexSubtable2 *v)1317print_IndexSubtable2(Biobuf *f, int indent, Otf *o, IndexSubtable2 *v)
1245{1318{
1246 Bprint(f, "%*s%s: %ud\n", indent, "", "imageSize", v->imageSize);1319 Bprint(f, "%*s%s: %ud\n", indent, "", "imageSize", v->imageSize);
1247 Bprint(f, "%*s%s:\n", indent, "", "bigMetrics");1320 Bprint(f, "%*s%s:\n", indent, "", "bigMetrics");
1248 print_BigGlyphMetrics(f, indent+indentΔ, &v->bigMetrics);1321 print_BigGlyphMetrics(f, indent+indentΔ, o, &v->bigMetrics);
1322 USED(o);
1249}1323}
1250 1324
1251int1325int
1252read_IndexSubtable3(Otf *o, IndexSubtable3 *v)1326read_IndexSubtable3(Otf *o, IndexSubtable3 *v)
1253{1327{
1254 u8int *b;1328 u8int *b;
1255 if((b = otfreadn(o, 2)) == nil)1329 if((b = otfreadn(o, ((o->lastGlyphIndex-o->firstGlyphIndex)+2)*2)) == nil)
1256 goto err;1330 goto err;
1257 v->sbitOffsets = b[0]<<8 | b[1];1331 v->sbitOffsets = malloc(((o->lastGlyphIndex-o->firstGlyphIndex)+2)*sizeof(*v->sbitOffsets));
1332 for(int i = 0; i < ((o->lastGlyphIndex-o->firstGlyphIndex)+2); i++)
1333 v->sbitOffsets[i] = b[0+i*2]<<8 | b[1+i*2];
1258 return 0;1334 return 0;
1259err:1335err:
1260 werrstr("%s: %r", "IndexSubtable3");1336 werrstr("%s: %r", "IndexSubtable3");
@@ -1262,9 +1338,11 @@ err: · 1 unmodified line
1262}1338}
1263 1339
1264void1340void
1265print_IndexSubtable3(Biobuf *f, int indent, IndexSubtable3 *v)1341print_IndexSubtable3(Biobuf *f, int indent, Otf *o, IndexSubtable3 *v)
1266{1342{
1267 Bprint(f, "%*s%s: %ud\n", indent, "", "sbitOffsets", v->sbitOffsets);1343 for(int i = 0; i < ((o->lastGlyphIndex-o->firstGlyphIndex)+2); i++)
1344 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "sbitOffsets", i, v->sbitOffsets[i]);
1345 USED(o);
1268}1346}
1269 1347
1270int1348int
@@ -1282,10 +1360,11 @@ err: · 11 unmodified lines
1282}1360}
1283 1361
1284void1362void
1285print_GlyphIdOffsetPair(Biobuf *f, int indent, GlyphIdOffsetPair *v)1363print_GlyphIdOffsetPair(Biobuf *f, int indent, Otf *o, GlyphIdOffsetPair *v)
1286{1364{
1287 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphID", v->glyphID);1365 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphID", v->glyphID);
1288 Bprint(f, "%*s%s: %ud\n", indent, "", "sbitOffset", v->sbitOffset);1366 Bprint(f, "%*s%s: %ud\n", indent, "", "sbitOffset", v->sbitOffset);
1367 USED(o);
1289}1368}
1290 1369
1291int1370int
@@ -1295,7 +1374,7 @@ read_IndexSubtable4(Otf *o, IndexSubtable4 *v) · 3 unmodified lines
1295 if((b = otfreadn(o, 4)) == nil)1374 if((b = otfreadn(o, 4)) == nil)
1296 goto err;1375 goto err;
1297 v->numGlyphs = b[0]<<24 | b[1]<<16 | b[2]<<8 | b[3];1376 v->numGlyphs = b[0]<<24 | b[1]<<16 | b[2]<<8 | b[3];
1298 if(otfarray(o, &v->glyphArray, read_GlyphIdOffsetPair, sizeof(GlyphIdOffsetPair), v->numGlyphs+1) < 0){1377 if(otfarray(o, &v->glyphArray, read_GlyphIdOffsetPair, sizeof(GlyphIdOffsetPair), (v->numGlyphs+1)) < 0){
1299 werrstr("%s: %r", "glyphArray");1378 werrstr("%s: %r", "glyphArray");
1300 goto err;1379 goto err;
1301 }1380 }
@@ -1306,13 +1385,14 @@ err: · 4 unmodified lines
1306}1385}
1307 1386
1308void1387void
1309print_IndexSubtable4(Biobuf *f, int indent, IndexSubtable4 *v)1388print_IndexSubtable4(Biobuf *f, int indent, Otf *o, IndexSubtable4 *v)
1310{1389{
1311 Bprint(f, "%*s%s: %ud\n", indent, "", "numGlyphs", v->numGlyphs);1390 Bprint(f, "%*s%s: %ud\n", indent, "", "numGlyphs", v->numGlyphs);
1312 for(int i = 0; i < v->numGlyphs+1; i++){1391 for(int i = 0; i < (v->numGlyphs+1); i++){
1313 Bprint(f, "%*s%s[%d]:\n", indent, "", "glyphArray", i);1392 Bprint(f, "%*s%s[%d]:\n", indent, "", "glyphArray", i);
1314 print_GlyphIdOffsetPair(f, indent+indentΔ, &v->glyphArray[i]);1393 print_GlyphIdOffsetPair(f, indent+indentΔ, o, &v->glyphArray[i]);
1315 }1394 }
1395 USED(o);
1316}1396}
1317 1397
1318int1398int
@@ -1341,14 +1421,15 @@ err: · 22 unmodified lines
1341}1421}
1342 1422
1343void1423void
1344print_IndexSubtable5(Biobuf *f, int indent, IndexSubtable5 *v)1424print_IndexSubtable5(Biobuf *f, int indent, Otf *o, IndexSubtable5 *v)
1345{1425{
1346 Bprint(f, "%*s%s: %ud\n", indent, "", "imageSize", v->imageSize);1426 Bprint(f, "%*s%s: %ud\n", indent, "", "imageSize", v->imageSize);
1347 Bprint(f, "%*s%s:\n", indent, "", "bigMetrics");1427 Bprint(f, "%*s%s:\n", indent, "", "bigMetrics");
1348 print_BigGlyphMetrics(f, indent+indentΔ, &v->bigMetrics);1428 print_BigGlyphMetrics(f, indent+indentΔ, o, &v->bigMetrics);
1349 Bprint(f, "%*s%s: %ud\n", indent, "", "numGlyphs", v->numGlyphs);1429 Bprint(f, "%*s%s: %ud\n", indent, "", "numGlyphs", v->numGlyphs);
1350 for(int i = 0; i < v->numGlyphs; i++)1430 for(int i = 0; i < v->numGlyphs; i++)
1351 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "glyphIdArray", i, v->glyphIdArray[i]);1431 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "glyphIdArray", i, v->glyphIdArray[i]);
1432 USED(o);
1352}1433}
1353 1434
1354int1435int
@@ -1401,31 +1482,32 @@ err: · 46 unmodified lines
1401}1482}
1402 1483
1403void1484void
1404print_IndexSubtable(Biobuf *f, int indent, IndexSubtable *v)1485print_IndexSubtable(Biobuf *f, int indent, Otf *o, IndexSubtable *v)
1405{1486{
1406 Bprint(f, "%*s%s: %ud\n", indent, "", "indexFormat", v->indexFormat);1487 Bprint(f, "%*s%s: %ud\n", indent, "", "indexFormat", v->indexFormat);
1407 Bprint(f, "%*s%s: %ud\n", indent, "", "imageFormat", v->imageFormat);1488 Bprint(f, "%*s%s: %ud\n", indent, "", "imageFormat", v->imageFormat);
1408 Bprint(f, "%*s%s: %ud\n", indent, "", "imageDataOffset", v->imageDataOffset);1489 Bprint(f, "%*s%s: %ud\n", indent, "", "imageDataOffset", v->imageDataOffset);
1409 if(v->indexFormat == 1){1490 if(v->indexFormat == 1){
1410 Bprint(f, "%*s%s:\n", indent, "", "sub1");1491 Bprint(f, "%*s%s:\n", indent, "", "sub1");
1411 print_IndexSubtable1(f, indent+indentΔ, &v->sub1);1492 print_IndexSubtable1(f, indent+indentΔ, o, &v->sub1);
1412 }1493 }
1413 if(v->indexFormat == 2){1494 if(v->indexFormat == 2){
1414 Bprint(f, "%*s%s:\n", indent, "", "sub2");1495 Bprint(f, "%*s%s:\n", indent, "", "sub2");
1415 print_IndexSubtable2(f, indent+indentΔ, &v->sub2);1496 print_IndexSubtable2(f, indent+indentΔ, o, &v->sub2);
1416 }1497 }
1417 if(v->indexFormat == 3){1498 if(v->indexFormat == 3){
1418 Bprint(f, "%*s%s:\n", indent, "", "sub3");1499 Bprint(f, "%*s%s:\n", indent, "", "sub3");
1419 print_IndexSubtable3(f, indent+indentΔ, &v->sub3);1500 print_IndexSubtable3(f, indent+indentΔ, o, &v->sub3);
1420 }1501 }
1421 if(v->indexFormat == 4){1502 if(v->indexFormat == 4){
1422 Bprint(f, "%*s%s:\n", indent, "", "sub4");1503 Bprint(f, "%*s%s:\n", indent, "", "sub4");
1423 print_IndexSubtable4(f, indent+indentΔ, &v->sub4);1504 print_IndexSubtable4(f, indent+indentΔ, o, &v->sub4);
1424 }1505 }
1425 if(v->indexFormat == 5){1506 if(v->indexFormat == 5){
1426 Bprint(f, "%*s%s:\n", indent, "", "sub5");1507 Bprint(f, "%*s%s:\n", indent, "", "sub5");
1427 print_IndexSubtable5(f, indent+indentΔ, &v->sub5);1508 print_IndexSubtable5(f, indent+indentΔ, o, &v->sub5);
1428 }1509 }
1510 USED(o);
1429}1511}
1430 1512
1431int1513int
@@ -1435,7 +1517,9 @@ read_IndexSubtableRecord(Otf *o, IndexSubtableRecord *v) · 3 unmodified lines
1435 if((b = otfreadn(o, 8)) == nil)1517 if((b = otfreadn(o, 8)) == nil)
1436 goto err;1518 goto err;
1437 v->firstGlyphIndex = b[0]<<8 | b[1];1519 v->firstGlyphIndex = b[0]<<8 | b[1];
1520 o->firstGlyphIndex = v->firstGlyphIndex;
1438 v->lastGlyphIndex = b[2]<<8 | b[3];1521 v->lastGlyphIndex = b[2]<<8 | b[3];
1522 o->lastGlyphIndex = v->lastGlyphIndex;
1439 v->indexSubtableOffset = b[4]<<24 | b[5]<<16 | b[6]<<8 | b[7];1523 v->indexSubtableOffset = b[4]<<24 | b[5]<<16 | b[6]<<8 | b[7];
1440 if(v->indexSubtableOffset != 0){1524 if(v->indexSubtableOffset != 0){
1441 if(otfpushrange(o, v->indexSubtableOffset, -1) < 0)1525 if(otfpushrange(o, v->indexSubtableOffset, -1) < 0)
@@ -1455,14 +1539,15 @@ err: · 13 unmodified lines
1455}1539}
1456 1540
1457void1541void
1458print_IndexSubtableRecord(Biobuf *f, int indent, IndexSubtableRecord *v)1542print_IndexSubtableRecord(Biobuf *f, int indent, Otf *o, IndexSubtableRecord *v)
1459{1543{
1460 Bprint(f, "%*s%s: %ud\n", indent, "", "firstGlyphIndex", v->firstGlyphIndex);1544 Bprint(f, "%*s%s: %ud\n", indent, "", "firstGlyphIndex", v->firstGlyphIndex);
1461 Bprint(f, "%*s%s: %ud\n", indent, "", "lastGlyphIndex", v->lastGlyphIndex);1545 Bprint(f, "%*s%s: %ud\n", indent, "", "lastGlyphIndex", v->lastGlyphIndex);
1462 Bprint(f, "%*s%s: %ud\n", indent, "", "indexSubtableOffset", v->indexSubtableOffset);1546 Bprint(f, "%*s%s: %ud\n", indent, "", "indexSubtableOffset", v->indexSubtableOffset);
1463 Bprint(f, "%*s%s:\n", indent, "", "indexSubtable");1547 Bprint(f, "%*s%s:\n", indent, "", "indexSubtable");
1464 if(v->indexSubtable != nil)1548 if(v->indexSubtable != nil)
1465 print_IndexSubtable(f, indent+indentΔ, v->indexSubtable);1549 print_IndexSubtable(f, indent+indentΔ, o, v->indexSubtable);
1550 USED(o);
1466}1551}
1467 1552
1468int1553int
@@ -1507,15 +1592,15 @@ err: · 38 unmodified lines
1507}1592}
1508 1593
1509void1594void
1510print_BitmapSize(Biobuf *f, int indent, BitmapSize *v)1595print_BitmapSize(Biobuf *f, int indent, Otf *o, BitmapSize *v)
1511{1596{
1512 Bprint(f, "%*s%s: %ud\n", indent, "", "indexSubtableListOffset", v->indexSubtableListOffset);1597 Bprint(f, "%*s%s: %ud\n", indent, "", "indexSubtableListOffset", v->indexSubtableListOffset);
1513 Bprint(f, "%*s%s: %ud\n", indent, "", "indexSubtableListSize", v->indexSubtableListSize);1598 Bprint(f, "%*s%s: %ud\n", indent, "", "indexSubtableListSize", v->indexSubtableListSize);
1514 Bprint(f, "%*s%s: %ud\n", indent, "", "numberOfIndexSubtables", v->numberOfIndexSubtables);1599 Bprint(f, "%*s%s: %ud\n", indent, "", "numberOfIndexSubtables", v->numberOfIndexSubtables);
1515 Bprint(f, "%*s%s:\n", indent, "", "hori");1600 Bprint(f, "%*s%s:\n", indent, "", "hori");
1516 print_SbitLineMetrics(f, indent+indentΔ, &v->hori);1601 print_SbitLineMetrics(f, indent+indentΔ, o, &v->hori);
1517 Bprint(f, "%*s%s:\n", indent, "", "vert");1602 Bprint(f, "%*s%s:\n", indent, "", "vert");
1518 print_SbitLineMetrics(f, indent+indentΔ, &v->vert);1603 print_SbitLineMetrics(f, indent+indentΔ, o, &v->vert);
1519 Bprint(f, "%*s%s: %ud\n", indent, "", "startGlyphIndex", v->startGlyphIndex);1604 Bprint(f, "%*s%s: %ud\n", indent, "", "startGlyphIndex", v->startGlyphIndex);
1520 Bprint(f, "%*s%s: %ud\n", indent, "", "endGlyphIndex", v->endGlyphIndex);1605 Bprint(f, "%*s%s: %ud\n", indent, "", "endGlyphIndex", v->endGlyphIndex);
1521 Bprint(f, "%*s%s: %ud\n", indent, "", "ppemX", v->ppemX);1606 Bprint(f, "%*s%s: %ud\n", indent, "", "ppemX", v->ppemX);
@@ -1524,8 +1609,9 @@ print_BitmapSize(Biobuf *f, int indent, BitmapSize *v) · 2 unmodified lines
1524 Bprint(f, "%*s%s: %d\n", indent, "", "flags", v->flags);1609 Bprint(f, "%*s%s: %d\n", indent, "", "flags", v->flags);
1525 for(int i = 0; i < v->numberOfIndexSubtables; i++){1610 for(int i = 0; i < v->numberOfIndexSubtables; i++){
1526 Bprint(f, "%*s%s[%d]:\n", indent, "", "indexSubtableList", i);1611 Bprint(f, "%*s%s[%d]:\n", indent, "", "indexSubtableList", i);
1527 print_IndexSubtableRecord(f, indent+indentΔ, &v->indexSubtableList[i]);1612 print_IndexSubtableRecord(f, indent+indentΔ, o, &v->indexSubtableList[i]);
1528 }1613 }
1614 USED(o);
1529}1615}
1530 1616
1531int1617int
@@ -1551,9 +1637,10 @@ err: · 19 unmodified lines
1551}1637}
1552 1638
1553void1639void
1554print_TableEBDT(Biobuf *f, int indent, TableEBDT *v)1640print_TableEBDT(Biobuf *f, int indent, Otf *o, TableEBDT *v)
1555{1641{
1556 Bprint(f, "%*s%s: %ud\n", indent, "", "majorVersion", v->majorVersion);1642 Bprint(f, "%*s%s: %ud\n", indent, "", "majorVersion", v->majorVersion);
1643 USED(o);
1557}1644}
1558 1645
1559int1646int
@@ -1584,13 +1671,14 @@ err: · 24 unmodified lines
1584}1671}
1585 1672
1586void1673void
1587print_TableEBLC(Biobuf *f, int indent, TableEBLC *v)1674print_TableEBLC(Biobuf *f, int indent, Otf *o, TableEBLC *v)
1588{1675{
1589 Bprint(f, "%*s%s: %ud\n", indent, "", "numSizes", v->numSizes);1676 Bprint(f, "%*s%s: %ud\n", indent, "", "numSizes", v->numSizes);
1590 for(int i = 0; i < v->numSizes; i++){1677 for(int i = 0; i < v->numSizes; i++){
1591 Bprint(f, "%*s%s[%d]:\n", indent, "", "bitmapSizes", i);1678 Bprint(f, "%*s%s[%d]:\n", indent, "", "bitmapSizes", i);
1592 print_BitmapSize(f, indent+indentΔ, &v->bitmapSizes[i]);1679 print_BitmapSize(f, indent+indentΔ, o, &v->bitmapSizes[i]);
1593 }1680 }
1681 USED(o);
1594}1682}
1595 1683
1596int1684int
@@ -1613,12 +1701,13 @@ err: · 16 unmodified lines
1613}1701}
1614 1702
1615void1703void
1616print_AttachList(Biobuf *f, int indent, AttachList *v)1704print_AttachList(Biobuf *f, int indent, Otf *o, AttachList *v)
1617{1705{
1618 Bprint(f, "%*s%s: %ud\n", indent, "", "coverageOffset", v->coverageOffset);1706 Bprint(f, "%*s%s: %ud\n", indent, "", "coverageOffset", v->coverageOffset);
1619 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphCount", v->glyphCount);1707 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphCount", v->glyphCount);
1620 for(int i = 0; i < v->glyphCount; i++)1708 for(int i = 0; i < v->glyphCount; i++)
1621 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "attachPointOffsets", i, v->attachPointOffsets[i]);1709 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "attachPointOffsets", i, v->attachPointOffsets[i]);
1710 USED(o);
1622}1711}
1623 1712
1624int1713int
@@ -1640,11 +1729,12 @@ err: · 15 unmodified lines
1640}1729}
1641 1730
1642void1731void
1643print_AttachPoint(Biobuf *f, int indent, AttachPoint *v)1732print_AttachPoint(Biobuf *f, int indent, Otf *o, AttachPoint *v)
1644{1733{
1645 Bprint(f, "%*s%s: %ud\n", indent, "", "pointCount", v->pointCount);1734 Bprint(f, "%*s%s: %ud\n", indent, "", "pointCount", v->pointCount);
1646 for(int i = 0; i < v->pointCount; i++)1735 for(int i = 0; i < v->pointCount; i++)
1647 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "pointIndices", i, v->pointIndices[i]);1736 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "pointIndices", i, v->pointIndices[i]);
1737 USED(o);
1648}1738}
1649 1739
1650int1740int
@@ -1667,12 +1757,13 @@ err: · 16 unmodified lines
1667}1757}
1668 1758
1669void1759void
1670print_LigCaretList(Biobuf *f, int indent, LigCaretList *v)1760print_LigCaretList(Biobuf *f, int indent, Otf *o, LigCaretList *v)
1671{1761{
1672 Bprint(f, "%*s%s: %ud\n", indent, "", "coverageOffset", v->coverageOffset);1762 Bprint(f, "%*s%s: %ud\n", indent, "", "coverageOffset", v->coverageOffset);
1673 Bprint(f, "%*s%s: %ud\n", indent, "", "ligGlyphCount", v->ligGlyphCount);1763 Bprint(f, "%*s%s: %ud\n", indent, "", "ligGlyphCount", v->ligGlyphCount);
1674 for(int i = 0; i < v->ligGlyphCount; i++)1764 for(int i = 0; i < v->ligGlyphCount; i++)
1675 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "ligGlyphOffsets", i, v->ligGlyphOffsets[i]);1765 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "ligGlyphOffsets", i, v->ligGlyphOffsets[i]);
1766 USED(o);
1676}1767}
1677 1768
1678int1769int
@@ -1694,11 +1785,12 @@ err: · 15 unmodified lines
1694}1785}
1695 1786
1696void1787void
1697print_LigGlyph(Biobuf *f, int indent, LigGlyph *v)1788print_LigGlyph(Biobuf *f, int indent, Otf *o, LigGlyph *v)
1698{1789{
1699 Bprint(f, "%*s%s: %ud\n", indent, "", "caretCount", v->caretCount);1790 Bprint(f, "%*s%s: %ud\n", indent, "", "caretCount", v->caretCount);
1700 for(int i = 0; i < v->caretCount; i++)1791 for(int i = 0; i < v->caretCount; i++)
1701 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "caretValueOffsets", i, v->caretValueOffsets[i]);1792 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "caretValueOffsets", i, v->caretValueOffsets[i]);
1793 USED(o);
1702}1794}
1703 1795
1704int1796int
@@ -1734,7 +1826,7 @@ err: · 29 unmodified lines
1734}1826}
1735 1827
1736void1828void
1737print_CaretValue(Biobuf *f, int indent, CaretValue *v)1829print_CaretValue(Biobuf *f, int indent, Otf *o, CaretValue *v)
1738{1830{
1739 Bprint(f, "%*s%s: %ud\n", indent, "", "format", v->format);1831 Bprint(f, "%*s%s: %ud\n", indent, "", "format", v->format);
1740 if(v->format == 1 || v->format == 3)1832 if(v->format == 1 || v->format == 3)
@@ -1743,6 +1835,7 @@ print_CaretValue(Biobuf *f, int indent, CaretValue *v) · 2 unmodified lines
1743 Bprint(f, "%*s%s: %ud\n", indent, "", "caretValuePointIndex", v->caretValuePointIndex);1835 Bprint(f, "%*s%s: %ud\n", indent, "", "caretValuePointIndex", v->caretValuePointIndex);
1744 if(v->format == 3)1836 if(v->format == 3)
1745 Bprint(f, "%*s%s: %ud\n", indent, "", "deviceOffset", v->deviceOffset);1837 Bprint(f, "%*s%s: %ud\n", indent, "", "deviceOffset", v->deviceOffset);
1838 USED(o);
1746}1839}
1747 1840
1748int1841int
@@ -1766,7 +1859,7 @@ err: · 17 unmodified lines
1766}1859}
1767 1860
1768void1861void
1769print_ValueRecord(Biobuf *f, int indent, ValueRecord *v)1862print_ValueRecord(Biobuf *f, int indent, Otf *o, ValueRecord *v)
1770{1863{
1771 Bprint(f, "%*s%s: %d\n", indent, "", "xPlacement", v->xPlacement);1864 Bprint(f, "%*s%s: %d\n", indent, "", "xPlacement", v->xPlacement);
1772 Bprint(f, "%*s%s: %d\n", indent, "", "yPlacement", v->yPlacement);1865 Bprint(f, "%*s%s: %d\n", indent, "", "yPlacement", v->yPlacement);
@@ -1776,6 +1869,7 @@ print_ValueRecord(Biobuf *f, int indent, ValueRecord *v) · 3 unmodified lines
1776 Bprint(f, "%*s%s: %ud\n", indent, "", "yPlaDeviceOffset", v->yPlaDeviceOffset);1869 Bprint(f, "%*s%s: %ud\n", indent, "", "yPlaDeviceOffset", v->yPlaDeviceOffset);
1777 Bprint(f, "%*s%s: %ud\n", indent, "", "xAdvDeviceOffset", v->xAdvDeviceOffset);1870 Bprint(f, "%*s%s: %ud\n", indent, "", "xAdvDeviceOffset", v->xAdvDeviceOffset);
1778 Bprint(f, "%*s%s: %ud\n", indent, "", "yAdvDeviceOffset", v->yAdvDeviceOffset);1871 Bprint(f, "%*s%s: %ud\n", indent, "", "yAdvDeviceOffset", v->yAdvDeviceOffset);
1872 USED(o);
1779}1873}
1780 1874
1781int1875int
@@ -1815,23 +1909,24 @@ err: · 33 unmodified lines
1815}1909}
1816 1910
1817void1911void
1818print_SinglePos(Biobuf *f, int indent, SinglePos *v)1912print_SinglePos(Biobuf *f, int indent, Otf *o, SinglePos *v)
1819{1913{
1820 Bprint(f, "%*s%s: %ud\n", indent, "", "format", v->format);1914 Bprint(f, "%*s%s: %ud\n", indent, "", "format", v->format);
1821 Bprint(f, "%*s%s: %ud\n", indent, "", "coverageOffset", v->coverageOffset);1915 Bprint(f, "%*s%s: %ud\n", indent, "", "coverageOffset", v->coverageOffset);
1822 Bprint(f, "%*s%s: %ud\n", indent, "", "valueFormat", v->valueFormat);1916 Bprint(f, "%*s%s: %ud\n", indent, "", "valueFormat", v->valueFormat);
1823 if(v->format == 1){1917 if(v->format == 1){
1824 Bprint(f, "%*s%s:\n", indent, "", "valueRecord");1918 Bprint(f, "%*s%s:\n", indent, "", "valueRecord");
1825 print_ValueRecord(f, indent+indentΔ, &v->valueRecord);1919 print_ValueRecord(f, indent+indentΔ, o, &v->valueRecord);
1826 }1920 }
1827 if(v->format == 2)1921 if(v->format == 2)
1828 Bprint(f, "%*s%s: %ud\n", indent, "", "valueCount", v->valueCount);1922 Bprint(f, "%*s%s: %ud\n", indent, "", "valueCount", v->valueCount);
1829 if(v->format == 2){1923 if(v->format == 2){
1830 for(int i = 0; i < v->valueCount; i++){1924 for(int i = 0; i < v->valueCount; i++){
1831 Bprint(f, "%*s%s[%d]:\n", indent, "", "valueRecords", i);1925 Bprint(f, "%*s%s[%d]:\n", indent, "", "valueRecords", i);
1832 print_ValueRecord(f, indent+indentΔ, &v->valueRecords[i]);1926 print_ValueRecord(f, indent+indentΔ, o, &v->valueRecords[i]);
1833 }1927 }
1834 }1928 }
1929 USED(o);
1835}1930}
1836 1931
1837int1932int
@@ -1871,7 +1966,7 @@ err: · 33 unmodified lines
1871}1966}
1872 1967
1873void1968void
1874print_TableGDEF(Biobuf *f, int indent, TableGDEF *v)1969print_TableGDEF(Biobuf *f, int indent, Otf *o, TableGDEF *v)
1875{1970{
1876 Bprint(f, "%*s%s: %ud\n", indent, "", "minorVersion", v->minorVersion);1971 Bprint(f, "%*s%s: %ud\n", indent, "", "minorVersion", v->minorVersion);
1877 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphClassDefOffset", v->glyphClassDefOffset);1972 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphClassDefOffset", v->glyphClassDefOffset);
@@ -1882,6 +1977,7 @@ print_TableGDEF(Biobuf *f, int indent, TableGDEF *v) · 4 unmodified lines
1882 Bprint(f, "%*s%s: %ud\n", indent, "", "markGlyphSetsDefOffset", v->markGlyphSetsDefOffset);1977 Bprint(f, "%*s%s: %ud\n", indent, "", "markGlyphSetsDefOffset", v->markGlyphSetsDefOffset);
1883 if(v->minorVersion >= 3)1978 if(v->minorVersion >= 3)
1884 Bprint(f, "%*s%s: %ud\n", indent, "", "itemVarStoreOffset", v->itemVarStoreOffset);1979 Bprint(f, "%*s%s: %ud\n", indent, "", "itemVarStoreOffset", v->itemVarStoreOffset);
1980 USED(o);
1885}1981}
1886 1982
1887int1983int
@@ -1904,12 +2000,13 @@ err: · 16 unmodified lines
1904}2000}
1905 2001
1906void2002void
1907print_LangSys(Biobuf *f, int indent, LangSys *v)2003print_LangSys(Biobuf *f, int indent, Otf *o, LangSys *v)
1908{2004{
1909 Bprint(f, "%*s%s: %ud\n", indent, "", "requiredFeatureIndex", v->requiredFeatureIndex);2005 Bprint(f, "%*s%s: %ud\n", indent, "", "requiredFeatureIndex", v->requiredFeatureIndex);
1910 Bprint(f, "%*s%s: %ud\n", indent, "", "featureIndexCount", v->featureIndexCount);2006 Bprint(f, "%*s%s: %ud\n", indent, "", "featureIndexCount", v->featureIndexCount);
1911 for(int i = 0; i < v->featureIndexCount; i++)2007 for(int i = 0; i < v->featureIndexCount; i++)
1912 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "featureIndices", i, v->featureIndices[i]);2008 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "featureIndices", i, v->featureIndices[i]);
2009 USED(o);
1913}2010}
1914 2011
1915int2012int
@@ -1938,13 +2035,14 @@ err: · 22 unmodified lines
1938}2035}
1939 2036
1940void2037void
1941print_LangSysRecord(Biobuf *f, int indent, LangSysRecord *v)2038print_LangSysRecord(Biobuf *f, int indent, Otf *o, LangSysRecord *v)
1942{2039{
1943 Bprint(f, "%*s%s: %t\n", indent, "", "langSysTag", v->langSysTag);2040 Bprint(f, "%*s%s: %t\n", indent, "", "langSysTag", v->langSysTag);
1944 Bprint(f, "%*s%s: %ud\n", indent, "", "langSysOffset", v->langSysOffset);2041 Bprint(f, "%*s%s: %ud\n", indent, "", "langSysOffset", v->langSysOffset);
1945 Bprint(f, "%*s%s:\n", indent, "", "langSys");2042 Bprint(f, "%*s%s:\n", indent, "", "langSys");
1946 if(v->langSys != nil)2043 if(v->langSys != nil)
1947 print_LangSys(f, indent+indentΔ, v->langSys);2044 print_LangSys(f, indent+indentΔ, o, v->langSys);
2045 USED(o);
1948}2046}
1949 2047
1950int2048int
@@ -1977,17 +2075,18 @@ err: · 26 unmodified lines
1977}2075}
1978 2076
1979void2077void
1980print_Script(Biobuf *f, int indent, Script *v)2078print_Script(Biobuf *f, int indent, Otf *o, Script *v)
1981{2079{
1982 Bprint(f, "%*s%s: %ud\n", indent, "", "defaultLangSysOffset", v->defaultLangSysOffset);2080 Bprint(f, "%*s%s: %ud\n", indent, "", "defaultLangSysOffset", v->defaultLangSysOffset);
1983 Bprint(f, "%*s%s: %ud\n", indent, "", "langSysCount", v->langSysCount);2081 Bprint(f, "%*s%s: %ud\n", indent, "", "langSysCount", v->langSysCount);
1984 for(int i = 0; i < v->langSysCount; i++){2082 for(int i = 0; i < v->langSysCount; i++){
1985 Bprint(f, "%*s%s[%d]:\n", indent, "", "langSysRecords", i);2083 Bprint(f, "%*s%s[%d]:\n", indent, "", "langSysRecords", i);
1986 print_LangSysRecord(f, indent+indentΔ, &v->langSysRecords[i]);2084 print_LangSysRecord(f, indent+indentΔ, o, &v->langSysRecords[i]);
1987 }2085 }
1988 Bprint(f, "%*s%s:\n", indent, "", "defaultLangSys");2086 Bprint(f, "%*s%s:\n", indent, "", "defaultLangSys");
1989 if(v->defaultLangSys != nil)2087 if(v->defaultLangSys != nil)
1990 print_LangSys(f, indent+indentΔ, v->defaultLangSys);2088 print_LangSys(f, indent+indentΔ, o, v->defaultLangSys);
2089 USED(o);
1991}2090}
1992 2091
1993int2092int
@@ -2016,13 +2115,14 @@ err: · 22 unmodified lines
2016}2115}
2017 2116
2018void2117void
2019print_ScriptRecord(Biobuf *f, int indent, ScriptRecord *v)2118print_ScriptRecord(Biobuf *f, int indent, Otf *o, ScriptRecord *v)
2020{2119{
2021 Bprint(f, "%*s%s: %t\n", indent, "", "scriptTag", v->scriptTag);2120 Bprint(f, "%*s%s: %t\n", indent, "", "scriptTag", v->scriptTag);
2022 Bprint(f, "%*s%s: %ud\n", indent, "", "scriptOffset", v->scriptOffset);2121 Bprint(f, "%*s%s: %ud\n", indent, "", "scriptOffset", v->scriptOffset);
2023 Bprint(f, "%*s%s:\n", indent, "", "script");2122 Bprint(f, "%*s%s:\n", indent, "", "script");
2024 if(v->script != nil)2123 if(v->script != nil)
2025 print_Script(f, indent+indentΔ, v->script);2124 print_Script(f, indent+indentΔ, o, v->script);
2125 USED(o);
2026}2126}
2027 2127
2028int2128int
@@ -2043,13 +2143,14 @@ err: · 14 unmodified lines
2043}2143}
2044 2144
2045void2145void
2046print_ScriptList(Biobuf *f, int indent, ScriptList *v)2146print_ScriptList(Biobuf *f, int indent, Otf *o, ScriptList *v)
2047{2147{
2048 Bprint(f, "%*s%s: %ud\n", indent, "", "scriptCount", v->scriptCount);2148 Bprint(f, "%*s%s: %ud\n", indent, "", "scriptCount", v->scriptCount);
2049 for(int i = 0; i < v->scriptCount; i++){2149 for(int i = 0; i < v->scriptCount; i++){
2050 Bprint(f, "%*s%s[%d]:\n", indent, "", "scriptRecords", i);2150 Bprint(f, "%*s%s[%d]:\n", indent, "", "scriptRecords", i);
2051 print_ScriptRecord(f, indent+indentΔ, &v->scriptRecords[i]);2151 print_ScriptRecord(f, indent+indentΔ, o, &v->scriptRecords[i]);
2052 }2152 }
2153 USED(o);
2053}2154}
2054 2155
2055int2156int
@@ -2072,12 +2173,13 @@ err: · 16 unmodified lines
2072}2173}
2073 2174
2074void2175void
2075print_Feature(Biobuf *f, int indent, Feature *v)2176print_Feature(Biobuf *f, int indent, Otf *o, Feature *v)
2076{2177{
2077 Bprint(f, "%*s%s: %ud\n", indent, "", "featureParamsOffset", v->featureParamsOffset);2178 Bprint(f, "%*s%s: %ud\n", indent, "", "featureParamsOffset", v->featureParamsOffset);
2078 Bprint(f, "%*s%s: %ud\n", indent, "", "lookupIndexCount", v->lookupIndexCount);2179 Bprint(f, "%*s%s: %ud\n", indent, "", "lookupIndexCount", v->lookupIndexCount);
2079 for(int i = 0; i < v->lookupIndexCount; i++)2180 for(int i = 0; i < v->lookupIndexCount; i++)
2080 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "lookupListIndices", i, v->lookupListIndices[i]);2181 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "lookupListIndices", i, v->lookupListIndices[i]);
2182 USED(o);
2081}2183}
2082 2184
2083int2185int
@@ -2106,13 +2208,14 @@ err: · 22 unmodified lines
2106}2208}
2107 2209
2108void2210void
2109print_FeatureRecord(Biobuf *f, int indent, FeatureRecord *v)2211print_FeatureRecord(Biobuf *f, int indent, Otf *o, FeatureRecord *v)
2110{2212{
2111 Bprint(f, "%*s%s: %t\n", indent, "", "featureTag", v->featureTag);2213 Bprint(f, "%*s%s: %t\n", indent, "", "featureTag", v->featureTag);
2112 Bprint(f, "%*s%s: %ud\n", indent, "", "featureOffset", v->featureOffset);2214 Bprint(f, "%*s%s: %ud\n", indent, "", "featureOffset", v->featureOffset);
2113 Bprint(f, "%*s%s:\n", indent, "", "feature");2215 Bprint(f, "%*s%s:\n", indent, "", "feature");
2114 if(v->feature != nil)2216 if(v->feature != nil)
2115 print_Feature(f, indent+indentΔ, v->feature);2217 print_Feature(f, indent+indentΔ, o, v->feature);
2218 USED(o);
2116}2219}
2117 2220
2118int2221int
@@ -2133,13 +2236,14 @@ err: · 14 unmodified lines
2133}2236}
2134 2237
2135void2238void
2136print_FeatureList(Biobuf *f, int indent, FeatureList *v)2239print_FeatureList(Biobuf *f, int indent, Otf *o, FeatureList *v)
2137{2240{
2138 Bprint(f, "%*s%s: %ud\n", indent, "", "featureCount", v->featureCount);2241 Bprint(f, "%*s%s: %ud\n", indent, "", "featureCount", v->featureCount);
2139 for(int i = 0; i < v->featureCount; i++){2242 for(int i = 0; i < v->featureCount; i++){
2140 Bprint(f, "%*s%s[%d]:\n", indent, "", "featureRecords", i);2243 Bprint(f, "%*s%s[%d]:\n", indent, "", "featureRecords", i);
2141 print_FeatureRecord(f, indent+indentΔ, &v->featureRecords[i]);2244 print_FeatureRecord(f, indent+indentΔ, o, &v->featureRecords[i]);
2142 }2245 }
2246 USED(o);
2143}2247}
2144 2248
2145int2249int
@@ -2166,7 +2270,7 @@ err: · 20 unmodified lines
2166}2270}
2167 2271
2168void2272void
2169print_Lookup(Biobuf *f, int indent, Lookup *v)2273print_Lookup(Biobuf *f, int indent, Otf *o, Lookup *v)
2170{2274{
2171 Bprint(f, "%*s%s: %ud\n", indent, "", "lookupType", v->lookupType);2275 Bprint(f, "%*s%s: %ud\n", indent, "", "lookupType", v->lookupType);
2172 Bprint(f, "%*s%s: %ud\n", indent, "", "lookupFlag", v->lookupFlag);2276 Bprint(f, "%*s%s: %ud\n", indent, "", "lookupFlag", v->lookupFlag);
@@ -2174,6 +2278,7 @@ print_Lookup(Biobuf *f, int indent, Lookup *v) · 1 unmodified line
2174 for(int i = 0; i < v->subTableCount; i++)2278 for(int i = 0; i < v->subTableCount; i++)
2175 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "subtableOffsets", i, v->subtableOffsets[i]);2279 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "subtableOffsets", i, v->subtableOffsets[i]);
2176 Bprint(f, "%*s%s: %ud\n", indent, "", "markFilteringSet", v->markFilteringSet);2280 Bprint(f, "%*s%s: %ud\n", indent, "", "markFilteringSet", v->markFilteringSet);
2281 USED(o);
2177}2282}
2178 2283
2179int2284int
@@ -2195,11 +2300,12 @@ err: · 15 unmodified lines
2195}2300}
2196 2301
2197void2302void
2198print_LookupList(Biobuf *f, int indent, LookupList *v)2303print_LookupList(Biobuf *f, int indent, Otf *o, LookupList *v)
2199{2304{
2200 Bprint(f, "%*s%s: %ud\n", indent, "", "lookupCount", v->lookupCount);2305 Bprint(f, "%*s%s: %ud\n", indent, "", "lookupCount", v->lookupCount);
2201 for(int i = 0; i < v->lookupCount; i++)2306 for(int i = 0; i < v->lookupCount; i++)
2202 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "lookupOffsets", i, v->lookupOffsets[i]);2307 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "lookupOffsets", i, v->lookupOffsets[i]);
2308 USED(o);
2203}2309}
2204 2310
2205int2311int
@@ -2266,7 +2372,7 @@ err: · 60 unmodified lines
2266}2372}
2267 2373
2268void2374void
2269print_TableGPOS(Biobuf *f, int indent, TableGPOS *v)2375print_TableGPOS(Biobuf *f, int indent, Otf *o, TableGPOS *v)
2270{2376{
2271 Bprint(f, "%*s%s: %ud\n", indent, "", "minorVersion", v->minorVersion);2377 Bprint(f, "%*s%s: %ud\n", indent, "", "minorVersion", v->minorVersion);
2272 Bprint(f, "%*s%s: %ud\n", indent, "", "scriptListOffset", v->scriptListOffset);2378 Bprint(f, "%*s%s: %ud\n", indent, "", "scriptListOffset", v->scriptListOffset);
@@ -2276,13 +2382,14 @@ print_TableGPOS(Biobuf *f, int indent, TableGPOS *v) · 3 unmodified lines
2276 Bprint(f, "%*s%s: %ud\n", indent, "", "featureVariationsOffset", v->featureVariationsOffset);2382 Bprint(f, "%*s%s: %ud\n", indent, "", "featureVariationsOffset", v->featureVariationsOffset);
2277 Bprint(f, "%*s%s:\n", indent, "", "scriptList");2383 Bprint(f, "%*s%s:\n", indent, "", "scriptList");
2278 if(v->scriptList != nil)2384 if(v->scriptList != nil)
2279 print_ScriptList(f, indent+indentΔ, v->scriptList);2385 print_ScriptList(f, indent+indentΔ, o, v->scriptList);
2280 Bprint(f, "%*s%s:\n", indent, "", "featureList");2386 Bprint(f, "%*s%s:\n", indent, "", "featureList");
2281 if(v->featureList != nil)2387 if(v->featureList != nil)
2282 print_FeatureList(f, indent+indentΔ, v->featureList);2388 print_FeatureList(f, indent+indentΔ, o, v->featureList);
2283 Bprint(f, "%*s%s:\n", indent, "", "lookupList");2389 Bprint(f, "%*s%s:\n", indent, "", "lookupList");
2284 if(v->lookupList != nil)2390 if(v->lookupList != nil)
2285 print_LookupList(f, indent+indentΔ, v->lookupList);2391 print_LookupList(f, indent+indentΔ, o, v->lookupList);
2392 USED(o);
2286}2393}
2287 2394
2288int2395int
@@ -2338,7 +2445,7 @@ err: · 49 unmodified lines
2338}2445}
2339 2446
2340void2447void
2341print_TableGSUB(Biobuf *f, int indent, TableGSUB *v)2448print_TableGSUB(Biobuf *f, int indent, Otf *o, TableGSUB *v)
2342{2449{
2343 Bprint(f, "%*s%s: %ud\n", indent, "", "minorVersion", v->minorVersion);2450 Bprint(f, "%*s%s: %ud\n", indent, "", "minorVersion", v->minorVersion);
2344 Bprint(f, "%*s%s: %ud\n", indent, "", "scriptListOffset", v->scriptListOffset);2451 Bprint(f, "%*s%s: %ud\n", indent, "", "scriptListOffset", v->scriptListOffset);
@@ -2348,10 +2455,11 @@ print_TableGSUB(Biobuf *f, int indent, TableGSUB *v) · 3 unmodified lines
2348 Bprint(f, "%*s%s: %ud\n", indent, "", "featureVariationsOffset", v->featureVariationsOffset);2455 Bprint(f, "%*s%s: %ud\n", indent, "", "featureVariationsOffset", v->featureVariationsOffset);
2349 Bprint(f, "%*s%s:\n", indent, "", "scriptList");2456 Bprint(f, "%*s%s:\n", indent, "", "scriptList");
2350 if(v->scriptList != nil)2457 if(v->scriptList != nil)
2351 print_ScriptList(f, indent+indentΔ, v->scriptList);2458 print_ScriptList(f, indent+indentΔ, o, v->scriptList);
2352 Bprint(f, "%*s%s:\n", indent, "", "featureList");2459 Bprint(f, "%*s%s:\n", indent, "", "featureList");
2353 if(v->featureList != nil)2460 if(v->featureList != nil)
2354 print_FeatureList(f, indent+indentΔ, v->featureList);2461 print_FeatureList(f, indent+indentΔ, o, v->featureList);
2462 USED(o);
2355}2463}
2356 2464
2357int2465int
@@ -2369,10 +2477,11 @@ err: · 11 unmodified lines
2369}2477}
2370 2478
2371void2479void
2372print_MathValueRecord(Biobuf *f, int indent, MathValueRecord *v)2480print_MathValueRecord(Biobuf *f, int indent, Otf *o, MathValueRecord *v)
2373{2481{
2374 Bprint(f, "%*s%s: %d\n", indent, "", "value", v->value);2482 Bprint(f, "%*s%s: %d\n", indent, "", "value", v->value);
2375 Bprint(f, "%*s%s: %ud\n", indent, "", "deviceOffset", v->deviceOffset);2483 Bprint(f, "%*s%s: %ud\n", indent, "", "deviceOffset", v->deviceOffset);
2484 USED(o);
2376}2485}
2377 2486
2378int2487int
@@ -2599,115 +2708,116 @@ err: · 220 unmodified lines
2599}2708}
2600 2709
2601void2710void
2602print_MathConstants(Biobuf *f, int indent, MathConstants *v)2711print_MathConstants(Biobuf *f, int indent, Otf *o, MathConstants *v)
2603{2712{
2604 Bprint(f, "%*s%s: %d\n", indent, "", "scriptPercentScaleDown", v->scriptPercentScaleDown);2713 Bprint(f, "%*s%s: %d\n", indent, "", "scriptPercentScaleDown", v->scriptPercentScaleDown);
2605 Bprint(f, "%*s%s: %d\n", indent, "", "scriptScriptPercentScaleDown", v->scriptScriptPercentScaleDown);2714 Bprint(f, "%*s%s: %d\n", indent, "", "scriptScriptPercentScaleDown", v->scriptScriptPercentScaleDown);
2606 Bprint(f, "%*s%s: %ud\n", indent, "", "delimitedSubFormulaMinHeight", v->delimitedSubFormulaMinHeight);2715 Bprint(f, "%*s%s: %ud\n", indent, "", "delimitedSubFormulaMinHeight", v->delimitedSubFormulaMinHeight);
2607 Bprint(f, "%*s%s: %ud\n", indent, "", "displayOperatorMinHeight", v->displayOperatorMinHeight);2716 Bprint(f, "%*s%s: %ud\n", indent, "", "displayOperatorMinHeight", v->displayOperatorMinHeight);
2608 Bprint(f, "%*s%s:\n", indent, "", "mathLeading");2717 Bprint(f, "%*s%s:\n", indent, "", "mathLeading");
2609 print_MathValueRecord(f, indent+indentΔ, &v->mathLeading);2718 print_MathValueRecord(f, indent+indentΔ, o, &v->mathLeading);
2610 Bprint(f, "%*s%s:\n", indent, "", "axisHeight");2719 Bprint(f, "%*s%s:\n", indent, "", "axisHeight");
2611 print_MathValueRecord(f, indent+indentΔ, &v->axisHeight);2720 print_MathValueRecord(f, indent+indentΔ, o, &v->axisHeight);
2612 Bprint(f, "%*s%s:\n", indent, "", "accentBaseHeight");2721 Bprint(f, "%*s%s:\n", indent, "", "accentBaseHeight");
2613 print_MathValueRecord(f, indent+indentΔ, &v->accentBaseHeight);2722 print_MathValueRecord(f, indent+indentΔ, o, &v->accentBaseHeight);
2614 Bprint(f, "%*s%s:\n", indent, "", "flattenedAccentBaseHeight");2723 Bprint(f, "%*s%s:\n", indent, "", "flattenedAccentBaseHeight");
2615 print_MathValueRecord(f, indent+indentΔ, &v->flattenedAccentBaseHeight);2724 print_MathValueRecord(f, indent+indentΔ, o, &v->flattenedAccentBaseHeight);
2616 Bprint(f, "%*s%s:\n", indent, "", "subscriptShiftDown");2725 Bprint(f, "%*s%s:\n", indent, "", "subscriptShiftDown");
2617 print_MathValueRecord(f, indent+indentΔ, &v->subscriptShiftDown);2726 print_MathValueRecord(f, indent+indentΔ, o, &v->subscriptShiftDown);
2618 Bprint(f, "%*s%s:\n", indent, "", "subscriptTopMax");2727 Bprint(f, "%*s%s:\n", indent, "", "subscriptTopMax");
2619 print_MathValueRecord(f, indent+indentΔ, &v->subscriptTopMax);2728 print_MathValueRecord(f, indent+indentΔ, o, &v->subscriptTopMax);
2620 Bprint(f, "%*s%s:\n", indent, "", "subscriptBaselineDropMin");2729 Bprint(f, "%*s%s:\n", indent, "", "subscriptBaselineDropMin");
2621 print_MathValueRecord(f, indent+indentΔ, &v->subscriptBaselineDropMin);2730 print_MathValueRecord(f, indent+indentΔ, o, &v->subscriptBaselineDropMin);
2622 Bprint(f, "%*s%s:\n", indent, "", "superscriptShiftUp");2731 Bprint(f, "%*s%s:\n", indent, "", "superscriptShiftUp");
2623 print_MathValueRecord(f, indent+indentΔ, &v->superscriptShiftUp);2732 print_MathValueRecord(f, indent+indentΔ, o, &v->superscriptShiftUp);
2624 Bprint(f, "%*s%s:\n", indent, "", "superscriptShiftUpCramped");2733 Bprint(f, "%*s%s:\n", indent, "", "superscriptShiftUpCramped");
2625 print_MathValueRecord(f, indent+indentΔ, &v->superscriptShiftUpCramped);2734 print_MathValueRecord(f, indent+indentΔ, o, &v->superscriptShiftUpCramped);
2626 Bprint(f, "%*s%s:\n", indent, "", "superscriptBottomMin");2735 Bprint(f, "%*s%s:\n", indent, "", "superscriptBottomMin");
2627 print_MathValueRecord(f, indent+indentΔ, &v->superscriptBottomMin);2736 print_MathValueRecord(f, indent+indentΔ, o, &v->superscriptBottomMin);
2628 Bprint(f, "%*s%s:\n", indent, "", "superscriptBaselineDropMax");2737 Bprint(f, "%*s%s:\n", indent, "", "superscriptBaselineDropMax");
2629 print_MathValueRecord(f, indent+indentΔ, &v->superscriptBaselineDropMax);2738 print_MathValueRecord(f, indent+indentΔ, o, &v->superscriptBaselineDropMax);
2630 Bprint(f, "%*s%s:\n", indent, "", "subSuperscriptGapMin");2739 Bprint(f, "%*s%s:\n", indent, "", "subSuperscriptGapMin");
2631 print_MathValueRecord(f, indent+indentΔ, &v->subSuperscriptGapMin);2740 print_MathValueRecord(f, indent+indentΔ, o, &v->subSuperscriptGapMin);
2632 Bprint(f, "%*s%s:\n", indent, "", "superscriptBottomMaxWithSubscript");2741 Bprint(f, "%*s%s:\n", indent, "", "superscriptBottomMaxWithSubscript");
2633 print_MathValueRecord(f, indent+indentΔ, &v->superscriptBottomMaxWithSubscript);2742 print_MathValueRecord(f, indent+indentΔ, o, &v->superscriptBottomMaxWithSubscript);
2634 Bprint(f, "%*s%s:\n", indent, "", "spaceAfterScript");2743 Bprint(f, "%*s%s:\n", indent, "", "spaceAfterScript");
2635 print_MathValueRecord(f, indent+indentΔ, &v->spaceAfterScript);2744 print_MathValueRecord(f, indent+indentΔ, o, &v->spaceAfterScript);
2636 Bprint(f, "%*s%s:\n", indent, "", "upperLimitGapMin");2745 Bprint(f, "%*s%s:\n", indent, "", "upperLimitGapMin");
2637 print_MathValueRecord(f, indent+indentΔ, &v->upperLimitGapMin);2746 print_MathValueRecord(f, indent+indentΔ, o, &v->upperLimitGapMin);
2638 Bprint(f, "%*s%s:\n", indent, "", "upperLimitBaselineRiseMin");2747 Bprint(f, "%*s%s:\n", indent, "", "upperLimitBaselineRiseMin");
2639 print_MathValueRecord(f, indent+indentΔ, &v->upperLimitBaselineRiseMin);2748 print_MathValueRecord(f, indent+indentΔ, o, &v->upperLimitBaselineRiseMin);
2640 Bprint(f, "%*s%s:\n", indent, "", "lowerLimitGapMin");2749 Bprint(f, "%*s%s:\n", indent, "", "lowerLimitGapMin");
2641 print_MathValueRecord(f, indent+indentΔ, &v->lowerLimitGapMin);2750 print_MathValueRecord(f, indent+indentΔ, o, &v->lowerLimitGapMin);
2642 Bprint(f, "%*s%s:\n", indent, "", "lowerLimitBaselineDropMin");2751 Bprint(f, "%*s%s:\n", indent, "", "lowerLimitBaselineDropMin");
2643 print_MathValueRecord(f, indent+indentΔ, &v->lowerLimitBaselineDropMin);2752 print_MathValueRecord(f, indent+indentΔ, o, &v->lowerLimitBaselineDropMin);
2644 Bprint(f, "%*s%s:\n", indent, "", "stackTopShiftUp");2753 Bprint(f, "%*s%s:\n", indent, "", "stackTopShiftUp");
2645 print_MathValueRecord(f, indent+indentΔ, &v->stackTopShiftUp);2754 print_MathValueRecord(f, indent+indentΔ, o, &v->stackTopShiftUp);
2646 Bprint(f, "%*s%s:\n", indent, "", "stackTopDisplayStyleShiftUp");2755 Bprint(f, "%*s%s:\n", indent, "", "stackTopDisplayStyleShiftUp");
2647 print_MathValueRecord(f, indent+indentΔ, &v->stackTopDisplayStyleShiftUp);2756 print_MathValueRecord(f, indent+indentΔ, o, &v->stackTopDisplayStyleShiftUp);
2648 Bprint(f, "%*s%s:\n", indent, "", "stackBottomShiftDown");2757 Bprint(f, "%*s%s:\n", indent, "", "stackBottomShiftDown");
2649 print_MathValueRecord(f, indent+indentΔ, &v->stackBottomShiftDown);2758 print_MathValueRecord(f, indent+indentΔ, o, &v->stackBottomShiftDown);
2650 Bprint(f, "%*s%s:\n", indent, "", "stackBottomDisplayStyleShiftDown");2759 Bprint(f, "%*s%s:\n", indent, "", "stackBottomDisplayStyleShiftDown");
2651 print_MathValueRecord(f, indent+indentΔ, &v->stackBottomDisplayStyleShiftDown);2760 print_MathValueRecord(f, indent+indentΔ, o, &v->stackBottomDisplayStyleShiftDown);
2652 Bprint(f, "%*s%s:\n", indent, "", "stackGapMin");2761 Bprint(f, "%*s%s:\n", indent, "", "stackGapMin");
2653 print_MathValueRecord(f, indent+indentΔ, &v->stackGapMin);2762 print_MathValueRecord(f, indent+indentΔ, o, &v->stackGapMin);
2654 Bprint(f, "%*s%s:\n", indent, "", "stackDisplayStyleGapMin");2763 Bprint(f, "%*s%s:\n", indent, "", "stackDisplayStyleGapMin");
2655 print_MathValueRecord(f, indent+indentΔ, &v->stackDisplayStyleGapMin);2764 print_MathValueRecord(f, indent+indentΔ, o, &v->stackDisplayStyleGapMin);
2656 Bprint(f, "%*s%s:\n", indent, "", "stretchStackTopShiftUp");2765 Bprint(f, "%*s%s:\n", indent, "", "stretchStackTopShiftUp");
2657 print_MathValueRecord(f, indent+indentΔ, &v->stretchStackTopShiftUp);2766 print_MathValueRecord(f, indent+indentΔ, o, &v->stretchStackTopShiftUp);
2658 Bprint(f, "%*s%s:\n", indent, "", "stretchStackBottomShiftDown");2767 Bprint(f, "%*s%s:\n", indent, "", "stretchStackBottomShiftDown");
2659 print_MathValueRecord(f, indent+indentΔ, &v->stretchStackBottomShiftDown);2768 print_MathValueRecord(f, indent+indentΔ, o, &v->stretchStackBottomShiftDown);
2660 Bprint(f, "%*s%s:\n", indent, "", "stretchStackGapAboveMin");2769 Bprint(f, "%*s%s:\n", indent, "", "stretchStackGapAboveMin");
2661 print_MathValueRecord(f, indent+indentΔ, &v->stretchStackGapAboveMin);2770 print_MathValueRecord(f, indent+indentΔ, o, &v->stretchStackGapAboveMin);
2662 Bprint(f, "%*s%s:\n", indent, "", "stretchStackGapBelowMin");2771 Bprint(f, "%*s%s:\n", indent, "", "stretchStackGapBelowMin");
2663 print_MathValueRecord(f, indent+indentΔ, &v->stretchStackGapBelowMin);2772 print_MathValueRecord(f, indent+indentΔ, o, &v->stretchStackGapBelowMin);
2664 Bprint(f, "%*s%s:\n", indent, "", "fractionNumeratorShiftUp");2773 Bprint(f, "%*s%s:\n", indent, "", "fractionNumeratorShiftUp");
2665 print_MathValueRecord(f, indent+indentΔ, &v->fractionNumeratorShiftUp);2774 print_MathValueRecord(f, indent+indentΔ, o, &v->fractionNumeratorShiftUp);
2666 Bprint(f, "%*s%s:\n", indent, "", "fractionNumeratorDisplayStyleShiftUp");2775 Bprint(f, "%*s%s:\n", indent, "", "fractionNumeratorDisplayStyleShiftUp");
2667 print_MathValueRecord(f, indent+indentΔ, &v->fractionNumeratorDisplayStyleShiftUp);2776 print_MathValueRecord(f, indent+indentΔ, o, &v->fractionNumeratorDisplayStyleShiftUp);
2668 Bprint(f, "%*s%s:\n", indent, "", "fractionDenominatorShiftDown");2777 Bprint(f, "%*s%s:\n", indent, "", "fractionDenominatorShiftDown");
2669 print_MathValueRecord(f, indent+indentΔ, &v->fractionDenominatorShiftDown);2778 print_MathValueRecord(f, indent+indentΔ, o, &v->fractionDenominatorShiftDown);
2670 Bprint(f, "%*s%s:\n", indent, "", "fractionDenominatorDisplayStyleShiftDown");2779 Bprint(f, "%*s%s:\n", indent, "", "fractionDenominatorDisplayStyleShiftDown");
2671 print_MathValueRecord(f, indent+indentΔ, &v->fractionDenominatorDisplayStyleShiftDown);2780 print_MathValueRecord(f, indent+indentΔ, o, &v->fractionDenominatorDisplayStyleShiftDown);
2672 Bprint(f, "%*s%s:\n", indent, "", "fractionNumeratorGapMin");2781 Bprint(f, "%*s%s:\n", indent, "", "fractionNumeratorGapMin");
2673 print_MathValueRecord(f, indent+indentΔ, &v->fractionNumeratorGapMin);2782 print_MathValueRecord(f, indent+indentΔ, o, &v->fractionNumeratorGapMin);
2674 Bprint(f, "%*s%s:\n", indent, "", "fractionNumDisplayStyleGapMin");2783 Bprint(f, "%*s%s:\n", indent, "", "fractionNumDisplayStyleGapMin");
2675 print_MathValueRecord(f, indent+indentΔ, &v->fractionNumDisplayStyleGapMin);2784 print_MathValueRecord(f, indent+indentΔ, o, &v->fractionNumDisplayStyleGapMin);
2676 Bprint(f, "%*s%s:\n", indent, "", "fractionRuleThickness");2785 Bprint(f, "%*s%s:\n", indent, "", "fractionRuleThickness");
2677 print_MathValueRecord(f, indent+indentΔ, &v->fractionRuleThickness);2786 print_MathValueRecord(f, indent+indentΔ, o, &v->fractionRuleThickness);
2678 Bprint(f, "%*s%s:\n", indent, "", "fractionDenominatorGapMin");2787 Bprint(f, "%*s%s:\n", indent, "", "fractionDenominatorGapMin");
2679 print_MathValueRecord(f, indent+indentΔ, &v->fractionDenominatorGapMin);2788 print_MathValueRecord(f, indent+indentΔ, o, &v->fractionDenominatorGapMin);
2680 Bprint(f, "%*s%s:\n", indent, "", "fractionDenomDisplayStyleGapMin");2789 Bprint(f, "%*s%s:\n", indent, "", "fractionDenomDisplayStyleGapMin");
2681 print_MathValueRecord(f, indent+indentΔ, &v->fractionDenomDisplayStyleGapMin);2790 print_MathValueRecord(f, indent+indentΔ, o, &v->fractionDenomDisplayStyleGapMin);
2682 Bprint(f, "%*s%s:\n", indent, "", "skewedFractionHorizontalGap");2791 Bprint(f, "%*s%s:\n", indent, "", "skewedFractionHorizontalGap");
2683 print_MathValueRecord(f, indent+indentΔ, &v->skewedFractionHorizontalGap);2792 print_MathValueRecord(f, indent+indentΔ, o, &v->skewedFractionHorizontalGap);
2684 Bprint(f, "%*s%s:\n", indent, "", "skewedFractionVerticalGap");2793 Bprint(f, "%*s%s:\n", indent, "", "skewedFractionVerticalGap");
2685 print_MathValueRecord(f, indent+indentΔ, &v->skewedFractionVerticalGap);2794 print_MathValueRecord(f, indent+indentΔ, o, &v->skewedFractionVerticalGap);
2686 Bprint(f, "%*s%s:\n", indent, "", "overbarVerticalGap");2795 Bprint(f, "%*s%s:\n", indent, "", "overbarVerticalGap");
2687 print_MathValueRecord(f, indent+indentΔ, &v->overbarVerticalGap);2796 print_MathValueRecord(f, indent+indentΔ, o, &v->overbarVerticalGap);
2688 Bprint(f, "%*s%s:\n", indent, "", "overbarRuleThickness");2797 Bprint(f, "%*s%s:\n", indent, "", "overbarRuleThickness");
2689 print_MathValueRecord(f, indent+indentΔ, &v->overbarRuleThickness);2798 print_MathValueRecord(f, indent+indentΔ, o, &v->overbarRuleThickness);
2690 Bprint(f, "%*s%s:\n", indent, "", "overbarExtraAscender");2799 Bprint(f, "%*s%s:\n", indent, "", "overbarExtraAscender");
2691 print_MathValueRecord(f, indent+indentΔ, &v->overbarExtraAscender);2800 print_MathValueRecord(f, indent+indentΔ, o, &v->overbarExtraAscender);
2692 Bprint(f, "%*s%s:\n", indent, "", "underbarVerticalGap");2801 Bprint(f, "%*s%s:\n", indent, "", "underbarVerticalGap");
2693 print_MathValueRecord(f, indent+indentΔ, &v->underbarVerticalGap);2802 print_MathValueRecord(f, indent+indentΔ, o, &v->underbarVerticalGap);
2694 Bprint(f, "%*s%s:\n", indent, "", "underbarRuleThickness");2803 Bprint(f, "%*s%s:\n", indent, "", "underbarRuleThickness");
2695 print_MathValueRecord(f, indent+indentΔ, &v->underbarRuleThickness);2804 print_MathValueRecord(f, indent+indentΔ, o, &v->underbarRuleThickness);
2696 Bprint(f, "%*s%s:\n", indent, "", "underbarExtraDescender");2805 Bprint(f, "%*s%s:\n", indent, "", "underbarExtraDescender");
2697 print_MathValueRecord(f, indent+indentΔ, &v->underbarExtraDescender);2806 print_MathValueRecord(f, indent+indentΔ, o, &v->underbarExtraDescender);
2698 Bprint(f, "%*s%s:\n", indent, "", "radicalVerticalGap");2807 Bprint(f, "%*s%s:\n", indent, "", "radicalVerticalGap");
2699 print_MathValueRecord(f, indent+indentΔ, &v->radicalVerticalGap);2808 print_MathValueRecord(f, indent+indentΔ, o, &v->radicalVerticalGap);
2700 Bprint(f, "%*s%s:\n", indent, "", "radicalDisplayStyleVerticalGap");2809 Bprint(f, "%*s%s:\n", indent, "", "radicalDisplayStyleVerticalGap");
2701 print_MathValueRecord(f, indent+indentΔ, &v->radicalDisplayStyleVerticalGap);2810 print_MathValueRecord(f, indent+indentΔ, o, &v->radicalDisplayStyleVerticalGap);
2702 Bprint(f, "%*s%s:\n", indent, "", "radicalRuleThickness");2811 Bprint(f, "%*s%s:\n", indent, "", "radicalRuleThickness");
2703 print_MathValueRecord(f, indent+indentΔ, &v->radicalRuleThickness);2812 print_MathValueRecord(f, indent+indentΔ, o, &v->radicalRuleThickness);
2704 Bprint(f, "%*s%s:\n", indent, "", "radicalExtraAscender");2813 Bprint(f, "%*s%s:\n", indent, "", "radicalExtraAscender");
2705 print_MathValueRecord(f, indent+indentΔ, &v->radicalExtraAscender);2814 print_MathValueRecord(f, indent+indentΔ, o, &v->radicalExtraAscender);
2706 Bprint(f, "%*s%s:\n", indent, "", "radicalKernBeforeDegree");2815 Bprint(f, "%*s%s:\n", indent, "", "radicalKernBeforeDegree");
2707 print_MathValueRecord(f, indent+indentΔ, &v->radicalKernBeforeDegree);2816 print_MathValueRecord(f, indent+indentΔ, o, &v->radicalKernBeforeDegree);
2708 Bprint(f, "%*s%s:\n", indent, "", "radicalKernAfterDegree");2817 Bprint(f, "%*s%s:\n", indent, "", "radicalKernAfterDegree");
2709 print_MathValueRecord(f, indent+indentΔ, &v->radicalKernAfterDegree);2818 print_MathValueRecord(f, indent+indentΔ, o, &v->radicalKernAfterDegree);
2710 Bprint(f, "%*s%s: %d\n", indent, "", "radicalDegreeBottomRaisePercent", v->radicalDegreeBottomRaisePercent);2819 Bprint(f, "%*s%s: %d\n", indent, "", "radicalDegreeBottomRaisePercent", v->radicalDegreeBottomRaisePercent);
2820 USED(o);
2711}2821}
2712 2822
2713int2823int
@@ -2729,14 +2839,15 @@ err: · 15 unmodified lines
2729}2839}
2730 2840
2731void2841void
2732print_MathItalicsCorrectionInfo(Biobuf *f, int indent, MathItalicsCorrectionInfo *v)2842print_MathItalicsCorrectionInfo(Biobuf *f, int indent, Otf *o, MathItalicsCorrectionInfo *v)
2733{2843{
2734 Bprint(f, "%*s%s: %ud\n", indent, "", "italicsCorrectionCoverageOffset", v->italicsCorrectionCoverageOffset);2844 Bprint(f, "%*s%s: %ud\n", indent, "", "italicsCorrectionCoverageOffset", v->italicsCorrectionCoverageOffset);
2735 Bprint(f, "%*s%s: %ud\n", indent, "", "italicsCorrectionCount", v->italicsCorrectionCount);2845 Bprint(f, "%*s%s: %ud\n", indent, "", "italicsCorrectionCount", v->italicsCorrectionCount);
2736 for(int i = 0; i < v->italicsCorrectionCount; i++){2846 for(int i = 0; i < v->italicsCorrectionCount; i++){
2737 Bprint(f, "%*s%s[%d]:\n", indent, "", "italicsCorrection", i);2847 Bprint(f, "%*s%s[%d]:\n", indent, "", "italicsCorrection", i);
2738 print_MathValueRecord(f, indent+indentΔ, &v->italicsCorrection[i]);2848 print_MathValueRecord(f, indent+indentΔ, o, &v->italicsCorrection[i]);
2739 }2849 }
2850 USED(o);
2740}2851}
2741 2852
2742int2853int
@@ -2758,14 +2869,15 @@ err: · 15 unmodified lines
2758}2869}
2759 2870
2760void2871void
2761print_MathTopAccentAttachment(Biobuf *f, int indent, MathTopAccentAttachment *v)2872print_MathTopAccentAttachment(Biobuf *f, int indent, Otf *o, MathTopAccentAttachment *v)
2762{2873{
2763 Bprint(f, "%*s%s: %ud\n", indent, "", "topAccentCoverageOffset", v->topAccentCoverageOffset);2874 Bprint(f, "%*s%s: %ud\n", indent, "", "topAccentCoverageOffset", v->topAccentCoverageOffset);
2764 Bprint(f, "%*s%s: %ud\n", indent, "", "topAccentAttachmentCount", v->topAccentAttachmentCount);2875 Bprint(f, "%*s%s: %ud\n", indent, "", "topAccentAttachmentCount", v->topAccentAttachmentCount);
2765 for(int i = 0; i < v->topAccentAttachmentCount; i++){2876 for(int i = 0; i < v->topAccentAttachmentCount; i++){
2766 Bprint(f, "%*s%s[%d]:\n", indent, "", "topAccentAttachment", i);2877 Bprint(f, "%*s%s[%d]:\n", indent, "", "topAccentAttachment", i);
2767 print_MathValueRecord(f, indent+indentΔ, &v->topAccentAttachment[i]);2878 print_MathValueRecord(f, indent+indentΔ, o, &v->topAccentAttachment[i]);
2768 }2879 }
2880 USED(o);
2769}2881}
2770 2882
2771int2883int
@@ -2785,12 +2897,13 @@ err: · 13 unmodified lines
2785}2897}
2786 2898
2787void2899void
2788print_MathKernInfoRecord(Biobuf *f, int indent, MathKernInfoRecord *v)2900print_MathKernInfoRecord(Biobuf *f, int indent, Otf *o, MathKernInfoRecord *v)
2789{2901{
2790 Bprint(f, "%*s%s: %ud\n", indent, "", "topRightMathKernOffset", v->topRightMathKernOffset);2902 Bprint(f, "%*s%s: %ud\n", indent, "", "topRightMathKernOffset", v->topRightMathKernOffset);
2791 Bprint(f, "%*s%s: %ud\n", indent, "", "topLeftMathKernOffset", v->topLeftMathKernOffset);2903 Bprint(f, "%*s%s: %ud\n", indent, "", "topLeftMathKernOffset", v->topLeftMathKernOffset);
2792 Bprint(f, "%*s%s: %ud\n", indent, "", "bottomRightMathKernOffset", v->bottomRightMathKernOffset);2904 Bprint(f, "%*s%s: %ud\n", indent, "", "bottomRightMathKernOffset", v->bottomRightMathKernOffset);
2793 Bprint(f, "%*s%s: %ud\n", indent, "", "bottomLeftMathKernOffset", v->bottomLeftMathKernOffset);2905 Bprint(f, "%*s%s: %ud\n", indent, "", "bottomLeftMathKernOffset", v->bottomLeftMathKernOffset);
2906 USED(o);
2794}2907}
2795 2908
2796int2909int
@@ -2812,14 +2925,15 @@ err: · 15 unmodified lines
2812}2925}
2813 2926
2814void2927void
2815print_MathKernInfo(Biobuf *f, int indent, MathKernInfo *v)2928print_MathKernInfo(Biobuf *f, int indent, Otf *o, MathKernInfo *v)
2816{2929{
2817 Bprint(f, "%*s%s: %ud\n", indent, "", "mathKernCoverageOffset", v->mathKernCoverageOffset);2930 Bprint(f, "%*s%s: %ud\n", indent, "", "mathKernCoverageOffset", v->mathKernCoverageOffset);
2818 Bprint(f, "%*s%s: %ud\n", indent, "", "mathKernCount", v->mathKernCount);2931 Bprint(f, "%*s%s: %ud\n", indent, "", "mathKernCount", v->mathKernCount);
2819 for(int i = 0; i < v->mathKernCount; i++){2932 for(int i = 0; i < v->mathKernCount; i++){
2820 Bprint(f, "%*s%s[%d]:\n", indent, "", "mathKernInfoRecords", i);2933 Bprint(f, "%*s%s[%d]:\n", indent, "", "mathKernInfoRecords", i);
2821 print_MathKernInfoRecord(f, indent+indentΔ, &v->mathKernInfoRecords[i]);2934 print_MathKernInfoRecord(f, indent+indentΔ, o, &v->mathKernInfoRecords[i]);
2822 }2935 }
2936 USED(o);
2823}2937}
2824 2938
2825int2939int
@@ -2844,17 +2958,18 @@ err: · 18 unmodified lines
2844}2958}
2845 2959
2846void2960void
2847print_MathKern(Biobuf *f, int indent, MathKern *v)2961print_MathKern(Biobuf *f, int indent, Otf *o, MathKern *v)
2848{2962{
2849 Bprint(f, "%*s%s: %ud\n", indent, "", "heightCount", v->heightCount);2963 Bprint(f, "%*s%s: %ud\n", indent, "", "heightCount", v->heightCount);
2850 for(int i = 0; i < v->heightCount; i++){2964 for(int i = 0; i < v->heightCount; i++){
2851 Bprint(f, "%*s%s[%d]:\n", indent, "", "correctionHeight", i);2965 Bprint(f, "%*s%s[%d]:\n", indent, "", "correctionHeight", i);
2852 print_MathValueRecord(f, indent+indentΔ, &v->correctionHeight[i]);2966 print_MathValueRecord(f, indent+indentΔ, o, &v->correctionHeight[i]);
2853 }2967 }
2854 for(int i = 0; i < v->heightCount; i++){2968 for(int i = 0; i < v->heightCount; i++){
2855 Bprint(f, "%*s%s[%d]:\n", indent, "", "kernValues", i);2969 Bprint(f, "%*s%s[%d]:\n", indent, "", "kernValues", i);
2856 print_MathValueRecord(f, indent+indentΔ, &v->kernValues[i]);2970 print_MathValueRecord(f, indent+indentΔ, o, &v->kernValues[i]);
2857 }2971 }
2972 USED(o);
2858}2973}
2859 2974
2860int2975int
@@ -2876,11 +2991,12 @@ err: · 15 unmodified lines
2876}2991}
2877 2992
2878void2993void
2879print_Coverage1(Biobuf *f, int indent, Coverage1 *v)2994print_Coverage1(Biobuf *f, int indent, Otf *o, Coverage1 *v)
2880{2995{
2881 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphCount", v->glyphCount);2996 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphCount", v->glyphCount);
2882 for(int i = 0; i < v->glyphCount; i++)2997 for(int i = 0; i < v->glyphCount; i++)
2883 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "glyphArray", i, v->glyphArray[i]);2998 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "glyphArray", i, v->glyphArray[i]);
2999 USED(o);
2884}3000}
2885 3001
2886int3002int
@@ -2899,11 +3015,12 @@ err: · 12 unmodified lines
2899}3015}
2900 3016
2901void3017void
2902print_RangeRecord(Biobuf *f, int indent, RangeRecord *v)3018print_RangeRecord(Biobuf *f, int indent, Otf *o, RangeRecord *v)
2903{3019{
2904 Bprint(f, "%*s%s: %ud\n", indent, "", "startGlyphID", v->startGlyphID);3020 Bprint(f, "%*s%s: %ud\n", indent, "", "startGlyphID", v->startGlyphID);
2905 Bprint(f, "%*s%s: %ud\n", indent, "", "endGlyphID", v->endGlyphID);3021 Bprint(f, "%*s%s: %ud\n", indent, "", "endGlyphID", v->endGlyphID);
2906 Bprint(f, "%*s%s: %ud\n", indent, "", "startCoverageIndex", v->startCoverageIndex);3022 Bprint(f, "%*s%s: %ud\n", indent, "", "startCoverageIndex", v->startCoverageIndex);
3023 USED(o);
2907}3024}
2908 3025
2909int3026int
@@ -2924,13 +3041,14 @@ err: · 14 unmodified lines
2924}3041}
2925 3042
2926void3043void
2927print_Coverage2(Biobuf *f, int indent, Coverage2 *v)3044print_Coverage2(Biobuf *f, int indent, Otf *o, Coverage2 *v)
2928{3045{
2929 Bprint(f, "%*s%s: %ud\n", indent, "", "rangeCount", v->rangeCount);3046 Bprint(f, "%*s%s: %ud\n", indent, "", "rangeCount", v->rangeCount);
2930 for(int i = 0; i < v->rangeCount; i++){3047 for(int i = 0; i < v->rangeCount; i++){
2931 Bprint(f, "%*s%s[%d]:\n", indent, "", "rangeRecords", i);3048 Bprint(f, "%*s%s[%d]:\n", indent, "", "rangeRecords", i);
2932 print_RangeRecord(f, indent+indentΔ, &v->rangeRecords[i]);3049 print_RangeRecord(f, indent+indentΔ, o, &v->rangeRecords[i]);
2933 }3050 }
3051 USED(o);
2934}3052}
2935 3053
2936int3054int
@@ -2963,17 +3081,18 @@ err: · 26 unmodified lines
2963}3081}
2964 3082
2965void3083void
2966print_Coverage(Biobuf *f, int indent, Coverage *v)3084print_Coverage(Biobuf *f, int indent, Otf *o, Coverage *v)
2967{3085{
2968 Bprint(f, "%*s%s: %ud\n", indent, "", "format", v->format);3086 Bprint(f, "%*s%s: %ud\n", indent, "", "format", v->format);
2969 if(v->format == 1){3087 if(v->format == 1){
2970 Bprint(f, "%*s%s:\n", indent, "", "cov1");3088 Bprint(f, "%*s%s:\n", indent, "", "cov1");
2971 print_Coverage1(f, indent+indentΔ, &v->cov1);3089 print_Coverage1(f, indent+indentΔ, o, &v->cov1);
2972 }3090 }
2973 if(v->format == 2){3091 if(v->format == 2){
2974 Bprint(f, "%*s%s:\n", indent, "", "cov2");3092 Bprint(f, "%*s%s:\n", indent, "", "cov2");
2975 print_Coverage2(f, indent+indentΔ, &v->cov2);3093 print_Coverage2(f, indent+indentΔ, o, &v->cov2);
2976 }3094 }
3095 USED(o);
2977}3096}
2978 3097
2979int3098int
@@ -3026,7 +3145,7 @@ err: · 46 unmodified lines
3026}3145}
3027 3146
3028void3147void
3029print_MathVariants(Biobuf *f, int indent, MathVariants *v)3148print_MathVariants(Biobuf *f, int indent, Otf *o, MathVariants *v)
3030{3149{
3031 Bprint(f, "%*s%s: %ud\n", indent, "", "minConnectorOverlap", v->minConnectorOverlap);3150 Bprint(f, "%*s%s: %ud\n", indent, "", "minConnectorOverlap", v->minConnectorOverlap);
3032 Bprint(f, "%*s%s: %ud\n", indent, "", "vertGlyphCoverageOffset", v->vertGlyphCoverageOffset);3151 Bprint(f, "%*s%s: %ud\n", indent, "", "vertGlyphCoverageOffset", v->vertGlyphCoverageOffset);
@@ -3039,10 +3158,11 @@ print_MathVariants(Biobuf *f, int indent, MathVariants *v) · 6 unmodified lines
3039 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "horizGlyphConstructionOffsets", i, v->horizGlyphConstructionOffsets[i]);3158 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "horizGlyphConstructionOffsets", i, v->horizGlyphConstructionOffsets[i]);
3040 Bprint(f, "%*s%s:\n", indent, "", "vertGlyphCoverage");3159 Bprint(f, "%*s%s:\n", indent, "", "vertGlyphCoverage");
3041 if(v->vertGlyphCoverage != nil)3160 if(v->vertGlyphCoverage != nil)
3042 print_Coverage(f, indent+indentΔ, v->vertGlyphCoverage);3161 print_Coverage(f, indent+indentΔ, o, v->vertGlyphCoverage);
3043 Bprint(f, "%*s%s:\n", indent, "", "horizGlyphCoverage");3162 Bprint(f, "%*s%s:\n", indent, "", "horizGlyphCoverage");
3044 if(v->horizGlyphCoverage != nil)3163 if(v->horizGlyphCoverage != nil)
3045 print_Coverage(f, indent+indentΔ, v->horizGlyphCoverage);3164 print_Coverage(f, indent+indentΔ, o, v->horizGlyphCoverage);
3165 USED(o);
3046}3166}
3047 3167
3048int3168int
@@ -3106,7 +3226,7 @@ err: · 57 unmodified lines
3106}3226}
3107 3227
3108void3228void
3109print_MathGlyphInfo(Biobuf *f, int indent, MathGlyphInfo *v)3229print_MathGlyphInfo(Biobuf *f, int indent, Otf *o, MathGlyphInfo *v)
3110{3230{
3111 Bprint(f, "%*s%s: %ud\n", indent, "", "mathItalicsCorrectionInfoOffset", v->mathItalicsCorrectionInfoOffset);3231 Bprint(f, "%*s%s: %ud\n", indent, "", "mathItalicsCorrectionInfoOffset", v->mathItalicsCorrectionInfoOffset);
3112 Bprint(f, "%*s%s: %ud\n", indent, "", "mathTopAccentAttachmentOffset", v->mathTopAccentAttachmentOffset);3232 Bprint(f, "%*s%s: %ud\n", indent, "", "mathTopAccentAttachmentOffset", v->mathTopAccentAttachmentOffset);
@@ -3114,16 +3234,17 @@ print_MathGlyphInfo(Biobuf *f, int indent, MathGlyphInfo *v) · 1 unmodified line
3114 Bprint(f, "%*s%s: %ud\n", indent, "", "mathKernInfoOffset", v->mathKernInfoOffset);3234 Bprint(f, "%*s%s: %ud\n", indent, "", "mathKernInfoOffset", v->mathKernInfoOffset);
3115 Bprint(f, "%*s%s:\n", indent, "", "mathItalicsCorrectionInfo");3235 Bprint(f, "%*s%s:\n", indent, "", "mathItalicsCorrectionInfo");
3116 if(v->mathItalicsCorrectionInfo != nil)3236 if(v->mathItalicsCorrectionInfo != nil)
3117 print_MathItalicsCorrectionInfo(f, indent+indentΔ, v->mathItalicsCorrectionInfo);3237 print_MathItalicsCorrectionInfo(f, indent+indentΔ, o, v->mathItalicsCorrectionInfo);
3118 Bprint(f, "%*s%s:\n", indent, "", "mathTopAccentAttachment");3238 Bprint(f, "%*s%s:\n", indent, "", "mathTopAccentAttachment");
3119 if(v->mathTopAccentAttachment != nil)3239 if(v->mathTopAccentAttachment != nil)
3120 print_MathTopAccentAttachment(f, indent+indentΔ, v->mathTopAccentAttachment);3240 print_MathTopAccentAttachment(f, indent+indentΔ, o, v->mathTopAccentAttachment);
3121 Bprint(f, "%*s%s:\n", indent, "", "mathKernInfo");3241 Bprint(f, "%*s%s:\n", indent, "", "mathKernInfo");
3122 if(v->mathKernInfo != nil)3242 if(v->mathKernInfo != nil)
3123 print_MathKernInfo(f, indent+indentΔ, v->mathKernInfo);3243 print_MathKernInfo(f, indent+indentΔ, o, v->mathKernInfo);
3124 Bprint(f, "%*s%s:\n", indent, "", "extendedShapeCoverage");3244 Bprint(f, "%*s%s:\n", indent, "", "extendedShapeCoverage");
3125 if(v->extendedShapeCoverage != nil)3245 if(v->extendedShapeCoverage != nil)
3126 print_Coverage(f, indent+indentΔ, v->extendedShapeCoverage);3246 print_Coverage(f, indent+indentΔ, o, v->extendedShapeCoverage);
3247 USED(o);
3127}3248}
3128 3249
3129int3250int
@@ -3141,10 +3262,11 @@ err: · 11 unmodified lines
3141}3262}
3142 3263
3143void3264void
3144print_MathGlyphVariantRecord(Biobuf *f, int indent, MathGlyphVariantRecord *v)3265print_MathGlyphVariantRecord(Biobuf *f, int indent, Otf *o, MathGlyphVariantRecord *v)
3145{3266{
3146 Bprint(f, "%*s%s: %ud\n", indent, "", "variantGlyph", v->variantGlyph);3267 Bprint(f, "%*s%s: %ud\n", indent, "", "variantGlyph", v->variantGlyph);
3147 Bprint(f, "%*s%s: %ud\n", indent, "", "advanceMeasurement", v->advanceMeasurement);3268 Bprint(f, "%*s%s: %ud\n", indent, "", "advanceMeasurement", v->advanceMeasurement);
3269 USED(o);
3148}3270}
3149 3271
3150int3272int
@@ -3165,13 +3287,14 @@ err: · 14 unmodified lines
3165}3287}
3166 3288
3167void3289void
3168print_GlyphPart(Biobuf *f, int indent, GlyphPart *v)3290print_GlyphPart(Biobuf *f, int indent, Otf *o, GlyphPart *v)
3169{3291{
3170 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphID", v->glyphID);3292 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphID", v->glyphID);
3171 Bprint(f, "%*s%s: %ud\n", indent, "", "startConnectorLength", v->startConnectorLength);3293 Bprint(f, "%*s%s: %ud\n", indent, "", "startConnectorLength", v->startConnectorLength);
3172 Bprint(f, "%*s%s: %ud\n", indent, "", "endConnectorLength", v->endConnectorLength);3294 Bprint(f, "%*s%s: %ud\n", indent, "", "endConnectorLength", v->endConnectorLength);
3173 Bprint(f, "%*s%s: %ud\n", indent, "", "fullAdvance", v->fullAdvance);3295 Bprint(f, "%*s%s: %ud\n", indent, "", "fullAdvance", v->fullAdvance);
3174 Bprint(f, "%*s%s: %ud\n", indent, "", "partFlags", v->partFlags);3296 Bprint(f, "%*s%s: %ud\n", indent, "", "partFlags", v->partFlags);
3297 USED(o);
3175}3298}
3176 3299
3177int3300int
@@ -3196,15 +3319,16 @@ err: · 18 unmodified lines
3196}3319}
3197 3320
3198void3321void
3199print_GlyphAssembly(Biobuf *f, int indent, GlyphAssembly *v)3322print_GlyphAssembly(Biobuf *f, int indent, Otf *o, GlyphAssembly *v)
3200{3323{
3201 Bprint(f, "%*s%s:\n", indent, "", "italicsCorrection");3324 Bprint(f, "%*s%s:\n", indent, "", "italicsCorrection");
3202 print_MathValueRecord(f, indent+indentΔ, &v->italicsCorrection);3325 print_MathValueRecord(f, indent+indentΔ, o, &v->italicsCorrection);
3203 Bprint(f, "%*s%s: %ud\n", indent, "", "partCount", v->partCount);3326 Bprint(f, "%*s%s: %ud\n", indent, "", "partCount", v->partCount);
3204 for(int i = 0; i < v->partCount; i++){3327 for(int i = 0; i < v->partCount; i++){
3205 Bprint(f, "%*s%s[%d]:\n", indent, "", "partRecords", i);3328 Bprint(f, "%*s%s[%d]:\n", indent, "", "partRecords", i);
3206 print_GlyphPart(f, indent+indentΔ, &v->partRecords[i]);3329 print_GlyphPart(f, indent+indentΔ, o, &v->partRecords[i]);
3207 }3330 }
3331 USED(o);
3208}3332}
3209 3333
3210int3334int
@@ -3237,17 +3361,18 @@ err: · 26 unmodified lines
3237}3361}
3238 3362
3239void3363void
3240print_MathGlyphConstruction(Biobuf *f, int indent, MathGlyphConstruction *v)3364print_MathGlyphConstruction(Biobuf *f, int indent, Otf *o, MathGlyphConstruction *v)
3241{3365{
3242 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphAssemblyOffset", v->glyphAssemblyOffset);3366 Bprint(f, "%*s%s: %ud\n", indent, "", "glyphAssemblyOffset", v->glyphAssemblyOffset);
3243 Bprint(f, "%*s%s: %ud\n", indent, "", "variantCount", v->variantCount);3367 Bprint(f, "%*s%s: %ud\n", indent, "", "variantCount", v->variantCount);
3244 for(int i = 0; i < v->variantCount; i++){3368 for(int i = 0; i < v->variantCount; i++){
3245 Bprint(f, "%*s%s[%d]:\n", indent, "", "mathGlyphVariantRecords", i);3369 Bprint(f, "%*s%s[%d]:\n", indent, "", "mathGlyphVariantRecords", i);
3246 print_MathGlyphVariantRecord(f, indent+indentΔ, &v->mathGlyphVariantRecords[i]);3370 print_MathGlyphVariantRecord(f, indent+indentΔ, o, &v->mathGlyphVariantRecords[i]);
3247 }3371 }
3248 Bprint(f, "%*s%s:\n", indent, "", "glyphAssembly");3372 Bprint(f, "%*s%s:\n", indent, "", "glyphAssembly");
3249 if(v->glyphAssembly != nil)3373 if(v->glyphAssembly != nil)
3250 print_GlyphAssembly(f, indent+indentΔ, v->glyphAssembly);3374 print_GlyphAssembly(f, indent+indentΔ, o, v->glyphAssembly);
3375 USED(o);
3251}3376}
3252 3377
3253int3378int
@@ -3309,20 +3434,271 @@ err: · 55 unmodified lines
3309}3434}
3310 3435
3311void3436void
3312print_TableMATH(Biobuf *f, int indent, TableMATH *v)3437print_TableMATH(Biobuf *f, int indent, Otf *o, TableMATH *v)
3313{3438{
3314 Bprint(f, "%*s%s: %ud\n", indent, "", "mathConstantsOffset", v->mathConstantsOffset);3439 Bprint(f, "%*s%s: %ud\n", indent, "", "mathConstantsOffset", v->mathConstantsOffset);
3315 Bprint(f, "%*s%s: %ud\n", indent, "", "mathGlyphInfoOffset", v->mathGlyphInfoOffset);3440 Bprint(f, "%*s%s: %ud\n", indent, "", "mathGlyphInfoOffset", v->mathGlyphInfoOffset);
3316 Bprint(f, "%*s%s: %ud\n", indent, "", "mathVariantsOffset", v->mathVariantsOffset);3441 Bprint(f, "%*s%s: %ud\n", indent, "", "mathVariantsOffset", v->mathVariantsOffset);
3317 Bprint(f, "%*s%s:\n", indent, "", "mathConstants");3442 Bprint(f, "%*s%s:\n", indent, "", "mathConstants");
3318 if(v->mathConstants != nil)3443 if(v->mathConstants != nil)
3319 print_MathConstants(f, indent+indentΔ, v->mathConstants);3444 print_MathConstants(f, indent+indentΔ, o, v->mathConstants);
3320 Bprint(f, "%*s%s:\n", indent, "", "mathGlyphInfo");3445 Bprint(f, "%*s%s:\n", indent, "", "mathGlyphInfo");
3321 if(v->mathGlyphInfo != nil)3446 if(v->mathGlyphInfo != nil)
3322 print_MathGlyphInfo(f, indent+indentΔ, v->mathGlyphInfo);3447 print_MathGlyphInfo(f, indent+indentΔ, o, v->mathGlyphInfo);
3323 Bprint(f, "%*s%s:\n", indent, "", "mathVariants");3448 Bprint(f, "%*s%s:\n", indent, "", "mathVariants");
3324 if(v->mathVariants != nil)3449 if(v->mathVariants != nil)
3325 print_MathVariants(f, indent+indentΔ, v->mathVariants);3450 print_MathVariants(f, indent+indentΔ, o, v->mathVariants);
3451 USED(o);
3452}
3453
3454int
3455read_KernPair(Otf *o, KernPair *v)
3456{
3457 u8int *b;
3458 if((b = otfreadn(o, 6)) == nil)
3459 goto err;
3460 v->left = b[0]<<8 | b[1];
3461 v->right = b[2]<<8 | b[3];
3462 v->value = b[4]<<8 | b[5];
3463 return 0;
3464err:
3465 werrstr("%s: %r", "KernPair");
3466 return -1;
3467}
3468
3469void
3470print_KernPair(Biobuf *f, int indent, Otf *o, KernPair *v)
3471{
3472 Bprint(f, "%*s%s: %ud\n", indent, "", "left", v->left);
3473 Bprint(f, "%*s%s: %ud\n", indent, "", "right", v->right);
3474 Bprint(f, "%*s%s: %d\n", indent, "", "value", v->value);
3475 USED(o);
3476}
3477
3478int
3479read_KernSubtable0(Otf *o, KernSubtable0 *v)
3480{
3481 u8int *b;
3482 if((b = otfreadn(o, 8)) == nil)
3483 goto err;
3484 v->nPairs = b[0]<<8 | b[1];
3485 v->searchRange = b[2]<<8 | b[3];
3486 v->entrySelector = b[4]<<8 | b[5];
3487 v->rangeShift = b[6]<<8 | b[7];
3488 if(otfarray(o, &v->kernPairs, read_KernPair, sizeof(KernPair), v->nPairs) < 0){
3489 werrstr("%s: %r", "kernPairs");
3490 goto err;
3491 }
3492 return 0;
3493err:
3494 werrstr("%s: %r", "KernSubtable0");
3495 return -1;
3496}
3497
3498void
3499print_KernSubtable0(Biobuf *f, int indent, Otf *o, KernSubtable0 *v)
3500{
3501 Bprint(f, "%*s%s: %ud\n", indent, "", "nPairs", v->nPairs);
3502 Bprint(f, "%*s%s: %ud\n", indent, "", "searchRange", v->searchRange);
3503 Bprint(f, "%*s%s: %ud\n", indent, "", "entrySelector", v->entrySelector);
3504 Bprint(f, "%*s%s: %ud\n", indent, "", "rangeShift", v->rangeShift);
3505 for(int i = 0; i < v->nPairs; i++){
3506 Bprint(f, "%*s%s[%d]:\n", indent, "", "kernPairs", i);
3507 print_KernPair(f, indent+indentΔ, o, &v->kernPairs[i]);
3508 }
3509 USED(o);
3510}
3511
3512int
3513read_KernClass(Otf *o, KernClass *v)
3514{
3515 u8int *b;
3516 if((b = otfreadn(o, 4)) == nil)
3517 goto err;
3518 v->firstGlyph = b[0]<<8 | b[1];
3519 v->nGlyphs = b[2]<<8 | b[3];
3520 if((b = otfreadn(o, v->nGlyphs*2)) == nil)
3521 goto err;
3522 v->values = malloc(v->nGlyphs*sizeof(*v->values));
3523 for(int i = 0; i < v->nGlyphs; i++)
3524 v->values[i] = b[0+i*2]<<8 | b[1+i*2];
3525 return 0;
3526err:
3527 werrstr("%s: %r", "KernClass");
3528 return -1;
3529}
3530
3531void
3532print_KernClass(Biobuf *f, int indent, Otf *o, KernClass *v)
3533{
3534 Bprint(f, "%*s%s: %ud\n", indent, "", "firstGlyph", v->firstGlyph);
3535 Bprint(f, "%*s%s: %ud\n", indent, "", "nGlyphs", v->nGlyphs);
3536 for(int i = 0; i < v->nGlyphs; i++)
3537 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "values", i, v->values[i]);
3538 USED(o);
3539}
3540
3541int
3542read_KernSubtable2(Otf *o, KernSubtable2 *v)
3543{
3544 u8int *b;
3545 if((b = otfreadn(o, 8)) == nil)
3546 goto err;
3547 v->rowWidth = b[0]<<8 | b[1];
3548 v->leftClassOffset = b[2]<<8 | b[3];
3549 v->rightClassOffset = b[4]<<8 | b[5];
3550 v->kerningArrayOffset = b[6]<<8 | b[7];
3551 if(v->leftClassOffset != 0){
3552 if(otfpushrange(o, v->leftClassOffset, -1) < 0)
3553 goto err;
3554 v->leftClass = calloc(1, sizeof(*v->leftClass));
3555 if(read_KernClass(o, v->leftClass) < 0){
3556 werrstr("%s: %r", "leftClass");
3557 goto err;
3558 }
3559 if(otfpoprange(o) < 0)
3560 goto err;
3561 }
3562 if(v->rightClassOffset != 0){
3563 if(otfpushrange(o, v->rightClassOffset, -1) < 0)
3564 goto err;
3565 v->rightClass = calloc(1, sizeof(*v->rightClass));
3566 if(read_KernClass(o, v->rightClass) < 0){
3567 werrstr("%s: %r", "rightClass");
3568 goto err;
3569 }
3570 if(otfpoprange(o) < 0)
3571 goto err;
3572 }
3573 if((b = otfreadn(o, (v->rowWidth/2)*2)) == nil)
3574 goto err;
3575 v->kerningArray = malloc((v->rowWidth/2)*sizeof(*v->kerningArray));
3576 for(int i = 0; i < (v->rowWidth/2); i++)
3577 v->kerningArray[i] = b[0+i*2]<<8 | b[1+i*2];
3578 return 0;
3579err:
3580 werrstr("%s: %r", "KernSubtable2");
3581 return -1;
3582}
3583
3584void
3585print_KernSubtable2(Biobuf *f, int indent, Otf *o, KernSubtable2 *v)
3586{
3587 Bprint(f, "%*s%s: %ud\n", indent, "", "rowWidth", v->rowWidth);
3588 Bprint(f, "%*s%s: %ud\n", indent, "", "leftClassOffset", v->leftClassOffset);
3589 Bprint(f, "%*s%s: %ud\n", indent, "", "rightClassOffset", v->rightClassOffset);
3590 Bprint(f, "%*s%s: %ud\n", indent, "", "kerningArrayOffset", v->kerningArrayOffset);
3591 Bprint(f, "%*s%s:\n", indent, "", "leftClass");
3592 if(v->leftClass != nil)
3593 print_KernClass(f, indent+indentΔ, o, v->leftClass);
3594 Bprint(f, "%*s%s:\n", indent, "", "rightClass");
3595 if(v->rightClass != nil)
3596 print_KernClass(f, indent+indentΔ, o, v->rightClass);
3597 for(int i = 0; i < (v->rowWidth/2); i++)
3598 Bprint(f, "%*s%s[%d]: %d\n", indent, "", "kerningArray", i, v->kerningArray[i]);
3599 USED(o);
3600}
3601
3602int
3603read_KernSubtable(Otf *o, KernSubtable *v)
3604{
3605 u8int *b;
3606 if((b = otfreadn(o, 6)) == nil)
3607 goto err;
3608 u16int version = b[0]<<8 | b[1];
3609 if(version != 0){
3610 werrstr("%s: invalid value: %d (0x%ux)", "version", version, version);
3611 goto err;
3612 }
3613 v->length = b[2]<<8 | b[3];
3614 if(v->length < 6){
3615 werrstr("%s: invalid value: %d (0x%ux)", "length", v->length, v->length);
3616 goto err;
3617 }
3618 v->coverage = b[4]<<8 | b[5];
3619 return 0;
3620err:
3621 werrstr("%s: %r", "KernSubtable");
3622 return -1;
3623}
3624
3625void
3626print_KernSubtable(Biobuf *f, int indent, Otf *o, KernSubtable *v)
3627{
3628 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
3629 Bprint(f, "%*s%s: %ud\n", indent, "", "coverage", v->coverage);
3630 USED(o);
3631}
3632
3633int
3634read_TableKern(Otf *o, TableKern *v)
3635{
3636 u8int *b;
3637 if((b = otfreadn(o, 4)) == nil)
3638 goto err;
3639 u16int version = b[0]<<8 | b[1];
3640 if(version != 0){
3641 werrstr("%s: invalid value: %d (0x%ux)", "version", version, version);
3642 goto err;
3643 }
3644 v->nTables = b[2]<<8 | b[3];
3645 if(otfarray(o, &v->subtables, read_KernSubtable, sizeof(KernSubtable), v->nTables) < 0){
3646 werrstr("%s: %r", "subtables");
3647 goto err;
3648 }
3649 return 0;
3650err:
3651 werrstr("%s: %r", "TableKern");
3652 return -1;
3653}
3654
3655void
3656print_TableKern(Biobuf *f, int indent, Otf *o, TableKern *v)
3657{
3658 Bprint(f, "%*s%s: %ud\n", indent, "", "nTables", v->nTables);
3659 for(int i = 0; i < v->nTables; i++){
3660 Bprint(f, "%*s%s[%d]:\n", indent, "", "subtables", i);
3661 print_KernSubtable(f, indent+indentΔ, o, &v->subtables[i]);
3662 }
3663 USED(o);
3664}
3665
3666int
3667read_TableLoca(Otf *o, TableLoca *v)
3668{
3669 u8int *b;
3670 if(o->indexToLocFormat == 0){
3671 if((b = otfreadn(o, (o->numGlyphs+1)*2)) == nil)
3672 goto err;
3673 v->shortOffsets = malloc((o->numGlyphs+1)*sizeof(*v->shortOffsets));
3674 for(int i = 0; i < (o->numGlyphs+1); i++)
3675 v->shortOffsets[i] = b[0+i*2]<<8 | b[1+i*2];
3676 }
3677 if(o->indexToLocFormat == 1){
3678 if((b = otfreadn(o, (o->numGlyphs+1)*4)) == nil)
3679 goto err;
3680 v->longOffsets = malloc((o->numGlyphs+1)*sizeof(*v->longOffsets));
3681 for(int i = 0; i < (o->numGlyphs+1); i++)
3682 v->longOffsets[i] = b[0+i*4]<<24 | b[1+i*4]<<16 | b[2+i*4]<<8 | b[3+i*4];
3683 }
3684 return 0;
3685err:
3686 werrstr("%s: %r", "TableLoca");
3687 return -1;
3688}
3689
3690void
3691print_TableLoca(Biobuf *f, int indent, Otf *o, TableLoca *v)
3692{
3693 if(o->indexToLocFormat == 0){
3694 for(int i = 0; i < (o->numGlyphs+1); i++)
3695 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "shortOffsets", i, v->shortOffsets[i]);
3696 }
3697 if(o->indexToLocFormat == 1){
3698 for(int i = 0; i < (o->numGlyphs+1); i++)
3699 Bprint(f, "%*s%s[%d]: %ud\n", indent, "", "longOffsets", i, v->longOffsets[i]);
3700 }
3701 USED(o);
3326}3702}
3327 3703
3328int3704int
@@ -3394,7 +3770,7 @@ err: · 65 unmodified lines
3394}3770}
3395 3771
3396void3772void
3397print_TableOS∕2(Biobuf *f, int indent, TableOS∕2 *v)3773print_TableOS∕2(Biobuf *f, int indent, Otf *o, TableOS∕2 *v)
3398{3774{
3399 Bprint(f, "%*s%s: %ud\n", indent, "", "version", v->version);3775 Bprint(f, "%*s%s: %ud\n", indent, "", "version", v->version);
3400 Bprint(f, "%*s%s: %d\n", indent, "", "xAvgCharWidth", v->xAvgCharWidth);3776 Bprint(f, "%*s%s: %d\n", indent, "", "xAvgCharWidth", v->xAvgCharWidth);
@@ -3445,6 +3821,7 @@ print_TableOS∕2(Biobuf *f, int indent, TableOS∕2 *v) · 44 unmodified lines
3445 Bprint(f, "%*s%s: %ud\n", indent, "", "usLowerOpticalPointSize", v->usLowerOpticalPointSize);3821 Bprint(f, "%*s%s: %ud\n", indent, "", "usLowerOpticalPointSize", v->usLowerOpticalPointSize);
3446 if(v->version >= 5)3822 if(v->version >= 5)
3447 Bprint(f, "%*s%s: %ud\n", indent, "", "usUpperOpticalPointSize", v->usUpperOpticalPointSize);3823 Bprint(f, "%*s%s: %ud\n", indent, "", "usUpperOpticalPointSize", v->usUpperOpticalPointSize);
3824 USED(o);
3448}3825}
3449 3826
3450int3827int
@@ -3463,13 +3840,14 @@ err: · 12 unmodified lines
3463}3840}
3464 3841
3465void3842void
3466print_TableRecord(Biobuf *f, int indent, TableRecord *v)3843print_TableRecord(Biobuf *f, int indent, Otf *o, TableRecord *v)
3467{3844{
3468 Bprint(f, "%*s%s: %t\n", indent, "", "tableTag", v->tableTag);3845 Bprint(f, "%*s%s: %t\n", indent, "", "tableTag", v->tableTag);
3469 Bprint(f, "%*s%s: %ud\n", indent, "", "offset", v->offset);3846 Bprint(f, "%*s%s: %ud\n", indent, "", "offset", v->offset);
3470 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);3847 Bprint(f, "%*s%s: %ud\n", indent, "", "length", v->length);
3471 if(v->print != nil && v->parsed != nil)3848 if(v->print != nil && v->parsed != nil)
3472 v->print(f, indent+indentΔ, v->parsed);3849 v->print(f, indent+indentΔ, o, v->parsed);
3850 USED(o);
3473}3851}
3474 3852
3475int3853int
@@ -3491,134 +3869,224 @@ read_TableDirectory(Otf *o, TableDirectory *v) · 15 unmodified lines
3491 werrstr("%s: %r", "tableRecords");3869 werrstr("%s: %r", "tableRecords");
3492 goto err;3870 goto err;
3493 }3871 }
3494 for(int i = 0; i < v->numTables; i++){3872 int retry = 0;
3495 TableRecord *rec = &v->tableRecords[i];3873 do{
3496 if(rec->length == 0)3874 for(int i = 0; i < v->numTables; i++){
3497 continue;3875 TableRecord *rec = &v->tableRecords[i];
3498 if(otfpushrange(o, rec->offset, rec->length) < 0)3876 if(rec->length == 0)
3499 goto err;3877 continue;
3500 switch(rec->tableTag){3878 if(otfpushrange(o, rec->offset, rec->length) < 0)
3501 case (u32int)('c'<<24|'m'<<16|'a'<<8|'p'):
3502 v->cmap = calloc(1, sizeof(TableCmap));
3503 if(read_TableCmap(o, v->cmap) < 0){
3504 free(v->cmap);
3505 goto err;
3506 }
3507 rec->parsed = v->cmap;
3508 rec->print = (void*)print_TableCmap;
3509 break;
3510 case (u32int)('h'<<24|'e'<<16|'a'<<8|'d'):
3511 v->head = calloc(1, sizeof(TableHead));
3512 if(read_TableHead(o, v->head) < 0){
3513 free(v->head);
3514 goto err;
3515 }
3516 rec->parsed = v->head;
3517 rec->print = (void*)print_TableHead;
3518 break;
3519 case (u32int)('h'<<24|'h'<<16|'e'<<8|'a'):
3520 v->hhea = calloc(1, sizeof(TableHhea));
3521 if(read_TableHhea(o, v->hhea) < 0){
3522 free(v->hhea);
3523 goto err;3879 goto err;
3880 switch(rec->tableTag){
3881 case (u32int)('c'<<24|'m'<<16|'a'<<8|'p'):
3882 if(v->cmap != nil)
3883 break;
3884 v->cmap = calloc(1, sizeof(TableCmap));
3885 if(read_TableCmap(o, v->cmap) < 0){
3886 free(v->cmap);
3887 goto err;
3888 }
3889 rec->parsed = v->cmap;
3890 rec->print = (void*)print_TableCmap;
3891 break;
3892 case (u32int)('h'<<24|'e'<<16|'a'<<8|'d'):
3893 if(v->head != nil)
3894 break;
3895 v->head = calloc(1, sizeof(TableHead));
3896 if(read_TableHead(o, v->head) < 0){
3897 free(v->head);
3898 goto err;
3899 }
3900 rec->parsed = v->head;
3901 rec->print = (void*)print_TableHead;
3902 break;
3903 case (u32int)('h'<<24|'h'<<16|'e'<<8|'a'):
3904 if(v->hhea != nil)
3905 break;
3906 v->hhea = calloc(1, sizeof(TableHhea));
3907 if(read_TableHhea(o, v->hhea) < 0){
3908 free(v->hhea);
3909 goto err;
3910 }
3911 rec->parsed = v->hhea;
3912 rec->print = (void*)print_TableHhea;
3913 break;
3914 case (u32int)('m'<<24|'a'<<16|'x'<<8|'p'):
3915 if(v->maxp != nil)
3916 break;
3917 v->maxp = calloc(1, sizeof(TableMaxp));
3918 if(read_TableMaxp(o, v->maxp) < 0){
3919 free(v->maxp);
3920 goto err;
3921 }
3922 rec->parsed = v->maxp;
3923 rec->print = (void*)print_TableMaxp;
3924 break;
3925 case (u32int)('h'<<24|'m'<<16|'t'<<8|'x'):
3926 {
3927 static int retried = 0;
3928 if(v->hhea == nil || v->maxp == nil){
3929 if(retried){
3930 werrstr("%s: deps missing", "TableHmtx");
3931 goto err;
3932 }
3933 retried = 1;
3934 retry++;
3935 break;
3936 }
3937 if(retried)
3938 retry--;
3939 }
3940 if(v->hmtx != nil)
3941 break;
3942 v->hmtx = calloc(1, sizeof(TableHmtx));
3943 if(read_TableHmtx(o, v->hmtx) < 0){
3944 free(v->hmtx);
3945 goto err;
3946 }
3947 rec->parsed = v->hmtx;
3948 rec->print = (void*)print_TableHmtx;
3949 break;
3950 case (u32int)('p'<<24|'o'<<16|'s'<<8|'t'):
3951 if(v->post != nil)
3952 break;
3953 v->post = calloc(1, sizeof(TablePost));
3954 if(read_TablePost(o, v->post) < 0){
3955 free(v->post);
3956 goto err;
3957 }
3958 rec->parsed = v->post;
3959 rec->print = (void*)print_TablePost;
3960 break;
3961 case (u32int)('n'<<24|'a'<<16|'m'<<8|'e'):
3962 if(v->name != nil)
3963 break;
3964 v->name = calloc(1, sizeof(TableName));
3965 if(read_TableName(o, v->name) < 0){
3966 free(v->name);
3967 goto err;
3968 }
3969 rec->parsed = v->name;
3970 rec->print = (void*)print_TableName;
3971 break;
3972 case (u32int)('E'<<24|'B'<<16|'D'<<8|'T'):
3973 if(v->ebdt != nil)
3974 break;
3975 v->ebdt = calloc(1, sizeof(TableEBDT));
3976 if(read_TableEBDT(o, v->ebdt) < 0){
3977 free(v->ebdt);
3978 goto err;
3979 }
3980 rec->parsed = v->ebdt;
3981 rec->print = (void*)print_TableEBDT;
3982 break;
3983 case (u32int)('E'<<24|'B'<<16|'L'<<8|'C'):
3984 if(v->eblc != nil)
3985 break;
3986 v->eblc = calloc(1, sizeof(TableEBLC));
3987 if(read_TableEBLC(o, v->eblc) < 0){
3988 free(v->eblc);
3989 goto err;
3990 }
3991 rec->parsed = v->eblc;
3992 rec->print = (void*)print_TableEBLC;
3993 break;
3994 case (u32int)('G'<<24|'D'<<16|'E'<<8|'F'):
3995 if(v->gdef != nil)
3996 break;
3997 v->gdef = calloc(1, sizeof(TableGDEF));
3998 if(read_TableGDEF(o, v->gdef) < 0){
3999 free(v->gdef);
4000 goto err;
4001 }
4002 rec->parsed = v->gdef;
4003 rec->print = (void*)print_TableGDEF;
4004 break;
4005 case (u32int)('G'<<24|'P'<<16|'O'<<8|'S'):
4006 if(v->gpos != nil)
4007 break;
4008 v->gpos = calloc(1, sizeof(TableGPOS));
4009 if(read_TableGPOS(o, v->gpos) < 0){
4010 free(v->gpos);
4011 goto err;
4012 }
4013 rec->parsed = v->gpos;
4014 rec->print = (void*)print_TableGPOS;
4015 break;
4016 case (u32int)('G'<<24|'S'<<16|'U'<<8|'B'):
4017 if(v->gsub != nil)
4018 break;
4019 v->gsub = calloc(1, sizeof(TableGSUB));
4020 if(read_TableGSUB(o, v->gsub) < 0){
4021 free(v->gsub);
4022 goto err;
4023 }
4024 rec->parsed = v->gsub;
4025 rec->print = (void*)print_TableGSUB;
4026 break;
4027 case (u32int)('M'<<24|'A'<<16|'T'<<8|'H'):
4028 if(v->math != nil)
4029 break;
4030 v->math = calloc(1, sizeof(TableMATH));
4031 if(read_TableMATH(o, v->math) < 0){
4032 free(v->math);
4033 goto err;
4034 }
4035 rec->parsed = v->math;
4036 rec->print = (void*)print_TableMATH;
4037 break;
4038 case (u32int)('k'<<24|'e'<<16|'r'<<8|'n'):
4039 if(v->kern != nil)
4040 break;
4041 v->kern = calloc(1, sizeof(TableKern));
4042 if(read_TableKern(o, v->kern) < 0){
4043 free(v->kern);
4044 goto err;
4045 }
4046 rec->parsed = v->kern;
4047 rec->print = (void*)print_TableKern;
4048 break;
4049 case (u32int)('l'<<24|'o'<<16|'c'<<8|'a'):
4050 {
4051 static int retried = 0;
4052 if(v->head == nil){
4053 if(retried){
4054 werrstr("%s: deps missing", "TableLoca");
4055 goto err;
4056 }
4057 retried = 1;
4058 retry++;
4059 break;
4060 }
4061 if(retried)
4062 retry--;
4063 }
4064 if(v->loca != nil)
4065 break;
4066 v->loca = calloc(1, sizeof(TableLoca));
4067 if(read_TableLoca(o, v->loca) < 0){
4068 free(v->loca);
4069 goto err;
4070 }
4071 rec->parsed = v->loca;
4072 rec->print = (void*)print_TableLoca;
4073 break;
4074 case (u32int)('O'<<24|'S'<<16|'/'<<8|'2'):
4075 if(v->os∕2 != nil)
4076 break;
4077 v->os∕2 = calloc(1, sizeof(TableOS∕2));
4078 if(read_TableOS∕2(o, v->os∕2) < 0){
4079 free(v->os∕2);
4080 goto err;
4081 }
4082 rec->parsed = v->os∕2;
4083 rec->print = (void*)print_TableOS∕2;
4084 break;
3524 }4085 }
3525 rec->parsed = v->hhea;4086 if(otfpoprange(o) < 0)
3526 rec->print = (void*)print_TableHhea;
3527 break;
3528 case (u32int)('m'<<24|'a'<<16|'x'<<8|'p'):
3529 v->maxp = calloc(1, sizeof(TableMaxp));
3530 if(read_TableMaxp(o, v->maxp) < 0){
3531 free(v->maxp);
3532 goto err;4087 goto err;
3533 }
3534 rec->parsed = v->maxp;
3535 rec->print = (void*)print_TableMaxp;
3536 break;
3537 case (u32int)('p'<<24|'o'<<16|'s'<<8|'t'):
3538 v->post = calloc(1, sizeof(TablePost));
3539 if(read_TablePost(o, v->post) < 0){
3540 free(v->post);
3541 goto err;
3542 }
3543 rec->parsed = v->post;
3544 rec->print = (void*)print_TablePost;
3545 break;
3546 case (u32int)('n'<<24|'a'<<16|'m'<<8|'e'):
3547 v->name = calloc(1, sizeof(TableName));
3548 if(read_TableName(o, v->name) < 0){
3549 free(v->name);
3550 goto err;
3551 }
3552 rec->parsed = v->name;
3553 rec->print = (void*)print_TableName;
3554 break;
3555 case (u32int)('E'<<24|'B'<<16|'D'<<8|'T'):
3556 v->ebdt = calloc(1, sizeof(TableEBDT));
3557 if(read_TableEBDT(o, v->ebdt) < 0){
3558 free(v->ebdt);
3559 goto err;
3560 }
3561 rec->parsed = v->ebdt;
3562 rec->print = (void*)print_TableEBDT;
3563 break;
3564 case (u32int)('E'<<24|'B'<<16|'L'<<8|'C'):
3565 v->eblc = calloc(1, sizeof(TableEBLC));
3566 if(read_TableEBLC(o, v->eblc) < 0){
3567 free(v->eblc);
3568 goto err;
3569 }
3570 rec->parsed = v->eblc;
3571 rec->print = (void*)print_TableEBLC;
3572 break;
3573 case (u32int)('G'<<24|'D'<<16|'E'<<8|'F'):
3574 v->gdef = calloc(1, sizeof(TableGDEF));
3575 if(read_TableGDEF(o, v->gdef) < 0){
3576 free(v->gdef);
3577 goto err;
3578 }
3579 rec->parsed = v->gdef;
3580 rec->print = (void*)print_TableGDEF;
3581 break;
3582 case (u32int)('G'<<24|'P'<<16|'O'<<8|'S'):
3583 v->gpos = calloc(1, sizeof(TableGPOS));
3584 if(read_TableGPOS(o, v->gpos) < 0){
3585 free(v->gpos);
3586 goto err;
3587 }
3588 rec->parsed = v->gpos;
3589 rec->print = (void*)print_TableGPOS;
3590 break;
3591 case (u32int)('G'<<24|'S'<<16|'U'<<8|'B'):
3592 v->gsub = calloc(1, sizeof(TableGSUB));
3593 if(read_TableGSUB(o, v->gsub) < 0){
3594 free(v->gsub);
3595 goto err;
3596 }
3597 rec->parsed = v->gsub;
3598 rec->print = (void*)print_TableGSUB;
3599 break;
3600 case (u32int)('M'<<24|'A'<<16|'T'<<8|'H'):
3601 v->math = calloc(1, sizeof(TableMATH));
3602 if(read_TableMATH(o, v->math) < 0){
3603 free(v->math);
3604 goto err;
3605 }
3606 rec->parsed = v->math;
3607 rec->print = (void*)print_TableMATH;
3608 break;
3609 case (u32int)('O'<<24|'S'<<16|'/'<<8|'2'):
3610 v->os∕2 = calloc(1, sizeof(TableOS∕2));
3611 if(read_TableOS∕2(o, v->os∕2) < 0){
3612 free(v->os∕2);
3613 goto err;
3614 }
3615 rec->parsed = v->os∕2;
3616 rec->print = (void*)print_TableOS∕2;
3617 break;
3618 }4088 }
3619 if(otfpoprange(o) < 0)4089 }while(retry > 0);
3620 goto err;
3621 }
3622 return 0;4090 return 0;
3623err:4091err:
3624 werrstr("%s: %r", "TableDirectory");4092 werrstr("%s: %r", "TableDirectory");
@@ -3626,7 +4094,7 @@ err: · 1 unmodified line
3626}4094}
3627 4095
3628void4096void
3629print_TableDirectory(Biobuf *f, int indent, TableDirectory *v)4097print_TableDirectory(Biobuf *f, int indent, Otf *o, TableDirectory *v)
3630{4098{
3631 Bprint(f, "%*s%s: %#ux\n", indent, "", "sfntVersion", v->sfntVersion);4099 Bprint(f, "%*s%s: %#ux\n", indent, "", "sfntVersion", v->sfntVersion);
3632 Bprint(f, "%*s%s: %ud\n", indent, "", "numTables", v->numTables);4100 Bprint(f, "%*s%s: %ud\n", indent, "", "numTables", v->numTables);
@@ -3635,8 +4103,9 @@ print_TableDirectory(Biobuf *f, int indent, TableDirectory *v) · 2 unmodified lines
3635 Bprint(f, "%*s%s: %ud\n", indent, "", "rangeShift", v->rangeShift);4103 Bprint(f, "%*s%s: %ud\n", indent, "", "rangeShift", v->rangeShift);
3636 for(int i = 0; i < v->numTables; i++){4104 for(int i = 0; i < v->numTables; i++){
3637 Bprint(f, "%*s%s[%d]:\n", indent, "", "tableRecords", i);4105 Bprint(f, "%*s%s[%d]:\n", indent, "", "tableRecords", i);
3638 print_TableRecord(f, indent+indentΔ, &v->tableRecords[i]);4106 print_TableRecord(f, indent+indentΔ, o, &v->tableRecords[i]);
3639 }4107 }
4108 USED(o);
3640}4109}
3641 4110
3642int indentΔ = 2;4111int indentΔ = 2;
otf.h+171−84
@@ -23,6 +23,7 @@ typedef struct TableHead TableHead; · 22 unmodified lines
23typedef struct TableHhea TableHhea;23typedef struct TableHhea TableHhea;
24typedef struct LongHorMetric LongHorMetric;24typedef struct LongHorMetric LongHorMetric;
25typedef struct TableMaxp TableMaxp;25typedef struct TableMaxp TableMaxp;
26typedef struct TableHmtx TableHmtx;
26typedef struct TablePost TablePost;27typedef struct TablePost TablePost;
27typedef struct NameRecord NameRecord;28typedef struct NameRecord NameRecord;
28typedef struct LangTagRecord LangTagRecord;29typedef struct LangTagRecord LangTagRecord;
@@ -79,6 +80,13 @@ typedef struct GlyphPart GlyphPart; · 50 unmodified lines
79typedef struct GlyphAssembly GlyphAssembly;80typedef struct GlyphAssembly GlyphAssembly;
80typedef struct MathGlyphConstruction MathGlyphConstruction;81typedef struct MathGlyphConstruction MathGlyphConstruction;
81typedef struct TableMATH TableMATH;82typedef struct TableMATH TableMATH;
83typedef struct KernPair KernPair;
84typedef struct KernSubtable0 KernSubtable0;
85typedef struct KernClass KernClass;
86typedef struct KernSubtable2 KernSubtable2;
87typedef struct KernSubtable KernSubtable;
88typedef struct TableKern TableKern;
89typedef struct TableLoca TableLoca;
82typedef struct TableOS∕2 TableOS∕2;90typedef struct TableOS∕2 TableOS∕2;
83typedef struct TableRecord TableRecord;91typedef struct TableRecord TableRecord;
84typedef struct TableDirectory TableDirectory;92typedef struct TableDirectory TableDirectory;
@@ -91,7 +99,7 @@ struct SubHeader { · 6 unmodified lines
91};99};
92 100
93int read_SubHeader(Otf *o, SubHeader *v);101int read_SubHeader(Otf *o, SubHeader *v);
94void print_SubHeader(Biobuf *f, int indent, SubHeader *v);102void print_SubHeader(Biobuf *f, int indent, Otf *o, SubHeader *v);
95 103
96struct MapGroup {104struct MapGroup {
97 u32int startCharCode;105 u32int startCharCode;
@@ -100,7 +108,7 @@ struct MapGroup { · 2 unmodified lines
100};108};
101 109
102int read_MapGroup(Otf *o, MapGroup *v);110int read_MapGroup(Otf *o, MapGroup *v);
103void print_MapGroup(Biobuf *f, int indent, MapGroup *v);111void print_MapGroup(Biobuf *f, int indent, Otf *o, MapGroup *v);
104 112
105struct SubtableCmap0 {113struct SubtableCmap0 {
106 u16int length;114 u16int length;
@@ -109,7 +117,7 @@ struct SubtableCmap0 { · 2 unmodified lines
109};117};
110 118
111int read_SubtableCmap0(Otf *o, SubtableCmap0 *v);119int read_SubtableCmap0(Otf *o, SubtableCmap0 *v);
112void print_SubtableCmap0(Biobuf *f, int indent, SubtableCmap0 *v);120void print_SubtableCmap0(Biobuf *f, int indent, Otf *o, SubtableCmap0 *v);
113 121
114struct SubtableCmap2 {122struct SubtableCmap2 {
115 u16int length;123 u16int length;
@@ -118,7 +126,7 @@ struct SubtableCmap2 { · 2 unmodified lines
118};126};
119 127
120int read_SubtableCmap2(Otf *o, SubtableCmap2 *v);128int read_SubtableCmap2(Otf *o, SubtableCmap2 *v);
121void print_SubtableCmap2(Biobuf *f, int indent, SubtableCmap2 *v);129void print_SubtableCmap2(Biobuf *f, int indent, Otf *o, SubtableCmap2 *v);
122 130
123struct SubtableCmap4 {131struct SubtableCmap4 {
124 u16int length;132 u16int length;
@@ -135,7 +143,7 @@ struct SubtableCmap4 { · 10 unmodified lines
135};143};
136 144
137int read_SubtableCmap4(Otf *o, SubtableCmap4 *v);145int read_SubtableCmap4(Otf *o, SubtableCmap4 *v);
138void print_SubtableCmap4(Biobuf *f, int indent, SubtableCmap4 *v);146void print_SubtableCmap4(Biobuf *f, int indent, Otf *o, SubtableCmap4 *v);
139 147
140struct SubtableCmap6 {148struct SubtableCmap6 {
141 u16int length;149 u16int length;
@@ -146,7 +154,7 @@ struct SubtableCmap6 { · 4 unmodified lines
146};154};
147 155
148int read_SubtableCmap6(Otf *o, SubtableCmap6 *v);156int read_SubtableCmap6(Otf *o, SubtableCmap6 *v);
149void print_SubtableCmap6(Biobuf *f, int indent, SubtableCmap6 *v);157void print_SubtableCmap6(Biobuf *f, int indent, Otf *o, SubtableCmap6 *v);
150 158
151struct SubtableCmap8 {159struct SubtableCmap8 {
152 u16int length;160 u16int length;
@@ -157,7 +165,7 @@ struct SubtableCmap8 { · 4 unmodified lines
157};165};
158 166
159int read_SubtableCmap8(Otf *o, SubtableCmap8 *v);167int read_SubtableCmap8(Otf *o, SubtableCmap8 *v);
160void print_SubtableCmap8(Biobuf *f, int indent, SubtableCmap8 *v);168void print_SubtableCmap8(Biobuf *f, int indent, Otf *o, SubtableCmap8 *v);
161 169
162struct SubtableCmap10 {170struct SubtableCmap10 {
163 u16int reserved;171 u16int reserved;
@@ -168,7 +176,7 @@ struct SubtableCmap10 { · 4 unmodified lines
168};176};
169 177
170int read_SubtableCmap10(Otf *o, SubtableCmap10 *v);178int read_SubtableCmap10(Otf *o, SubtableCmap10 *v);
171void print_SubtableCmap10(Biobuf *f, int indent, SubtableCmap10 *v);179void print_SubtableCmap10(Biobuf *f, int indent, Otf *o, SubtableCmap10 *v);
172 180
173struct SubtableCmap12or13 {181struct SubtableCmap12or13 {
174 u16int reserved;182 u16int reserved;
@@ -179,7 +187,7 @@ struct SubtableCmap12or13 { · 4 unmodified lines
179};187};
180 188
181int read_SubtableCmap12or13(Otf *o, SubtableCmap12or13 *v);189int read_SubtableCmap12or13(Otf *o, SubtableCmap12or13 *v);
182void print_SubtableCmap12or13(Biobuf *f, int indent, SubtableCmap12or13 *v);190void print_SubtableCmap12or13(Biobuf *f, int indent, Otf *o, SubtableCmap12or13 *v);
183 191
184struct UnicodeRange {192struct UnicodeRange {
185 u32int startUnicodeValue;193 u32int startUnicodeValue;
@@ -187,7 +195,7 @@ struct UnicodeRange { · 1 unmodified line
187};195};
188 196
189int read_UnicodeRange(Otf *o, UnicodeRange *v);197int read_UnicodeRange(Otf *o, UnicodeRange *v);
190void print_UnicodeRange(Biobuf *f, int indent, UnicodeRange *v);198void print_UnicodeRange(Biobuf *f, int indent, Otf *o, UnicodeRange *v);
191 199
192struct DefaultUVS {200struct DefaultUVS {
193 u32int numUnicodeValueRanges;201 u32int numUnicodeValueRanges;
@@ -195,7 +203,7 @@ struct DefaultUVS { · 1 unmodified line
195};203};
196 204
197int read_DefaultUVS(Otf *o, DefaultUVS *v);205int read_DefaultUVS(Otf *o, DefaultUVS *v);
198void print_DefaultUVS(Biobuf *f, int indent, DefaultUVS *v);206void print_DefaultUVS(Biobuf *f, int indent, Otf *o, DefaultUVS *v);
199 207
200struct UVSMapping {208struct UVSMapping {
201 u32int unicodeValue;209 u32int unicodeValue;
@@ -203,7 +211,7 @@ struct UVSMapping { · 1 unmodified line
203};211};
204 212
205int read_UVSMapping(Otf *o, UVSMapping *v);213int read_UVSMapping(Otf *o, UVSMapping *v);
206void print_UVSMapping(Biobuf *f, int indent, UVSMapping *v);214void print_UVSMapping(Biobuf *f, int indent, Otf *o, UVSMapping *v);
207 215
208struct NonDefaultUVS {216struct NonDefaultUVS {
209 u32int numUVSMappings;217 u32int numUVSMappings;
@@ -211,7 +219,7 @@ struct NonDefaultUVS { · 1 unmodified line
211};219};
212 220
213int read_NonDefaultUVS(Otf *o, NonDefaultUVS *v);221int read_NonDefaultUVS(Otf *o, NonDefaultUVS *v);
214void print_NonDefaultUVS(Biobuf *f, int indent, NonDefaultUVS *v);222void print_NonDefaultUVS(Biobuf *f, int indent, Otf *o, NonDefaultUVS *v);
215 223
216struct VariationSelector {224struct VariationSelector {
217 u32int varSelector;225 u32int varSelector;
@@ -222,7 +230,7 @@ struct VariationSelector { · 4 unmodified lines
222};230};
223 231
224int read_VariationSelector(Otf *o, VariationSelector *v);232int read_VariationSelector(Otf *o, VariationSelector *v);
225void print_VariationSelector(Biobuf *f, int indent, VariationSelector *v);233void print_VariationSelector(Biobuf *f, int indent, Otf *o, VariationSelector *v);
226 234
227struct SubtableCmap14 {235struct SubtableCmap14 {
228 u32int length;236 u32int length;
@@ -231,7 +239,7 @@ struct SubtableCmap14 { · 2 unmodified lines
231};239};
232 240
233int read_SubtableCmap14(Otf *o, SubtableCmap14 *v);241int read_SubtableCmap14(Otf *o, SubtableCmap14 *v);
234void print_SubtableCmap14(Biobuf *f, int indent, SubtableCmap14 *v);242void print_SubtableCmap14(Biobuf *f, int indent, Otf *o, SubtableCmap14 *v);
235 243
236struct SubtableCmap {244struct SubtableCmap {
237 u16int format;245 u16int format;
@@ -246,7 +254,7 @@ struct SubtableCmap { · 8 unmodified lines
246};254};
247 255
248int read_SubtableCmap(Otf *o, SubtableCmap *v);256int read_SubtableCmap(Otf *o, SubtableCmap *v);
249void print_SubtableCmap(Biobuf *f, int indent, SubtableCmap *v);257void print_SubtableCmap(Biobuf *f, int indent, Otf *o, SubtableCmap *v);
250 258
251struct EncodingRecord {259struct EncodingRecord {
252 u16int platformID;260 u16int platformID;
@@ -256,7 +264,7 @@ struct EncodingRecord { · 3 unmodified lines
256};264};
257 265
258int read_EncodingRecord(Otf *o, EncodingRecord *v);266int read_EncodingRecord(Otf *o, EncodingRecord *v);
259void print_EncodingRecord(Biobuf *f, int indent, EncodingRecord *v);267void print_EncodingRecord(Biobuf *f, int indent, Otf *o, EncodingRecord *v);
260 268
261struct TableCmap {269struct TableCmap {
262 // u16int version;270 // u16int version;
@@ -265,7 +273,7 @@ struct TableCmap { · 2 unmodified lines
265};273};
266 274
267int read_TableCmap(Otf *o, TableCmap *v);275int read_TableCmap(Otf *o, TableCmap *v);
268void print_TableCmap(Biobuf *f, int indent, TableCmap *v);276void print_TableCmap(Biobuf *f, int indent, Otf *o, TableCmap *v);
269 277
270struct TableHead {278struct TableHead {
271 // u16int majorVersion;279 // u16int majorVersion;
@@ -289,7 +297,7 @@ struct TableHead { · 17 unmodified lines
289};297};
290 298
291int read_TableHead(Otf *o, TableHead *v);299int read_TableHead(Otf *o, TableHead *v);
292void print_TableHead(Biobuf *f, int indent, TableHead *v);300void print_TableHead(Biobuf *f, int indent, Otf *o, TableHead *v);
293 301
294struct TableHhea {302struct TableHhea {
295 u16int majorVersion;303 u16int majorVersion;
@@ -310,7 +318,7 @@ struct TableHhea { · 14 unmodified lines
310};318};
311 319
312int read_TableHhea(Otf *o, TableHhea *v);320int read_TableHhea(Otf *o, TableHhea *v);
313void print_TableHhea(Biobuf *f, int indent, TableHhea *v);321void print_TableHhea(Biobuf *f, int indent, Otf *o, TableHhea *v);
314 322
315struct LongHorMetric {323struct LongHorMetric {
316 u16int advanceWidth;324 u16int advanceWidth;
@@ -318,7 +326,7 @@ struct LongHorMetric { · 1 unmodified line
318};326};
319 327
320int read_LongHorMetric(Otf *o, LongHorMetric *v);328int read_LongHorMetric(Otf *o, LongHorMetric *v);
321void print_LongHorMetric(Biobuf *f, int indent, LongHorMetric *v);329void print_LongHorMetric(Biobuf *f, int indent, Otf *o, LongHorMetric *v);
322 330
323struct TableMaxp {331struct TableMaxp {
324 // u32int version;332 // u32int version;
@@ -326,7 +334,15 @@ struct TableMaxp { · 1 unmodified line
326};334};
327 335
328int read_TableMaxp(Otf *o, TableMaxp *v);336int read_TableMaxp(Otf *o, TableMaxp *v);
329void print_TableMaxp(Biobuf *f, int indent, TableMaxp *v);337void print_TableMaxp(Biobuf *f, int indent, Otf *o, TableMaxp *v);
338
339struct TableHmtx {
340 LongHorMetric *hMetrics;
341 s16int *leftSideBearings;
342};
343
344int read_TableHmtx(Otf *o, TableHmtx *v);
345void print_TableHmtx(Biobuf *f, int indent, Otf *o, TableHmtx *v);
330 346
331struct TablePost {347struct TablePost {
332 // u32int version;348 // u32int version;
@@ -337,7 +353,7 @@ struct TablePost { · 4 unmodified lines
337};353};
338 354
339int read_TablePost(Otf *o, TablePost *v);355int read_TablePost(Otf *o, TablePost *v);
340void print_TablePost(Biobuf *f, int indent, TablePost *v);356void print_TablePost(Biobuf *f, int indent, Otf *o, TablePost *v);
341 357
342struct NameRecord {358struct NameRecord {
343 u16int platformID;359 u16int platformID;
@@ -349,7 +365,7 @@ struct NameRecord { · 5 unmodified lines
349};365};
350 366
351int read_NameRecord(Otf *o, NameRecord *v);367int read_NameRecord(Otf *o, NameRecord *v);
352void print_NameRecord(Biobuf *f, int indent, NameRecord *v);368void print_NameRecord(Biobuf *f, int indent, Otf *o, NameRecord *v);
353 369
354struct LangTagRecord {370struct LangTagRecord {
355 u16int length;371 u16int length;
@@ -357,7 +373,7 @@ struct LangTagRecord { · 1 unmodified line
357};373};
358 374
359int read_LangTagRecord(Otf *o, LangTagRecord *v);375int read_LangTagRecord(Otf *o, LangTagRecord *v);
360void print_LangTagRecord(Biobuf *f, int indent, LangTagRecord *v);376void print_LangTagRecord(Biobuf *f, int indent, Otf *o, LangTagRecord *v);
361 377
362struct TableName {378struct TableName {
363 u16int version;379 u16int version;
@@ -369,7 +385,7 @@ struct TableName { · 5 unmodified lines
369};385};
370 386
371int read_TableName(Otf *o, TableName *v);387int read_TableName(Otf *o, TableName *v);
372void print_TableName(Biobuf *f, int indent, TableName *v);388void print_TableName(Biobuf *f, int indent, Otf *o, TableName *v);
373 389
374struct BigGlyphMetrics {390struct BigGlyphMetrics {
375 u8int height;391 u8int height;
@@ -383,7 +399,7 @@ struct BigGlyphMetrics { · 7 unmodified lines
383};399};
384 400
385int read_BigGlyphMetrics(Otf *o, BigGlyphMetrics *v);401int read_BigGlyphMetrics(Otf *o, BigGlyphMetrics *v);
386void print_BigGlyphMetrics(Biobuf *f, int indent, BigGlyphMetrics *v);402void print_BigGlyphMetrics(Biobuf *f, int indent, Otf *o, BigGlyphMetrics *v);
387 403
388struct SmallGlyphMetrics {404struct SmallGlyphMetrics {
389 u8int height;405 u8int height;
@@ -394,7 +410,7 @@ struct SmallGlyphMetrics { · 4 unmodified lines
394};410};
395 411
396int read_SmallGlyphMetrics(Otf *o, SmallGlyphMetrics *v);412int read_SmallGlyphMetrics(Otf *o, SmallGlyphMetrics *v);
397void print_SmallGlyphMetrics(Biobuf *f, int indent, SmallGlyphMetrics *v);413void print_SmallGlyphMetrics(Biobuf *f, int indent, Otf *o, SmallGlyphMetrics *v);
398 414
399struct SbitLineMetrics {415struct SbitLineMetrics {
400 s8int ascender;416 s8int ascender;
@@ -411,14 +427,14 @@ struct SbitLineMetrics { · 10 unmodified lines
411};427};
412 428
413int read_SbitLineMetrics(Otf *o, SbitLineMetrics *v);429int read_SbitLineMetrics(Otf *o, SbitLineMetrics *v);
414void print_SbitLineMetrics(Biobuf *f, int indent, SbitLineMetrics *v);430void print_SbitLineMetrics(Biobuf *f, int indent, Otf *o, SbitLineMetrics *v);
415 431
416struct IndexSubtable1 {432struct IndexSubtable1 {
417 u32int sbitOffsets;433 u32int *sbitOffsets;
418};434};
419 435
420int read_IndexSubtable1(Otf *o, IndexSubtable1 *v);436int read_IndexSubtable1(Otf *o, IndexSubtable1 *v);
421void print_IndexSubtable1(Biobuf *f, int indent, IndexSubtable1 *v);437void print_IndexSubtable1(Biobuf *f, int indent, Otf *o, IndexSubtable1 *v);
422 438
423struct IndexSubtable2 {439struct IndexSubtable2 {
424 u32int imageSize;440 u32int imageSize;
@@ -426,14 +442,14 @@ struct IndexSubtable2 { · 1 unmodified line
426};442};
427 443
428int read_IndexSubtable2(Otf *o, IndexSubtable2 *v);444int read_IndexSubtable2(Otf *o, IndexSubtable2 *v);
429void print_IndexSubtable2(Biobuf *f, int indent, IndexSubtable2 *v);445void print_IndexSubtable2(Biobuf *f, int indent, Otf *o, IndexSubtable2 *v);
430 446
431struct IndexSubtable3 {447struct IndexSubtable3 {
432 u16int sbitOffsets;448 u16int *sbitOffsets;
433};449};
434 450
435int read_IndexSubtable3(Otf *o, IndexSubtable3 *v);451int read_IndexSubtable3(Otf *o, IndexSubtable3 *v);
436void print_IndexSubtable3(Biobuf *f, int indent, IndexSubtable3 *v);452void print_IndexSubtable3(Biobuf *f, int indent, Otf *o, IndexSubtable3 *v);
437 453
438struct GlyphIdOffsetPair {454struct GlyphIdOffsetPair {
439 u16int glyphID;455 u16int glyphID;
@@ -441,7 +457,7 @@ struct GlyphIdOffsetPair { · 1 unmodified line
441};457};
442 458
443int read_GlyphIdOffsetPair(Otf *o, GlyphIdOffsetPair *v);459int read_GlyphIdOffsetPair(Otf *o, GlyphIdOffsetPair *v);
444void print_GlyphIdOffsetPair(Biobuf *f, int indent, GlyphIdOffsetPair *v);460void print_GlyphIdOffsetPair(Biobuf *f, int indent, Otf *o, GlyphIdOffsetPair *v);
445 461
446struct IndexSubtable4 {462struct IndexSubtable4 {
447 u32int numGlyphs;463 u32int numGlyphs;
@@ -449,7 +465,7 @@ struct IndexSubtable4 { · 1 unmodified line
449};465};
450 466
451int read_IndexSubtable4(Otf *o, IndexSubtable4 *v);467int read_IndexSubtable4(Otf *o, IndexSubtable4 *v);
452void print_IndexSubtable4(Biobuf *f, int indent, IndexSubtable4 *v);468void print_IndexSubtable4(Biobuf *f, int indent, Otf *o, IndexSubtable4 *v);
453 469
454struct IndexSubtable5 {470struct IndexSubtable5 {
455 u32int imageSize;471 u32int imageSize;
@@ -459,7 +475,7 @@ struct IndexSubtable5 { · 3 unmodified lines
459};475};
460 476
461int read_IndexSubtable5(Otf *o, IndexSubtable5 *v);477int read_IndexSubtable5(Otf *o, IndexSubtable5 *v);
462void print_IndexSubtable5(Biobuf *f, int indent, IndexSubtable5 *v);478void print_IndexSubtable5(Biobuf *f, int indent, Otf *o, IndexSubtable5 *v);
463 479
464struct IndexSubtable {480struct IndexSubtable {
465 u16int indexFormat;481 u16int indexFormat;
@@ -473,7 +489,7 @@ struct IndexSubtable { · 7 unmodified lines
473};489};
474 490
475int read_IndexSubtable(Otf *o, IndexSubtable *v);491int read_IndexSubtable(Otf *o, IndexSubtable *v);
476void print_IndexSubtable(Biobuf *f, int indent, IndexSubtable *v);492void print_IndexSubtable(Biobuf *f, int indent, Otf *o, IndexSubtable *v);
477 493
478struct IndexSubtableRecord {494struct IndexSubtableRecord {
479 u16int firstGlyphIndex;495 u16int firstGlyphIndex;
@@ -483,7 +499,7 @@ struct IndexSubtableRecord { · 3 unmodified lines
483};499};
484 500
485int read_IndexSubtableRecord(Otf *o, IndexSubtableRecord *v);501int read_IndexSubtableRecord(Otf *o, IndexSubtableRecord *v);
486void print_IndexSubtableRecord(Biobuf *f, int indent, IndexSubtableRecord *v);502void print_IndexSubtableRecord(Biobuf *f, int indent, Otf *o, IndexSubtableRecord *v);
487 503
488struct BitmapSize {504struct BitmapSize {
489 u32int indexSubtableListOffset;505 u32int indexSubtableListOffset;
@@ -502,7 +518,7 @@ struct BitmapSize { · 12 unmodified lines
502};518};
503 519
504int read_BitmapSize(Otf *o, BitmapSize *v);520int read_BitmapSize(Otf *o, BitmapSize *v);
505void print_BitmapSize(Biobuf *f, int indent, BitmapSize *v);521void print_BitmapSize(Biobuf *f, int indent, Otf *o, BitmapSize *v);
506 522
507struct TableEBDT {523struct TableEBDT {
508 u16int majorVersion;524 u16int majorVersion;
@@ -510,7 +526,7 @@ struct TableEBDT { · 1 unmodified line
510};526};
511 527
512int read_TableEBDT(Otf *o, TableEBDT *v);528int read_TableEBDT(Otf *o, TableEBDT *v);
513void print_TableEBDT(Biobuf *f, int indent, TableEBDT *v);529void print_TableEBDT(Biobuf *f, int indent, Otf *o, TableEBDT *v);
514 530
515struct TableEBLC {531struct TableEBLC {
516 // u16int majorVersion;532 // u16int majorVersion;
@@ -520,7 +536,7 @@ struct TableEBLC { · 3 unmodified lines
520};536};
521 537
522int read_TableEBLC(Otf *o, TableEBLC *v);538int read_TableEBLC(Otf *o, TableEBLC *v);
523void print_TableEBLC(Biobuf *f, int indent, TableEBLC *v);539void print_TableEBLC(Biobuf *f, int indent, Otf *o, TableEBLC *v);
524 540
525struct AttachList {541struct AttachList {
526 u16int coverageOffset;542 u16int coverageOffset;
@@ -529,7 +545,7 @@ struct AttachList { · 2 unmodified lines
529};545};
530 546
531int read_AttachList(Otf *o, AttachList *v);547int read_AttachList(Otf *o, AttachList *v);
532void print_AttachList(Biobuf *f, int indent, AttachList *v);548void print_AttachList(Biobuf *f, int indent, Otf *o, AttachList *v);
533 549
534struct AttachPoint {550struct AttachPoint {
535 u16int pointCount;551 u16int pointCount;
@@ -537,7 +553,7 @@ struct AttachPoint { · 1 unmodified line
537};553};
538 554
539int read_AttachPoint(Otf *o, AttachPoint *v);555int read_AttachPoint(Otf *o, AttachPoint *v);
540void print_AttachPoint(Biobuf *f, int indent, AttachPoint *v);556void print_AttachPoint(Biobuf *f, int indent, Otf *o, AttachPoint *v);
541 557
542struct LigCaretList {558struct LigCaretList {
543 u16int coverageOffset;559 u16int coverageOffset;
@@ -546,7 +562,7 @@ struct LigCaretList { · 2 unmodified lines
546};562};
547 563
548int read_LigCaretList(Otf *o, LigCaretList *v);564int read_LigCaretList(Otf *o, LigCaretList *v);
549void print_LigCaretList(Biobuf *f, int indent, LigCaretList *v);565void print_LigCaretList(Biobuf *f, int indent, Otf *o, LigCaretList *v);
550 566
551struct LigGlyph {567struct LigGlyph {
552 u16int caretCount;568 u16int caretCount;
@@ -554,7 +570,7 @@ struct LigGlyph { · 1 unmodified line
554};570};
555 571
556int read_LigGlyph(Otf *o, LigGlyph *v);572int read_LigGlyph(Otf *o, LigGlyph *v);
557void print_LigGlyph(Biobuf *f, int indent, LigGlyph *v);573void print_LigGlyph(Biobuf *f, int indent, Otf *o, LigGlyph *v);
558 574
559struct CaretValue {575struct CaretValue {
560 u16int format;576 u16int format;
@@ -564,7 +580,7 @@ struct CaretValue { · 3 unmodified lines
564};580};
565 581
566int read_CaretValue(Otf *o, CaretValue *v);582int read_CaretValue(Otf *o, CaretValue *v);
567void print_CaretValue(Biobuf *f, int indent, CaretValue *v);583void print_CaretValue(Biobuf *f, int indent, Otf *o, CaretValue *v);
568 584
569struct ValueRecord {585struct ValueRecord {
570 s16int xPlacement;586 s16int xPlacement;
@@ -578,7 +594,7 @@ struct ValueRecord { · 7 unmodified lines
578};594};
579 595
580int read_ValueRecord(Otf *o, ValueRecord *v);596int read_ValueRecord(Otf *o, ValueRecord *v);
581void print_ValueRecord(Biobuf *f, int indent, ValueRecord *v);597void print_ValueRecord(Biobuf *f, int indent, Otf *o, ValueRecord *v);
582 598
583struct SinglePos {599struct SinglePos {
584 u16int format;600 u16int format;
@@ -590,7 +606,7 @@ struct SinglePos { · 5 unmodified lines
590};606};
591 607
592int read_SinglePos(Otf *o, SinglePos *v);608int read_SinglePos(Otf *o, SinglePos *v);
593void print_SinglePos(Biobuf *f, int indent, SinglePos *v);609void print_SinglePos(Biobuf *f, int indent, Otf *o, SinglePos *v);
594 610
595struct TableGDEF {611struct TableGDEF {
596 // u16int majorVersion;612 // u16int majorVersion;
@@ -604,7 +620,7 @@ struct TableGDEF { · 7 unmodified lines
604};620};
605 621
606int read_TableGDEF(Otf *o, TableGDEF *v);622int read_TableGDEF(Otf *o, TableGDEF *v);
607void print_TableGDEF(Biobuf *f, int indent, TableGDEF *v);623void print_TableGDEF(Biobuf *f, int indent, Otf *o, TableGDEF *v);
608 624
609struct LangSys {625struct LangSys {
610 // u16int lookupOrderOffset;626 // u16int lookupOrderOffset;
@@ -614,7 +630,7 @@ struct LangSys { · 3 unmodified lines
614};630};
615 631
616int read_LangSys(Otf *o, LangSys *v);632int read_LangSys(Otf *o, LangSys *v);
617void print_LangSys(Biobuf *f, int indent, LangSys *v);633void print_LangSys(Biobuf *f, int indent, Otf *o, LangSys *v);
618 634
619struct LangSysRecord {635struct LangSysRecord {
620 u32int langSysTag;636 u32int langSysTag;
@@ -623,7 +639,7 @@ struct LangSysRecord { · 2 unmodified lines
623};639};
624 640
625int read_LangSysRecord(Otf *o, LangSysRecord *v);641int read_LangSysRecord(Otf *o, LangSysRecord *v);
626void print_LangSysRecord(Biobuf *f, int indent, LangSysRecord *v);642void print_LangSysRecord(Biobuf *f, int indent, Otf *o, LangSysRecord *v);
627 643
628struct Script {644struct Script {
629 u16int defaultLangSysOffset;645 u16int defaultLangSysOffset;
@@ -633,7 +649,7 @@ struct Script { · 3 unmodified lines
633};649};
634 650
635int read_Script(Otf *o, Script *v);651int read_Script(Otf *o, Script *v);
636void print_Script(Biobuf *f, int indent, Script *v);652void print_Script(Biobuf *f, int indent, Otf *o, Script *v);
637 653
638struct ScriptRecord {654struct ScriptRecord {
639 u32int scriptTag;655 u32int scriptTag;
@@ -642,7 +658,7 @@ struct ScriptRecord { · 2 unmodified lines
642};658};
643 659
644int read_ScriptRecord(Otf *o, ScriptRecord *v);660int read_ScriptRecord(Otf *o, ScriptRecord *v);
645void print_ScriptRecord(Biobuf *f, int indent, ScriptRecord *v);661void print_ScriptRecord(Biobuf *f, int indent, Otf *o, ScriptRecord *v);
646 662
647struct ScriptList {663struct ScriptList {
648 u16int scriptCount;664 u16int scriptCount;
@@ -650,7 +666,7 @@ struct ScriptList { · 1 unmodified line
650};666};
651 667
652int read_ScriptList(Otf *o, ScriptList *v);668int read_ScriptList(Otf *o, ScriptList *v);
653void print_ScriptList(Biobuf *f, int indent, ScriptList *v);669void print_ScriptList(Biobuf *f, int indent, Otf *o, ScriptList *v);
654 670
655struct Feature {671struct Feature {
656 u16int featureParamsOffset;672 u16int featureParamsOffset;
@@ -659,7 +675,7 @@ struct Feature { · 2 unmodified lines
659};675};
660 676
661int read_Feature(Otf *o, Feature *v);677int read_Feature(Otf *o, Feature *v);
662void print_Feature(Biobuf *f, int indent, Feature *v);678void print_Feature(Biobuf *f, int indent, Otf *o, Feature *v);
663 679
664struct FeatureRecord {680struct FeatureRecord {
665 u32int featureTag;681 u32int featureTag;
@@ -668,7 +684,7 @@ struct FeatureRecord { · 2 unmodified lines
668};684};
669 685
670int read_FeatureRecord(Otf *o, FeatureRecord *v);686int read_FeatureRecord(Otf *o, FeatureRecord *v);
671void print_FeatureRecord(Biobuf *f, int indent, FeatureRecord *v);687void print_FeatureRecord(Biobuf *f, int indent, Otf *o, FeatureRecord *v);
672 688
673struct FeatureList {689struct FeatureList {
674 u16int featureCount;690 u16int featureCount;
@@ -676,7 +692,7 @@ struct FeatureList { · 1 unmodified line
676};692};
677 693
678int read_FeatureList(Otf *o, FeatureList *v);694int read_FeatureList(Otf *o, FeatureList *v);
679void print_FeatureList(Biobuf *f, int indent, FeatureList *v);695void print_FeatureList(Biobuf *f, int indent, Otf *o, FeatureList *v);
680 696
681struct Lookup {697struct Lookup {
682 u16int lookupType;698 u16int lookupType;
@@ -687,7 +703,7 @@ struct Lookup { · 4 unmodified lines
687};703};
688 704
689int read_Lookup(Otf *o, Lookup *v);705int read_Lookup(Otf *o, Lookup *v);
690void print_Lookup(Biobuf *f, int indent, Lookup *v);706void print_Lookup(Biobuf *f, int indent, Otf *o, Lookup *v);
691 707
692struct LookupList {708struct LookupList {
693 u16int lookupCount;709 u16int lookupCount;
@@ -695,7 +711,7 @@ struct LookupList { · 1 unmodified line
695};711};
696 712
697int read_LookupList(Otf *o, LookupList *v);713int read_LookupList(Otf *o, LookupList *v);
698void print_LookupList(Biobuf *f, int indent, LookupList *v);714void print_LookupList(Biobuf *f, int indent, Otf *o, LookupList *v);
699 715
700struct TableGPOS {716struct TableGPOS {
701 // u16int majorVersion;717 // u16int majorVersion;
@@ -710,7 +726,7 @@ struct TableGPOS { · 8 unmodified lines
710};726};
711 727
712int read_TableGPOS(Otf *o, TableGPOS *v);728int read_TableGPOS(Otf *o, TableGPOS *v);
713void print_TableGPOS(Biobuf *f, int indent, TableGPOS *v);729void print_TableGPOS(Biobuf *f, int indent, Otf *o, TableGPOS *v);
714 730
715struct TableGSUB {731struct TableGSUB {
716 // u16int majorVersion;732 // u16int majorVersion;
@@ -724,7 +740,7 @@ struct TableGSUB { · 7 unmodified lines
724};740};
725 741
726int read_TableGSUB(Otf *o, TableGSUB *v);742int read_TableGSUB(Otf *o, TableGSUB *v);
727void print_TableGSUB(Biobuf *f, int indent, TableGSUB *v);743void print_TableGSUB(Biobuf *f, int indent, Otf *o, TableGSUB *v);
728 744
729struct MathValueRecord {745struct MathValueRecord {
730 s16int value;746 s16int value;
@@ -732,7 +748,7 @@ struct MathValueRecord { · 1 unmodified line
732};748};
733 749
734int read_MathValueRecord(Otf *o, MathValueRecord *v);750int read_MathValueRecord(Otf *o, MathValueRecord *v);
735void print_MathValueRecord(Biobuf *f, int indent, MathValueRecord *v);751void print_MathValueRecord(Biobuf *f, int indent, Otf *o, MathValueRecord *v);
736 752
737struct MathConstants {753struct MathConstants {
738 s16int scriptPercentScaleDown;754 s16int scriptPercentScaleDown;
@@ -794,7 +810,7 @@ struct MathConstants { · 55 unmodified lines
794};810};
795 811
796int read_MathConstants(Otf *o, MathConstants *v);812int read_MathConstants(Otf *o, MathConstants *v);
797void print_MathConstants(Biobuf *f, int indent, MathConstants *v);813void print_MathConstants(Biobuf *f, int indent, Otf *o, MathConstants *v);
798 814
799struct MathItalicsCorrectionInfo {815struct MathItalicsCorrectionInfo {
800 u16int italicsCorrectionCoverageOffset;816 u16int italicsCorrectionCoverageOffset;
@@ -803,7 +819,7 @@ struct MathItalicsCorrectionInfo { · 2 unmodified lines
803};819};
804 820
805int read_MathItalicsCorrectionInfo(Otf *o, MathItalicsCorrectionInfo *v);821int read_MathItalicsCorrectionInfo(Otf *o, MathItalicsCorrectionInfo *v);
806void print_MathItalicsCorrectionInfo(Biobuf *f, int indent, MathItalicsCorrectionInfo *v);822void print_MathItalicsCorrectionInfo(Biobuf *f, int indent, Otf *o, MathItalicsCorrectionInfo *v);
807 823
808struct MathTopAccentAttachment {824struct MathTopAccentAttachment {
809 u16int topAccentCoverageOffset;825 u16int topAccentCoverageOffset;
@@ -812,7 +828,7 @@ struct MathTopAccentAttachment { · 2 unmodified lines
812};828};
813 829
814int read_MathTopAccentAttachment(Otf *o, MathTopAccentAttachment *v);830int read_MathTopAccentAttachment(Otf *o, MathTopAccentAttachment *v);
815void print_MathTopAccentAttachment(Biobuf *f, int indent, MathTopAccentAttachment *v);831void print_MathTopAccentAttachment(Biobuf *f, int indent, Otf *o, MathTopAccentAttachment *v);
816 832
817struct MathKernInfoRecord {833struct MathKernInfoRecord {
818 u16int topRightMathKernOffset;834 u16int topRightMathKernOffset;
@@ -822,7 +838,7 @@ struct MathKernInfoRecord { · 3 unmodified lines
822};838};
823 839
824int read_MathKernInfoRecord(Otf *o, MathKernInfoRecord *v);840int read_MathKernInfoRecord(Otf *o, MathKernInfoRecord *v);
825void print_MathKernInfoRecord(Biobuf *f, int indent, MathKernInfoRecord *v);841void print_MathKernInfoRecord(Biobuf *f, int indent, Otf *o, MathKernInfoRecord *v);
826 842
827struct MathKernInfo {843struct MathKernInfo {
828 u16int mathKernCoverageOffset;844 u16int mathKernCoverageOffset;
@@ -831,7 +847,7 @@ struct MathKernInfo { · 2 unmodified lines
831};847};
832 848
833int read_MathKernInfo(Otf *o, MathKernInfo *v);849int read_MathKernInfo(Otf *o, MathKernInfo *v);
834void print_MathKernInfo(Biobuf *f, int indent, MathKernInfo *v);850void print_MathKernInfo(Biobuf *f, int indent, Otf *o, MathKernInfo *v);
835 851
836struct MathKern {852struct MathKern {
837 u16int heightCount;853 u16int heightCount;
@@ -840,7 +856,7 @@ struct MathKern { · 2 unmodified lines
840};856};
841 857
842int read_MathKern(Otf *o, MathKern *v);858int read_MathKern(Otf *o, MathKern *v);
843void print_MathKern(Biobuf *f, int indent, MathKern *v);859void print_MathKern(Biobuf *f, int indent, Otf *o, MathKern *v);
844 860
845struct Coverage1 {861struct Coverage1 {
846 u16int glyphCount;862 u16int glyphCount;
@@ -848,7 +864,7 @@ struct Coverage1 { · 1 unmodified line
848};864};
849 865
850int read_Coverage1(Otf *o, Coverage1 *v);866int read_Coverage1(Otf *o, Coverage1 *v);
851void print_Coverage1(Biobuf *f, int indent, Coverage1 *v);867void print_Coverage1(Biobuf *f, int indent, Otf *o, Coverage1 *v);
852 868
853struct RangeRecord {869struct RangeRecord {
854 u16int startGlyphID;870 u16int startGlyphID;
@@ -857,7 +873,7 @@ struct RangeRecord { · 2 unmodified lines
857};873};
858 874
859int read_RangeRecord(Otf *o, RangeRecord *v);875int read_RangeRecord(Otf *o, RangeRecord *v);
860void print_RangeRecord(Biobuf *f, int indent, RangeRecord *v);876void print_RangeRecord(Biobuf *f, int indent, Otf *o, RangeRecord *v);
861 877
862struct Coverage2 {878struct Coverage2 {
863 u16int rangeCount;879 u16int rangeCount;
@@ -865,7 +881,7 @@ struct Coverage2 { · 1 unmodified line
865};881};
866 882
867int read_Coverage2(Otf *o, Coverage2 *v);883int read_Coverage2(Otf *o, Coverage2 *v);
868void print_Coverage2(Biobuf *f, int indent, Coverage2 *v);884void print_Coverage2(Biobuf *f, int indent, Otf *o, Coverage2 *v);
869 885
870struct Coverage {886struct Coverage {
871 u16int format;887 u16int format;
@@ -874,7 +890,7 @@ struct Coverage { · 2 unmodified lines
874};890};
875 891
876int read_Coverage(Otf *o, Coverage *v);892int read_Coverage(Otf *o, Coverage *v);
877void print_Coverage(Biobuf *f, int indent, Coverage *v);893void print_Coverage(Biobuf *f, int indent, Otf *o, Coverage *v);
878 894
879struct MathVariants {895struct MathVariants {
880 u16int minConnectorOverlap;896 u16int minConnectorOverlap;
@@ -889,7 +905,7 @@ struct MathVariants { · 8 unmodified lines
889};905};
890 906
891int read_MathVariants(Otf *o, MathVariants *v);907int read_MathVariants(Otf *o, MathVariants *v);
892void print_MathVariants(Biobuf *f, int indent, MathVariants *v);908void print_MathVariants(Biobuf *f, int indent, Otf *o, MathVariants *v);
893 909
894struct MathGlyphInfo {910struct MathGlyphInfo {
895 u16int mathItalicsCorrectionInfoOffset;911 u16int mathItalicsCorrectionInfoOffset;
@@ -903,7 +919,7 @@ struct MathGlyphInfo { · 7 unmodified lines
903};919};
904 920
905int read_MathGlyphInfo(Otf *o, MathGlyphInfo *v);921int read_MathGlyphInfo(Otf *o, MathGlyphInfo *v);
906void print_MathGlyphInfo(Biobuf *f, int indent, MathGlyphInfo *v);922void print_MathGlyphInfo(Biobuf *f, int indent, Otf *o, MathGlyphInfo *v);
907 923
908struct MathGlyphVariantRecord {924struct MathGlyphVariantRecord {
909 u16int variantGlyph;925 u16int variantGlyph;
@@ -911,7 +927,7 @@ struct MathGlyphVariantRecord { · 1 unmodified line
911};927};
912 928
913int read_MathGlyphVariantRecord(Otf *o, MathGlyphVariantRecord *v);929int read_MathGlyphVariantRecord(Otf *o, MathGlyphVariantRecord *v);
914void print_MathGlyphVariantRecord(Biobuf *f, int indent, MathGlyphVariantRecord *v);930void print_MathGlyphVariantRecord(Biobuf *f, int indent, Otf *o, MathGlyphVariantRecord *v);
915 931
916struct GlyphPart {932struct GlyphPart {
917 u16int glyphID;933 u16int glyphID;
@@ -922,7 +938,7 @@ struct GlyphPart { · 4 unmodified lines
922};938};
923 939
924int read_GlyphPart(Otf *o, GlyphPart *v);940int read_GlyphPart(Otf *o, GlyphPart *v);
925void print_GlyphPart(Biobuf *f, int indent, GlyphPart *v);941void print_GlyphPart(Biobuf *f, int indent, Otf *o, GlyphPart *v);
926 942
927struct GlyphAssembly {943struct GlyphAssembly {
928 MathValueRecord italicsCorrection;944 MathValueRecord italicsCorrection;
@@ -931,7 +947,7 @@ struct GlyphAssembly { · 2 unmodified lines
931};947};
932 948
933int read_GlyphAssembly(Otf *o, GlyphAssembly *v);949int read_GlyphAssembly(Otf *o, GlyphAssembly *v);
934void print_GlyphAssembly(Biobuf *f, int indent, GlyphAssembly *v);950void print_GlyphAssembly(Biobuf *f, int indent, Otf *o, GlyphAssembly *v);
935 951
936struct MathGlyphConstruction {952struct MathGlyphConstruction {
937 u16int glyphAssemblyOffset;953 u16int glyphAssemblyOffset;
@@ -941,7 +957,7 @@ struct MathGlyphConstruction { · 3 unmodified lines
941};957};
942 958
943int read_MathGlyphConstruction(Otf *o, MathGlyphConstruction *v);959int read_MathGlyphConstruction(Otf *o, MathGlyphConstruction *v);
944void print_MathGlyphConstruction(Biobuf *f, int indent, MathGlyphConstruction *v);960void print_MathGlyphConstruction(Biobuf *f, int indent, Otf *o, MathGlyphConstruction *v);
945 961
946struct TableMATH {962struct TableMATH {
947 // u16int majorVersion;963 // u16int majorVersion;
@@ -955,7 +971,75 @@ struct TableMATH { · 7 unmodified lines
955};971};
956 972
957int read_TableMATH(Otf *o, TableMATH *v);973int read_TableMATH(Otf *o, TableMATH *v);
958void print_TableMATH(Biobuf *f, int indent, TableMATH *v);974void print_TableMATH(Biobuf *f, int indent, Otf *o, TableMATH *v);
975
976struct KernPair {
977 u16int left;
978 u16int right;
979 s16int value;
980};
981
982int read_KernPair(Otf *o, KernPair *v);
983void print_KernPair(Biobuf *f, int indent, Otf *o, KernPair *v);
984
985struct KernSubtable0 {
986 u16int nPairs;
987 u16int searchRange;
988 u16int entrySelector;
989 u16int rangeShift;
990 KernPair *kernPairs;
991};
992
993int read_KernSubtable0(Otf *o, KernSubtable0 *v);
994void print_KernSubtable0(Biobuf *f, int indent, Otf *o, KernSubtable0 *v);
995
996struct KernClass {
997 u16int firstGlyph;
998 u16int nGlyphs;
999 u16int *values;
1000};
1001
1002int read_KernClass(Otf *o, KernClass *v);
1003void print_KernClass(Biobuf *f, int indent, Otf *o, KernClass *v);
1004
1005struct KernSubtable2 {
1006 u16int rowWidth;
1007 u16int leftClassOffset;
1008 u16int rightClassOffset;
1009 u16int kerningArrayOffset;
1010 KernClass *leftClass;
1011 KernClass *rightClass;
1012 s16int *kerningArray;
1013};
1014
1015int read_KernSubtable2(Otf *o, KernSubtable2 *v);
1016void print_KernSubtable2(Biobuf *f, int indent, Otf *o, KernSubtable2 *v);
1017
1018struct KernSubtable {
1019 // u16int version;
1020 u16int length;
1021 u16int coverage;
1022};
1023
1024int read_KernSubtable(Otf *o, KernSubtable *v);
1025void print_KernSubtable(Biobuf *f, int indent, Otf *o, KernSubtable *v);
1026
1027struct TableKern {
1028 // u16int version;
1029 u16int nTables;
1030 KernSubtable *subtables;
1031};
1032
1033int read_TableKern(Otf *o, TableKern *v);
1034void print_TableKern(Biobuf *f, int indent, Otf *o, TableKern *v);
1035
1036struct TableLoca {
1037 u16int *shortOffsets;
1038 u32int *longOffsets;
1039};
1040
1041int read_TableLoca(Otf *o, TableLoca *v);
1042void print_TableLoca(Biobuf *f, int indent, Otf *o, TableLoca *v);
959 1043
960struct TableOS∕2 {1044struct TableOS∕2 {
961 u16int version;1045 u16int version;
@@ -1000,7 +1084,7 @@ struct TableOS∕2 { · 38 unmodified lines
1000};1084};
1001 1085
1002int read_TableOS∕2(Otf *o, TableOS∕2 *v);1086int read_TableOS∕2(Otf *o, TableOS∕2 *v);
1003void print_TableOS∕2(Biobuf *f, int indent, TableOS∕2 *v);1087void print_TableOS∕2(Biobuf *f, int indent, Otf *o, TableOS∕2 *v);
1004 1088
1005struct TableRecord {1089struct TableRecord {
1006 u32int tableTag;1090 u32int tableTag;
@@ -1008,11 +1092,11 @@ struct TableRecord { · 1 unmodified line
1008 u32int offset;1092 u32int offset;
1009 u32int length;1093 u32int length;
1010 void *parsed;1094 void *parsed;
1011 void (*print)(Biobuf *f, int indent, void *parsed);1095 void (*print)(Biobuf *f, int indent, Otf *o, void *parsed);
1012};1096};
1013 1097
1014int read_TableRecord(Otf *o, TableRecord *v);1098int read_TableRecord(Otf *o, TableRecord *v);
1015void print_TableRecord(Biobuf *f, int indent, TableRecord *v);1099void print_TableRecord(Biobuf *f, int indent, Otf *o, TableRecord *v);
1016 1100
1017struct TableDirectory {1101struct TableDirectory {
1018 u32int sfntVersion;1102 u32int sfntVersion;
@@ -1025,6 +1109,7 @@ struct TableDirectory { · 6 unmodified lines
1025 TableHead *head;1109 TableHead *head;
1026 TableHhea *hhea;1110 TableHhea *hhea;
1027 TableMaxp *maxp;1111 TableMaxp *maxp;
1112 TableHmtx *hmtx;
1028 TablePost *post;1113 TablePost *post;
1029 TableName *name;1114 TableName *name;
1030 TableEBDT *ebdt;1115 TableEBDT *ebdt;
@@ -1033,11 +1118,13 @@ struct TableDirectory { · 2 unmodified lines
1033 TableGPOS *gpos;1118 TableGPOS *gpos;
1034 TableGSUB *gsub;1119 TableGSUB *gsub;
1035 TableMATH *math;1120 TableMATH *math;
1121 TableKern *kern;
1122 TableLoca *loca;
1036 TableOS∕2 *os∕2;1123 TableOS∕2 *os∕2;
1037};1124};
1038 1125
1039int read_TableDirectory(Otf *o, TableDirectory *v);1126int read_TableDirectory(Otf *o, TableDirectory *v);
1040void print_TableDirectory(Biobuf *f, int indent, TableDirectory *v);1127void print_TableDirectory(Biobuf *f, int indent, Otf *o, TableDirectory *v);
1041 1128
1042extern int indentΔ;1129extern int indentΔ;
1043 1130
otf.rkt+101−42
@@ -159,7 +159,7 @@ · 158 unmodified lines
159 {uint16 macStyle}159 {uint16 macStyle}
160 {uint16 lowestRecPPEM}160 {uint16 lowestRecPPEM}
161 {int16 fontDirectionHint unused (>= -2) (<= 2)}161 {int16 fontDirectionHint unused (>= -2) (<= 2)}
162 {int16 indexToLocFormat (<= 1)}162 {int16 indexToLocFormat ->o (<= 1)}
163 {int16 glyphDataFormat unused (== 0)}163 {int16 glyphDataFormat unused (== 0)}
164 #:tag "head")164 #:tag "head")
165 165
@@ -178,24 +178,23 @@ · 12 unmodified lines
178 {int16 caretOffset}178 {int16 caretOffset}
179 {int16 reserved [4] unused}179 {int16 reserved [4] unused}
180 {int16 metricDataFormat (== 0)}180 {int16 metricDataFormat (== 0)}
181 {uint16 numberOfHMetrics}181 {uint16 numberOfHMetrics ->o}
182 #:tag "hhea")182 #:tag "hhea")
183 183
184(mkcmplx LongHorMetric {UFWORD advanceWidth} {FWORD lsb})184(mkcmplx LongHorMetric {UFWORD advanceWidth} {FWORD lsb})
185 185
186#|
187FIXME what. WHAT.
188(mkcmplx TableHmtx
189 {LongHorMetric hMetrics[TableHhea numberOfHMetrics]}
190 {FWORD leftSideBearings[- (TableMaxp numGlyphs) (TableHhea numberOfHMetrics)]})
191|#
192
193(mkcmplx TableMaxp186(mkcmplx TableMaxp
194 {Version16Dot16 version (== #x05000 #x10000) unused}187 {Version16Dot16 version (== #x05000 #x10000) unused}
195 {uint16 numGlyphs}188 {uint16 numGlyphs ->o}
196 ; a bunch of fields ignored here189 ; a bunch of fields ignored here
197 #:tag "maxp")190 #:tag "maxp")
198 191
192(mkcmplx TableHmtx
193 {LongHorMetric hMetrics [+ o->numberOfHMetrics 0]}
194 {FWORD leftSideBearings [- o->numGlyphs o->numberOfHMetrics]}
195 #:tag "hmtx"
196 #:after (list TableHhea TableMaxp))
197
199(mkcmplx TablePost198(mkcmplx TablePost
200 {Version16Dot16 version (== #x10000 #x20000 #x25000 #x30000) unused}199 {Version16Dot16 version (== #x10000 #x20000 #x25000 #x30000) unused}
201 {Fixed italicAngle}200 {Fixed italicAngle}
@@ -254,12 +253,11 @@ FIXME what. WHAT. · 52 unmodified lines
254 {int8 minAfterBL}253 {int8 minAfterBL}
255 {int8 pad [2] unused})254 {int8 pad [2] unused})
256 255
257(mkcmplx IndexSubtable1 {Offset32 sbitOffsets} #;[+ (- lastGlyphIndex firstGlyphIndex) 2])256(mkcmplx IndexSubtable1 {Offset32 sbitOffsets [+ (- o->lastGlyphIndex o->firstGlyphIndex) 2]})
258 257
259(mkcmplx IndexSubtable2 {uint32 imageSize} {BigGlyphMetrics bigMetrics})258(mkcmplx IndexSubtable2 {uint32 imageSize} {BigGlyphMetrics bigMetrics})
260 259
261; FIXME260(mkcmplx IndexSubtable3 {Offset16 sbitOffsets [+ (- o->lastGlyphIndex o->firstGlyphIndex) 2]})
262(mkcmplx IndexSubtable3 {Offset16 sbitOffsets} #;[+ (- lastGlyphIndex firstGlyphIndex) 2])
263 261
264(mkcmplx GlyphIdOffsetPair {uint16 glyphID} {Offset16 sbitOffset})262(mkcmplx GlyphIdOffsetPair {uint16 glyphID} {Offset16 sbitOffset})
265 263
@@ -282,8 +280,8 @@ FIXME what. WHAT. · 16 unmodified lines
282 {IndexSubtable5 sub5 (== indexFormat 5)})280 {IndexSubtable5 sub5 (== indexFormat 5)})
283 281
284(mkcmplx IndexSubtableRecord282(mkcmplx IndexSubtableRecord
285 {uint16 firstGlyphIndex}283 {uint16 firstGlyphIndex ->o}
286 {uint16 lastGlyphIndex}284 {uint16 lastGlyphIndex ->o}
287 {Offset32 indexSubtableOffset}285 {Offset32 indexSubtableOffset}
288 {IndexSubtable indexSubtable (at indexSubtableOffset)})286 {IndexSubtable indexSubtable (at indexSubtableOffset)})
289 287
@@ -569,6 +567,43 @@ FIXME what. WHAT. · 279 unmodified lines
569 {MathVariants mathVariants (at mathVariantsOffset)}567 {MathVariants mathVariants (at mathVariantsOffset)}
570 #:tag "MATH")568 #:tag "MATH")
571 569
570(mkcmplx KernPair {uint16 left} {uint16 right} {FWORD value})
571
572(mkcmplx KernSubtable0
573 {uint16 nPairs}
574 {uint16 searchRange}
575 {uint16 entrySelector}
576 {uint16 rangeShift}
577 {KernPair kernPairs [nPairs]})
578
579(mkcmplx KernClass {uint16 firstGlyph} {uint16 nGlyphs} {uint16 values [nGlyphs]})
580
581(mkcmplx KernSubtable2
582 {uint16 rowWidth}
583 {Offset16 leftClassOffset}
584 {Offset16 rightClassOffset}
585 {Offset16 kerningArrayOffset}
586 {KernClass leftClass (at leftClassOffset)}
587 {KernClass rightClass (at rightClassOffset)}
588 {FWORD kerningArray [/ rowWidth 2]})
589
590(mkcmplx KernSubtable
591 {uint16 version (== 0) unused}
592 {uint16 length (>= 6)} ; including this header
593 {uint16 coverage}) ; FIXME the rest depends on the coverage bits (8-15 = 0 or 2)
594
595(mkcmplx TableKern
596 {uint16 version (== 0) unused}
597 {uint16 nTables}
598 {KernSubtable subtables [nTables]}
599 #:tag "kern")
600
601(mkcmplx TableLoca
602 {Offset16 shortOffsets [+ o->numGlyphs 1] (== o->indexToLocFormat 0)}
603 {Offset32 longOffsets [+ o->numGlyphs 1] (== o->indexToLocFormat 1)}
604 #:tag "loca"
605 #:after (list TableHead))
606
572(mkcmplx TableOS∕2607(mkcmplx TableOS∕2
573 {uint16 version (<= 5)}608 {uint16 version (<= 5)}
574 {FWORD xAvgCharWidth}609 {FWORD xAvgCharWidth}
@@ -616,12 +651,13 @@ FIXME what. WHAT. · 41 unmodified lines
616 {uint32 checksum unused hex}651 {uint32 checksum unused hex}
617 {Offset32 offset}652 {Offset32 offset}
618 {uint32 length}653 {uint32 length}
619 #:extra (list (cons 'field654 #:extra
620 (list (~a "void *parsed;")655 (list (cons 'field
621 (~a "void (*print)(Biobuf *f, int indent, void *parsed);")))656 (list (~a "void *parsed;")
622 (cons 'print657 (~a "void (*print)(Biobuf *f, int indent, Otf *o, void *parsed);")))
623 (list (~a "if(v->print != nil && v->parsed != nil)")658 (cons 'print
624 (~a "\tv->print(f, indent+indentΔ, v->parsed);")))))659 (list (~a "if(v->print != nil && v->parsed != nil)")
660 (~a " v->print(f, indent+indentΔ, o, v->parsed);")))))
625 661
626(define (c-friendly-name t)662(define (c-friendly-name t)
627 (string-replace (string-trim (string-downcase t)) "/" "∕"))663 (string-replace (string-trim (string-downcase t)) "/" "∕"))
@@ -634,29 +670,52 @@ FIXME what. WHAT. · 6 unmodified lines
634 (define (ft t i)670 (define (ft t i)
635 (~a "'" (string-ref t i) "'" (if (< i 3) (~a "<<" (* 8 (- 3 i))) "")))671 (~a "'" (string-ref t i) "'" (if (< i 3) (~a "<<" (* 8 (- 3 i))) "")))
636 (define case-tag (~a "(u32int)(" (string-join (map (λ (i) (ft tag i)) (range 4)) "|") ")"))672 (define case-tag (~a "(u32int)(" (string-join (map (λ (i) (ft tag i)) (range 4)) "|") ")"))
637 (list (~a "\tcase " case-tag ":")673 (define after (cmplx-after c))
638 (~a "\t\tv->" (ptr c) " = calloc(1, sizeof(" (cmplx-name c) "));")674 (define if-ready (string-join (map (λ (ac) (~a "v->" (ptr ac) " == nil")) after) " || "))
639 (~a "\t\tif(read_" (cmplx-name c) "(o, v->" (ptr c) ") < 0){")675 (list (~a "case " case-tag ":")
640 (~a "\t\t\tfree(v->" (ptr c) ");")676 (indent (if (empty? after)
641 (~a "\t\t\tgoto err;")677 empty
642 (~a "\t\t}")678 (list (~a "{")
643 (~a "\t\trec->parsed = v->" (ptr c) ";")679 (~a " static int retried = 0;")
644 (~a "\t\trec->print = (void*)print_" (cmplx-name c) ";")680 (~a " if(" if-ready "){")
645 (~a "\t\tbreak;")))681 (~a " if(retried){")
682 (~a " werrstr(\"%s: deps missing\", \"" (cmplx-name c) "\");")
683 (~a " goto err;")
684 (~a " }")
685 (~a " retried = 1;")
686 (~a " retry++;")
687 (~a " break;")
688 (~a " }")
689 (~a " if(retried)")
690 (~a " retry--;")
691 (~a "}"))))
692 (~a " if(v->" (ptr c) " != nil)") ; don't reparse the same table
693 (~a " break;")
694 (~a " v->" (ptr c) " = calloc(1, sizeof(" (cmplx-name c) "));")
695 (~a " if(read_" (cmplx-name c) "(o, v->" (ptr c) ") < 0){")
696 (~a " free(v->" (ptr c) ");")
697 (~a " goto err;")
698 (~a " }")
699 (~a " rec->parsed = v->" (ptr c) ";")
700 (~a " rec->print = (void*)print_" (cmplx-name c) ";")
701 (~a " break;")))
646 (list (cons 'field (map (λ (c) (~a (cmplx-name c) " *" (ptr c) ";")) tagged))702 (list (cons 'field (map (λ (c) (~a (cmplx-name c) " *" (ptr c) ";")) tagged))
647 (cons 'read703 (cons 'read
648 (list (~a "for(int i = 0; i < v->numTables; i++){")704 (list (~a "int retry = 0;")
649 (~a "\tTableRecord *rec = &v->tableRecords[i];")705 (~a "do{")
650 (~a "\tif(rec->length == 0)") ; skip all empty tables706 (~a " for(int i = 0; i < v->numTables; i++){")
651 (~a "\t\tcontinue;")707 (~a " TableRecord *rec = &v->tableRecords[i];")
652 (~a "\tif(otfpushrange(o, rec->offset, rec->length) < 0)")708 (~a " if(rec->length == 0)") ; skip all empty tables
653 (~a "\t\tgoto err;")709 (~a " continue;")
654 (~a "\tswitch(rec->tableTag){")710 (~a " if(otfpushrange(o, rec->offset, rec->length) < 0)")
655 (map case-statement tagged)711 (~a " goto err;")
656 (~a "\t}")712 (~a " switch(rec->tableTag){")
657 (~a "\tif(otfpoprange(o) < 0)")713 (indent (indent (map case-statement tagged)))
658 (~a "\t\tgoto err;")714 (~a " }")
659 (~a "}")))))715 (~a " if(otfpoprange(o) < 0)")
716 (~a " goto err;")
717 (~a " }")
718 (~a "}while(retry > 0);")))))
660 719
661(mkcmplx TableDirectory720(mkcmplx TableDirectory
662 {uint32 sfntVersion (== #x00010000 #x4f54544f) hex}721 {uint32 sfntVersion (== #x00010000 #x4f54544f) hex}
test.c+1−1
@@ -20,7 +20,7 @@ main(int argc, char **argv) · 19 unmodified lines
20 }else if(read_TableDirectory(o, &td) != 0){20 }else if(read_TableDirectory(o, &td) != 0){
21 fprint(2, "%s: %r\n", argv[i]);21 fprint(2, "%s: %r\n", argv[i]);
22 } else {22 } else {
23 print_TableDirectory(out, indentΔ, &td);23 print_TableDirectory(out, indentΔ, o, &td);
24 }24 }
25 otfclose(o);25 otfclose(o);
26 }26 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t