added a contract to 'text'

svn: r6571
This commit is contained in:
Robby Findler 2007-06-11 03:03:03 +00:00
parent 6683f05889
commit 0d69b92c79
2 changed files with 36 additions and 2 deletions

View File

@ -223,6 +223,10 @@ Basic Constructors:
are specified, the first one takes precedence
[MrEd only]
> text-style/c :: contract?
This is a contract that matches the second argument of `text'.
> (caps-text string [text-style null] [size 12] [angle 0]) -> pict
Same as `text', but use small caps:

View File

@ -1,6 +1,8 @@
(module mrpict mzscheme
(require (lib "unit.ss"))
(require (lib "unit.ss")
(lib "contract.ss")
(lib "mred.ss" "mred"))
(require (lib "mred-sig.ss" "mred")
(lib "mred-unit.ss" "mred"))
@ -16,4 +18,32 @@
(define-values/invoke-unit/infer mrpict+mred@)
(provide-signature-elements texpict-common^ mrpict-extra^))
(provide-signature-elements texpict-common^)
(provide
dc-for-text-size
show-pict
caps-text current-expected-text-scale
dc
linewidth
draw-pict
make-pict-drawer)
(define text-style/c
(flat-rec-contract
text-style/c
(or/c null?
(is-a?/c font%)
(symbols 'base 'default 'decorative 'roman 'script 'swiss 'modern 'symbol 'system)
string? ;; could be more specific, I guess.
(cons/c (symbols 'bold 'italic 'superscript 'subscript 'combine 'no-combine)
text-style/c))))
(provide/contract
[text (opt-> (string?)
(text-style/c
(and/c (between/c 1 255) integer?)
number?)
pict?)])
(provide text-style/c))