Improvements to namespaces and file inclusion
[shapes.git] / examples / features / myfontdemo.shape
blob5087a84f69316b73d7a999e463fd09b1bb942f43
1 /** This file is part of Shapes.
2  **
3  ** Shapes is free software: you can redistribute it and/or modify
4  ** it under the terms of the GNU General Public License as published by
5  ** the Free Software Foundation, either version 3 of the License, or
6  ** any later version.
7  **
8  ** Shapes is distributed in the hope that it will be useful,
9  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  ** GNU General Public License for more details.
12  **
13  ** You should have received a copy of the GNU General Public License
14  ** along with Shapes.  If not, see <http://www.gnu.org/licenses/>.
15  **
16  ** Copyright 2008, 2014 Henrik Tidefelt
17  **/
19 ##lookin ..Shapes
21 |** The glyph's code must be correct for the font metrics to work (that's by my design).
22 |** The glyph's name must be correct for it to be painted.  However, the code can be wrong, but it will still print if the name is correct.
23 |** I wonder if the names can be deduced automatically somehow...
25 •myfont: newFont
27 •myfont << [tag 'FontName 'Honko] << [tag 'FullName `Honko Ponko´]
28 •myfont << [tag 'ItalicAngle ~10°]
29 •myfont << [tag 'size 1cm]
30 •myfont << [basicglyph char:'"a width:1.1cm glyph:[stroke (0cm,0cm)--(1cm,1cm)]]
31 •myfont << [basicglyph char:'"b width:1.1cm glyph:[stroke (0cm,1cm)--(1cm,0cm)]]
32 •myfont << [basicglyph char:'"å width:0.1cm glyph:(@width:1mm | [stroke (0cm,~0.1cm)--(0cm,1.1cm)])]
34 |** This glyph is not given a character code, only a name.  It will not be measurable...
35 •myfont << [basicglyph name:'foobar width:0.2cm glyph:(@width:1mm | [stroke (0cm,~0.1cm)--(0cm,1.1cm)])]
37 |** This glyph gets its name from a character:
38 •myfont << [basicglyph name:`ä´ width:0.3cm glyph:(@width:1mm | [stroke (0cm,~0.1cm)--(0cm,1.1cm)])]
40 myfont: •myfont;
42 •page << @text_font:myfont | ( newText << [kerning `aåa´ 1 `b´] )
45 /** What follows is not implemented yet: **/
47 |** yourfont: [importfont `yourfont.pdf´]
48 |**
49 |** •page << [shift (0,1cm)] [] ( @text_font:yourfont | ( newText << `abaabb´ ) )