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

29 lines
1.1 KiB
Racket

6 years ago
#lang racket/base
(require "racket.rkt")
6 years ago
(provide (all-defined-out))
(require (for-syntax racket/string))
#|
approximates
https://github.com/mbutterick/fontkit/blob/master/src/tables/index.js
|#
(define-macro (define-table-codecs ID TABLE-ID ...)
(with-pattern ([(TABLE-ID-STRING ...) (pattern-case-filter #'(TABLE-ID ...)
6 years ago
[STX (datum->syntax caller-stx
(string-append "table/" (string-replace (format "~a.rkt" (syntax->datum #'STX)) "/" "")))])])
6 years ago
#'(begin
(r+p TABLE-ID-STRING ...)
(test-module (require (submod TABLE-ID-STRING test) ...))
(define ID (make-hasheq (map cons (list 'TABLE-ID ...) (list TABLE-ID ...)))))))
(define-table-codecs table-codecs
;; required tables
#;cmap head hhea hmtx maxp #;name OS/2 post
;; TrueType outlines
cvt_ fpgm loca prep glyf
;; PostScript outlines
6 years ago
#;CFF_ #;CFF2 #;VORG
6 years ago
;; Advanced OpenType Tables
#;BASE #;GDEF #;GPOS #;GSUB #;JSTF)