1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: tools.test core-text core-foundation
4 core-foundation.dictionaries destructors
5 arrays kernel generalizations math accessors
6 core-foundation.utilities
7 combinators hashtables colors ;
10 : test-font ( name -- font )
11 [ >cf &CFRelease 0.0 f CTFontCreateWithName ] with-destructors ;
13 [ ] [ "Helvetica" test-font CFRelease ] unit-test
17 kCTFontAttributeName "Helvetica" test-font &CFRelease 2array 1array
18 <CFDictionary> &CFRelease drop
22 : test-typographic-bounds ( string font -- ? )
24 test-font &CFRelease white <CTLine> &CFRelease
25 line-typographic-bounds {
33 [ t ] [ "Hello world" "Helvetica" test-typographic-bounds ] unit-test
35 [ t ] [ "Hello world" "Chicago" test-typographic-bounds ] unit-test
37 [ t ] [ "日本語" "Helvetica" test-typographic-bounds ] unit-test