Unified · Split
| @@ -32,7 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | (define/contract (format f) |
| 33 | 33 | (-> procedure? string?) |
| 34 | 34 | (define-values (a b) (partition c-typedef? (flatten (map f cmplxs)))) |
| 35 | − (define ps (list "/* this file is generated. do not modify. */\n" a b (map f types) "")) | |
| 35 | + (define ps (list "/* this file is generated. do not modify. */" a b (map f types) "")) | |
| 36 | 36 | (string-join (flatten ps) "\n")) |
| 37 | 37 | |
| 38 | 38 | (define-generics code |
| @@ -75,17 +75,20 @@ · 36 unmodified lines | ||
| 75 | 75 | (define (wrap-cond-c cond lst) |
| 76 | 76 | (match cond |
| 77 | 77 | [#f lst] |
| 78 | − [(list 'cond op ref n) (block (~a "if(v->" ref " " op " " n ")") (indent lst))])) | |
| 78 | + [(list 'cond op ref n ...) | |
| 79 | + (block (~a "if(" (string-join (map (λ (n) (~a "v->" ref " " op " " n)) n) " || ") ")") | |
| 80 | + (indent (flatten lst)))])) | |
| 79 | 81 | |
| 80 | 82 | (define (field-fprint-c f) |
| 81 | 83 | (define t (field-type f)) |
| 82 | 84 | (define count (field-count f)) |
| 83 | 85 | (define end (and count (if (cmplx? t) (~a "v->" (cadr count)) (cadr count)))) |
| 84 | − (define fixed-array (and (type? t) (number? end))) | |
| 86 | + (define basic-array (and (type? t) end)) | |
| 87 | + (define fixed-array (and basic-array (number? end))) | |
| 85 | 88 | (define array-index (if (field-count f) "[i]" "")) |
| 86 | 89 | (define verb (if (type? t) (if (field-verb f) (cadr (field-verb f)) (type-verb t)) "")) |
| 87 | 90 | (define fprint-index |
| 88 | − (if fixed-array | |
| 91 | + (if basic-array | |
| 89 | 92 | (~a "fprint(f, \"%*s%s[%d]: " |
| 90 | 93 | verb |
| 91 | 94 | "\\n\", indent, \"\", \"" |
| @@ -99,7 +102,7 @@ · 7 unmodified lines | ||
| 99 | 102 | (if count |
| 100 | 103 | (λ (lst) |
| 101 | 104 | (block (~a "for(int i = 0; i < " (if fixed-array "" "v->") (cadr count) "; i++)") |
| 102 | − (indent (list* fprint-index (if fixed-array empty lst))))) | |
| 105 | + (indent (list* fprint-index (if basic-array empty lst))))) | |
| 103 | 106 | identity)) |
| 104 | 107 | (define lst |
| 105 | 108 | (list |
| @@ -117,7 +120,7 @@ · 11 unmodified lines | ||
| 117 | 120 | |
| 118 | 121 | (define (invert-c op) |
| 119 | 122 | (match op |
| 120 | − ['= '!=] | |
| 123 | + ['== '!=] | |
| 121 | 124 | ['<= '>] |
| 122 | 125 | ['>= '<] |
| 123 | 126 | ['< '>=] |
| @@ -160,11 +163,16 @@ · 36 unmodified lines | ||
| 160 | 163 | (~a "if(read_" (name (field-type f)) "(ctx, &" ref ") < 0){"))) |
| 161 | 164 | (if index empty (~a "if(skip_bytes(ctx, " (size (field-type f)) ") < 0){")))] |
| 162 | 165 | [count |
| 163 | − #:when (and (number? (cadr count)) (type? (field-type f))) | |
| 166 | + #:when (type? (field-type f)) | |
| 164 | 167 | (if (field-unused? f) |
| 165 | 168 | empty |
| 166 | − (list (~a "for(int i = 0; i < " (cadr count) "; i++)") | |
| 167 | − (~a "\t" ref "[i] = " ((type-parse (field-type f)) b index "i") ";")))] | |
| 169 | + (list | |
| 170 | + (~a "for(int i = 0; i < " (if (number? (cadr count)) "" "v->") (cadr count) "; i++)") | |
| 171 | + (~a "\t" | |
| 172 | + ref | |
| 173 | + "[i] = " | |
| 174 | + ((type-parse (field-type f)) b index (~a "i*" (size (field-type f)))) | |
| 175 | + ";")))] | |
| 168 | 176 | [count |
| 169 | 177 | (~a "if(ctxarray(ctx, &" |
| 170 | 178 | ref |
| @@ -211,12 +219,17 @@ · 40 unmodified lines | ||
| 211 | 219 | (define/generic super-gen-c gen-c) |
| 212 | 220 | (define (gen-h c) |
| 213 | 221 | (flatten (append (list (~a "typedef struct " (cmplx-name c) " " (cmplx-name c) ";") |
| 222 | + (~a "") | |
| 214 | 223 | (~a "struct " (cmplx-name c) " {")) |
| 215 | 224 | (indent (flatten (map super-gen-h (cmplx-fields c)))) |
| 216 | 225 | (indent (filter-extra (cmplx-extra c) 'field)) |
| 217 | 226 | (list (~a "};") |
| 227 | + (~a "") | |
| 218 | 228 | (~a "int read_" (cmplx-name c) "(Ctx *ctx, " (cmplx-name c) " *v);"))))) |
| 219 | 229 | (define (gen-c c b index) |
| 230 | + (define (no-vla? f) | |
| 231 | + (define cnt (field-count f)) | |
| 232 | + (or (not cnt) (number? (cadr cnt)))) | |
| 220 | 233 | ; group fields to minimize number of reads |
| 221 | 234 | ; complex types are always alone |
| 222 | 235 | ; simple types can be combined unless versioned |
| @@ -226,6 +239,8 @@ · 3 unmodified lines | ||
| 226 | 239 | (or (empty? g) |
| 227 | 240 | (and (type? (field-type f)) |
| 228 | 241 | (type? (field-type (car g))) |
| 242 | + (no-vla? f) | |
| 243 | + (no-vla? (car g)) | |
| 229 | 244 | (equal? (field-cond f) (field-cond (car g)))))) |
| 230 | 245 | (define (group- g fields) |
| 231 | 246 | (match fields |
| @@ -238,23 +253,33 @@ · 6 unmodified lines | ||
| 238 | 253 | [#f (type-size (field-type f))] |
| 239 | 254 | [count |
| 240 | 255 | #:when (type? (field-type f)) |
| 241 | − (* (cadr count) (type-size (field-type f)))])) | |
| 256 | + ((if (number? (cadr count)) | |
| 257 | + (λ (sz) (* (cadr count) sz)) | |
| 258 | + (λ (sz) (~a "v->" (cadr count) "*" sz))) | |
| 259 | + (type-size (field-type f)))])) | |
| 260 | + (define (add x y) | |
| 261 | + (match (list x y) | |
| 262 | + [(list _ 0) x] | |
| 263 | + [(list 0 _) y] | |
| 264 | + [_ (if (and (number? x) (number? y)) (+ x y) (~a x "+" y))])) | |
| 242 | 265 | (define (parse-group g) |
| 243 | 266 | (define (p fs index) |
| 244 | 267 | (if (pair? fs) |
| 245 | − (cons (super-gen-c (car fs) "b" index) (p (cdr fs) (+ index (field-size (car fs))))) | |
| 268 | + (cons (super-gen-c (car fs) "b" index) (p (cdr fs) (add index (field-size (car fs))))) | |
| 246 | 269 | empty)) |
| 247 | 270 | (p g 0)) |
| 248 | 271 | (define (gen-group-c fields) |
| 249 | − (if (cmplx? (field-type (car fields))) | |
| 250 | − (map (λ (f) (super-gen-c f #f #f)) fields) | |
| 251 | − (let* ([sum (apply + (map (λ (f) (field-size f)) fields))] | |
| 252 | − [lst (flatten (list* (~a "if((b = ctxreadn(ctx, " sum ")) == nil)") | |
| 253 | − (~a "\tgoto err;") | |
| 254 | − (parse-group fields)))]) | |
| 255 | − (wrap-cond-c (field-cond (car fields)) lst)))) | |
| 272 | + (wrap-cond-c (field-cond (car fields)) | |
| 273 | + (if (cmplx? (field-type (car fields))) | |
| 274 | + (map (λ (f) (super-gen-c f #f #f)) fields) | |
| 275 | + (let* ([sum (foldr (λ (f accu) (add (field-size f) accu)) 0 fields)] | |
| 276 | + [lst (flatten (list* (~a "if((b = ctxreadn(ctx, " sum ")) == nil)") | |
| 277 | + (~a "\tgoto err;") | |
| 278 | + (parse-group fields)))]) | |
| 279 | + lst)))) | |
| 256 | 280 | (flatten |
| 257 | − (append (list (~a "int") | |
| 281 | + (append (list (~a "") | |
| 282 | + (~a "int") | |
| 258 | 283 | (~a "read_" (cmplx-name c) "(Ctx *ctx, " (cmplx-name c) " *v)") |
| 259 | 284 | (~a "{") |
| 260 | 285 | (~a "\tu8int *b;")) |
| @@ -265,7 +290,8 @@ · 4 unmodified lines | ||
| 265 | 290 | (~a "\twerrstr(\"%s: %r\", \"" (cmplx-name c) "\");") |
| 266 | 291 | (~a "\treturn -1;") |
| 267 | 292 | (~a "}")) |
| 268 | − (list (~a "void") | |
| 293 | + (list (~a "") | |
| 294 | + (~a "void") | |
| 269 | 295 | (~a "fprint_" (cmplx-name c) "(int f, int indent, " (cmplx-name c) " *v)") |
| 270 | 296 | (~a "{") |
| 271 | 297 | (indent (flatten (map field-fprint-c (cmplx-fields c)))) |
| @@ -315,11 +341,11 @@ · 43 unmodified lines | ||
| 315 | 341 | [(_ (n:number)) #''(count n)] |
| 316 | 342 | [(_ {~literal hex}) #''(verb "%#ux")] |
| 317 | 343 | [(_ (p:expr vs:number ...+)) #''(test p vs ...)] |
| 318 | − [(_ (p:expr ref:id n:number)) | |
| 344 | + [(_ (p:expr ref:id vs:number ...+)) | |
| 319 | 345 | #''(cond |
| 320 | 346 | p |
| 321 | 347 | ref |
| 322 | − n)] | |
| 348 | + vs ...)] | |
| 323 | 349 | [(_ ({~literal count} n:id)) |
| 324 | 350 | (begin |
| 325 | 351 | (define counter (assoc (syntax->datum #`n) fields)) |
| @@ -384,19 +410,19 @@ · 58 unmodified lines | ||
| 384 | 410 | (mkfields {uint16 platformID (<= 4)} {uint16 encodingID} {Offset32 subtableOffset})) |
| 385 | 411 | |
| 386 | 412 | (mkcmplx TableCmap |
| 387 | − (mkfields {uint16 version unused (= 0)} | |
| 413 | + (mkfields {uint16 version unused (== 0)} | |
| 388 | 414 | {uint16 numTables} |
| 389 | 415 | {EncodingRecord encodingRecords (count numTables)}) |
| 390 | 416 | #:tag "cmap") |
| 391 | 417 | |
| 392 | 418 | (mkcmplx TableHead |
| 393 | − (mkfields {uint16 majorVersion unused (= 1)} | |
| 394 | − {uint16 minorVersion unused (= 0)} | |
| 419 | + (mkfields {uint16 majorVersion unused (== 1)} | |
| 420 | + {uint16 minorVersion unused (== 0)} | |
| 395 | 421 | {Fixed fontRevision unused} |
| 396 | 422 | {uint32 checksumAdjustment unused} |
| 397 | − {uint32 magicNumber unused (= #x5f0f3cf5)} | |
| 423 | + {uint32 magicNumber unused (== #x5f0f3cf5)} | |
| 398 | 424 | {uint16 flags} |
| 399 | − {uint16 unitsPerEm} | |
| 425 | + {uint16 unitsPerEm (>= 16) (<= 16384)} | |
| 400 | 426 | {LONGDATETIME created} |
| 401 | 427 | {LONGDATETIME modified} |
| 402 | 428 | {int16 xMin} |
| @@ -407,12 +433,12 @@ · 4 unmodified lines | ||
| 407 | 433 | {uint16 lowestRecPPEM} |
| 408 | 434 | {int16 fontDirectionHint unused (>= -2) (<= 2)} |
| 409 | 435 | {int16 indexToLocFormat (<= 1)} |
| 410 | − {int16 glyphDataFormat unused (= 0)}) | |
| 436 | + {int16 glyphDataFormat unused (== 0)}) | |
| 411 | 437 | #:tag "head") |
| 412 | 438 | |
| 413 | 439 | (mkcmplx TableHhea |
| 414 | − (mkfields {uint16 majorVersion (= 1)} | |
| 415 | − {uint16 minorVersion (= 0)} | |
| 440 | + (mkfields {uint16 majorVersion (== 1)} | |
| 441 | + {uint16 minorVersion (== 0)} | |
| 416 | 442 | {FWORD ascender} |
| 417 | 443 | {FWORD descender} |
| 418 | 444 | {FWORD lineGap} |
| @@ -424,19 +450,28 @@ · 5 unmodified lines | ||
| 424 | 450 | {int16 caretSlopeRun} |
| 425 | 451 | {int16 caretOffset} |
| 426 | 452 | {int16 reserved [4] unused} |
| 427 | − {int16 metricDataFormat (= 0)} | |
| 453 | + {int16 metricDataFormat (== 0)} | |
| 428 | 454 | {uint16 numberOfHMetrics}) |
| 429 | 455 | #:tag "hhea") |
| 430 | 456 | |
| 457 | +(mkcmplx LongHorMetric (mkfields {UFWORD advanceWidth} {FWORD lsb})) | |
| 458 | + | |
| 459 | +#| | |
| 460 | +FIXME what. WHAT. | |
| 461 | +(mkcmplx TableHmtx | |
| 462 | + (mkfields {LongHorMetric hMetrics (count (TableHhea numberOfHMetrics))} | |
| 463 | + {FWORD leftSideBearings (count (- (TableMaxp numGlyphs) (TableHhea numberOfHMetrics)))})) | |
| 464 | +|# | |
| 465 | + | |
| 431 | 466 | (mkcmplx TableMaxp |
| 432 | − (mkfields {Version16Dot16 version (= #x05000 #x10000) unused} | |
| 467 | + (mkfields {Version16Dot16 version (== #x05000 #x10000) unused} | |
| 433 | 468 | {uint16 numGlyphs} |
| 434 | 469 | ; a bunch of fields ignored here |
| 435 | 470 | ) |
| 436 | 471 | #:tag "maxp") |
| 437 | 472 | |
| 438 | 473 | (mkcmplx TablePost |
| 439 | − (mkfields {Version16Dot16 version (= #x10000 #x20000 #x25000 #x30000) unused} | |
| 474 | + (mkfields {Version16Dot16 version (== #x10000 #x20000 #x25000 #x30000) unused} | |
| 440 | 475 | {Fixed italicAngle} |
| 441 | 476 | {FWORD underlinePosition} |
| 442 | 477 | {FWORD underlineThickness} |
| @@ -445,6 +480,25 @@ · 2 unmodified lines | ||
| 445 | 480 | ) |
| 446 | 481 | #:tag "post") |
| 447 | 482 | |
| 483 | +(mkcmplx NameRecord | |
| 484 | + (mkfields {uint16 platformID} | |
| 485 | + {uint16 encodingID} | |
| 486 | + {uint16 languageID} | |
| 487 | + {uint16 nameID} | |
| 488 | + {uint16 length} | |
| 489 | + {Offset16 stringOffset})) | |
| 490 | + | |
| 491 | +(mkcmplx LangTagRecord (mkfields {uint16 length} {Offset16 langTagOffset})) | |
| 492 | + | |
| 493 | +(mkcmplx TableName | |
| 494 | + (mkfields {uint16 version (== 0 1)} | |
| 495 | + {uint16 count} | |
| 496 | + {Offset16 storageOffset} | |
| 497 | + {NameRecord nameRecord (count count)} | |
| 498 | + {uint16 langTagCount (>= version 1)} | |
| 499 | + {LangTagRecord langTagRecord (count langTagCount) (>= version 1)}) | |
| 500 | + #:tag "name") | |
| 501 | + | |
| 448 | 502 | (mkcmplx BigGlyphMetrics |
| 449 | 503 | (mkfields {uint8 height} |
| 450 | 504 | {uint8 width} |
| @@ -486,12 +540,207 @@ · 35 unmodified lines | ||
| 486 | 540 | {int8 flags})) |
| 487 | 541 | |
| 488 | 542 | (mkcmplx TableEBLC |
| 489 | − (mkfields {uint16 majorVersion (= 2) unused} | |
| 490 | − {uint16 minorVersion (= 0) unused} | |
| 543 | + (mkfields {uint16 majorVersion (== 2) unused} | |
| 544 | + {uint16 minorVersion (== 0) unused} | |
| 491 | 545 | {uint32 numSizes} |
| 492 | 546 | {BitmapSize bitmapSizes (count numSizes)}) |
| 493 | 547 | #:tag "EBLC") |
| 494 | 548 | |
| 549 | +(mkcmplx AttachList | |
| 550 | + (mkfields {Offset16 coverageOffset} | |
| 551 | + {uint16 glyphCount} | |
| 552 | + {Offset16 attachPointOffsets (count glyphCount)})) | |
| 553 | + | |
| 554 | +(mkcmplx AttachPoint (mkfields {uint16 pointCount} {uint16 pointIndices (count pointCount)})) | |
| 555 | + | |
| 556 | +(mkcmplx LigCaretList | |
| 557 | + (mkfields {Offset16 coverageOffset} | |
| 558 | + {uint16 ligGlyphCount} | |
| 559 | + {Offset16 ligGlyphOffsets (count ligGlyphCount)})) | |
| 560 | + | |
| 561 | +(mkcmplx LigGlyph (mkfields {uint16 caretCount} {Offset16 caretValueOffsets (count caretCount)})) | |
| 562 | + | |
| 563 | +(mkcmplx CaretValue | |
| 564 | + (mkfields {uint16 format (>= 1) (<= 3)} | |
| 565 | + {int16 coordinate (== format 1 3)} | |
| 566 | + {uint16 caretValuePointIndex (== format 2)} | |
| 567 | + {Offset16 deviceOffset (== format 3)})) | |
| 568 | + | |
| 569 | +(mkcmplx ValueRecord | |
| 570 | + (mkfields {int16 xPlacement} | |
| 571 | + {int16 yPlacement} | |
| 572 | + {int16 xAdvance} | |
| 573 | + {int16 yAdvance} | |
| 574 | + {Offset16 xPlaDeviceOffset} | |
| 575 | + {Offset16 yPlaDeviceOffset} | |
| 576 | + {Offset16 xAdvDeviceOffset} | |
| 577 | + {Offset16 yAdvDeviceOffset})) | |
| 578 | + | |
| 579 | +(mkcmplx SinglePos | |
| 580 | + (mkfields {uint16 format (== 1 2)} | |
| 581 | + {Offset16 coverageOffset} | |
| 582 | + {uint16 valueFormat} | |
| 583 | + {ValueRecord valueRecord (== format 1)} | |
| 584 | + {uint16 valueCount (== format 2)} | |
| 585 | + {ValueRecord valueRecords (== format 2) (count valueCount)})) | |
| 586 | + | |
| 587 | +(mkcmplx TableGDEF | |
| 588 | + (mkfields {uint16 majorVersion (== 1) unused} | |
| 589 | + {uint16 minorVersion (== 0 2 3)} | |
| 590 | + {Offset16 glyphClassDefOffset} | |
| 591 | + {Offset16 attachListOffset} | |
| 592 | + {Offset16 ligCaretListOffset} | |
| 593 | + {Offset16 markAttachClassDefOffset} | |
| 594 | + {Offset16 markGlyphSetsDefOffset (>= minorVersion 2)} | |
| 595 | + {Offset32 itemVarStoreOffset (>= minorVersion 3)}) | |
| 596 | + #:tag "GDEF") | |
| 597 | + | |
| 598 | +(mkcmplx TableGPOS | |
| 599 | + (mkfields {uint16 majorVersion (== 1) unused} | |
| 600 | + {uint16 minorVersion (<= 1)} | |
| 601 | + {Offset16 scriptListOffset} | |
| 602 | + {Offset16 featureListOffset} | |
| 603 | + {Offset16 lookupListOffset} | |
| 604 | + {Offset32 featureVariationsOffset (== minorVersion 1)}) | |
| 605 | + #:tag "GPOS") | |
| 606 | + | |
| 607 | +(mkcmplx TableGSUB | |
| 608 | + (mkfields {uint16 majorVersion (== 1) unused} | |
| 609 | + {uint16 minorVersion (<= 1)} | |
| 610 | + {Offset16 scriptListOffset} | |
| 611 | + {Offset16 featureListOffset} | |
| 612 | + {Offset16 lookupListOffset} | |
| 613 | + {Offset32 featureVariationsOffset (== minorVersion 1)}) | |
| 614 | + #:tag "GSUB") | |
| 615 | + | |
| 616 | +(mkcmplx TableMATH | |
| 617 | + (mkfields {uint16 majorVersion (== 1) unused} | |
| 618 | + {uint16 minorVersion (== 0) unused} | |
| 619 | + {Offset16 mathConstantsOffset} | |
| 620 | + {Offset16 mathGlyphInfoOffset} | |
| 621 | + {Offset16 mathVariantsOffset}) | |
| 622 | + #:tag "MATH") | |
| 623 | + | |
| 624 | +(mkcmplx MathValueRecord (mkfields {FWORD value} {Offset16 deviceOffset})) | |
| 625 | + | |
| 626 | +(mkcmplx MathConstants | |
| 627 | + (mkfields {int16 scriptPercentScaleDown} | |
| 628 | + {int16 scriptScriptPercentScaleDown} | |
| 629 | + {UFWORD delimitedSubFormulaMinHeight} | |
| 630 | + {UFWORD displayOperatorMinHeight} | |
| 631 | + {MathValueRecord mathLeading} | |
| 632 | + {MathValueRecord axisHeight} | |
| 633 | + {MathValueRecord accentBaseHeight} | |
| 634 | + {MathValueRecord flattenedAccentBaseHeight} | |
| 635 | + {MathValueRecord subscriptShiftDown} | |
| 636 | + {MathValueRecord subscriptTopMax} | |
| 637 | + {MathValueRecord subscriptBaselineDropMin} | |
| 638 | + {MathValueRecord superscriptShiftUp} | |
| 639 | + {MathValueRecord superscriptShiftUpCramped} | |
| 640 | + {MathValueRecord superscriptBottomMin} | |
| 641 | + {MathValueRecord superscriptBaselineDropMax} | |
| 642 | + {MathValueRecord subSuperscriptGapMin} | |
| 643 | + {MathValueRecord superscriptBottomMaxWithSubscript} | |
| 644 | + {MathValueRecord spaceAfterScript} | |
| 645 | + {MathValueRecord upperLimitGapMin} | |
| 646 | + {MathValueRecord upperLimitBaselineRiseMin} | |
| 647 | + {MathValueRecord lowerLimitGapMin} | |
| 648 | + {MathValueRecord lowerLimitBaselineDropMin} | |
| 649 | + {MathValueRecord stackTopShiftUp} | |
| 650 | + {MathValueRecord stackTopDisplayStyleShiftUp} | |
| 651 | + {MathValueRecord stackBottomShiftDown} | |
| 652 | + {MathValueRecord stackBottomDisplayStyleShiftDown} | |
| 653 | + {MathValueRecord stackGapMin} | |
| 654 | + {MathValueRecord stackDisplayStyleGapMin} | |
| 655 | + {MathValueRecord stretchStackTopShiftUp} | |
| 656 | + {MathValueRecord stretchStackBottomShiftDown} | |
| 657 | + {MathValueRecord stretchStackGapAboveMin} | |
| 658 | + {MathValueRecord stretchStackGapBelowMin} | |
| 659 | + {MathValueRecord fractionNumeratorShiftUp} | |
| 660 | + {MathValueRecord fractionNumeratorDisplayStyleShiftUp} | |
| 661 | + {MathValueRecord fractionDenominatorShiftDown} | |
| 662 | + {MathValueRecord fractionDenominatorDisplayStyleShiftDown} | |
| 663 | + {MathValueRecord fractionNumeratorGapMin} | |
| 664 | + {MathValueRecord fractionNumDisplayStyleGapMin} | |
| 665 | + {MathValueRecord fractionRuleThickness} | |
| 666 | + {MathValueRecord fractionDenominatorGapMin} | |
| 667 | + {MathValueRecord fractionDenomDisplayStyleGapMin} | |
| 668 | + {MathValueRecord skewedFractionHorizontalGap} | |
| 669 | + {MathValueRecord skewedFractionVerticalGap} | |
| 670 | + {MathValueRecord overbarVerticalGap} | |
| 671 | + {MathValueRecord overbarRuleThickness} | |
| 672 | + {MathValueRecord overbarExtraAscender} | |
| 673 | + {MathValueRecord underbarVerticalGap} | |
| 674 | + {MathValueRecord underbarRuleThickness} | |
| 675 | + {MathValueRecord underbarExtraDescender} | |
| 676 | + {MathValueRecord radicalVerticalGap} | |
| 677 | + {MathValueRecord radicalDisplayStyleVerticalGap} | |
| 678 | + {MathValueRecord radicalRuleThickness} | |
| 679 | + {MathValueRecord radicalExtraAscender} | |
| 680 | + {MathValueRecord radicalKernBeforeDegree} | |
| 681 | + {MathValueRecord radicalKernAfterDegree} | |
| 682 | + {int16 radicalDegreeBottomRaisePercent})) | |
| 683 | + | |
| 684 | +(mkcmplx MathGlyphInfo | |
| 685 | + (mkfields {Offset16 mathItalicsCorrectionInfoOffset} | |
| 686 | + {Offset16 mathTopAccentAttachmentOffset} | |
| 687 | + {Offset16 extendedShapeCoverageOffset} | |
| 688 | + {Offset16 mathKernInfoOffset})) | |
| 689 | + | |
| 690 | +(mkcmplx MathItalicsCorrectionInfo | |
| 691 | + (mkfields {Offset16 italicsCorrectionCoverageOffset} | |
| 692 | + {uint16 italicsCorrectionCount} | |
| 693 | + {MathValueRecord italicsCorrection (count italicsCorrectionCount)})) | |
| 694 | + | |
| 695 | +(mkcmplx MathTopAccentAttachment | |
| 696 | + (mkfields {Offset16 topAccentCoverageOffset} | |
| 697 | + {uint16 topAccentAttachmentCount} | |
| 698 | + {MathValueRecord topAccentAttachment (count topAccentAttachmentCount)})) | |
| 699 | + | |
| 700 | +(mkcmplx MathKernInfoRecord | |
| 701 | + (mkfields {Offset16 topRightMathKernOffset} | |
| 702 | + {Offset16 topLeftMathKernOffset} | |
| 703 | + {Offset16 bottomRightMathKernOffset} | |
| 704 | + {Offset16 bottomLeftMathKernOffset})) | |
| 705 | + | |
| 706 | +(mkcmplx MathKernInfo | |
| 707 | + (mkfields {Offset16 mathKernCoverageOffset} | |
| 708 | + {uint16 mathKernCount} | |
| 709 | + {MathKernInfoRecord mathKernInfoRecords (count mathKernCount)})) | |
| 710 | + | |
| 711 | +(mkcmplx MathKern | |
| 712 | + (mkfields {uint16 heightCount} | |
| 713 | + {MathValueRecord correctionHeight (count heightCount)} | |
| 714 | + {MathValueRecord kernValues (count heightCount)})) | |
| 715 | + | |
| 716 | +(mkcmplx MathVariants | |
| 717 | + (mkfields {UFWORD minConnectorOverlap} | |
| 718 | + {Offset16 vertGlyphCoverageOffset} | |
| 719 | + {Offset16 horizGlyphCoverageOffset} | |
| 720 | + {uint16 vertGlyphCount} | |
| 721 | + {uint16 horizGlyphCount} | |
| 722 | + {Offset16 vertGlyphConstructionOffsets (count vertGlyphCount)} | |
| 723 | + {Offset16 horizGlyphConstructionOffsets (count horizGlyphCount)})) | |
| 724 | + | |
| 725 | +(mkcmplx MathGlyphVariantRecord (mkfields {uint16 variantGlyph} {UFWORD advanceMeasurement})) | |
| 726 | + | |
| 727 | +(mkcmplx MathGlyphConstruction | |
| 728 | + (mkfields {Offset16 glyphAssemblyOffset} | |
| 729 | + {uint16 variantCount} | |
| 730 | + {MathGlyphVariantRecord mathGlyphVariantRecords (count variantCount)})) | |
| 731 | + | |
| 732 | +(mkcmplx GlyphPart | |
| 733 | + (mkfields {uint16 glyphID} | |
| 734 | + {UFWORD startConnectorLength} | |
| 735 | + {UFWORD endConnectorLength} | |
| 736 | + {UFWORD fullAdvance} | |
| 737 | + {uint16 partFlags})) | |
| 738 | + | |
| 739 | +(mkcmplx GlyphAssembly | |
| 740 | + (mkfields {MathValueRecord italicsCorrection} | |
| 741 | + {uint16 partCount} | |
| 742 | + {GlyphPart partRecords (count partCount)})) | |
| 743 | + | |
| 495 | 744 | (mkcmplx TableOS∕2 |
| 496 | 745 | (mkfields {uint16 version (<= 5)} |
| 497 | 746 | {FWORD xAvgCharWidth} |
| @@ -555,7 +804,7 @@ · 57 unmodified lines | ||
| 555 | 804 | (~a "'" (string-ref t i) "'" (if (< i 3) (~a "<<" (* 8 (- 3 i))) ""))) |
| 556 | 805 | (define case-tag (~a "(u32int)(" (string-join (map (λ (i) (ft tag i)) (range 4)) "|") ")")) |
| 557 | 806 | (list (~a "\tcase " case-tag ":") |
| 558 | − (~a "\t\tv->" (ptr c) " = malloc(sizeof(" (cmplx-name c) "));") | |
| 807 | + (~a "\t\tv->" (ptr c) " = calloc(1, sizeof(" (cmplx-name c) "));") | |
| 559 | 808 | (~a "\t\tif(read_" (cmplx-name c) "(ctx, v->" (ptr c) ") < 0){") |
| 560 | 809 | (~a "\t\t\twerrstr(\"%s: %r\", \"" tag "\");") |
| 561 | 810 | (~a "\t\t\tfree(v->" (ptr c) ");") |
| @@ -579,7 +828,7 @@ · 17 unmodified lines | ||
| 579 | 828 | (~a "}"))))) |
| 580 | 829 | |
| 581 | 830 | (mkcmplx TableDirectory |
| 582 | − (mkfields {uint32 sfntVersion (= #x00010000 #x4f54544f) hex} | |
| 831 | + (mkfields {uint32 sfntVersion (== #x00010000 #x4f54544f) hex} | |
| 583 | 832 | {uint16 numTables} |
| 584 | 833 | {uint16 searchRange} |
| 585 | 834 | {uint16 entrySelector} |
| @@ -597,6 +846,7 @@ extern int indentΔ; · 11 unmodified lines | ||
| 597 | 846 | #pragma varargck type "V" u32int |
| 598 | 847 | |
| 599 | 848 | void otfinit(void); |
| 849 | + | |
| 600 | 850 | EOF |
| 601 | 851 | ) |
| 602 | 852 | |