-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathsetfont.gs
98 lines (83 loc) · 1.99 KB
/
setfont.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
*
* help is in the end of this script
*
function setfont( args )
_version = '0.02r1'
rc = gsfallow( 'on' )
if( args = '' )
help()
return
endif
***** Default value *****
angle = 0
base = 'c'
color = 1
***** Arguement *****
type = subwrd(args,1)
i = 2
arg = "dummy"
while( arg != "" )
arg = subwrd( args, i )
i = i + 1
if( arg = "-angle" ) ; angle = subwrd( args, i ) ; i = i + 1 ; endif
if( arg = "-base" ) ; base = subwrd( args, i ) ; i = i + 1 ; endif
if( arg = "-color" ) ; color = subwrd( args, i ) ; i = i + 1 ; endif
endwhile
if( type = "tiny" )
width = 0.09
height = 0.09
thickness = 2.7
endif
if( type = "small" )
width = 0.12
height = 0.12
thickness = 3.6
endif
if( type = "normal" )
width = 0.15
height = 0.15
thickness = 4.5
endif
if( type = "large" )
width = 0.20
height = 0.20
thickness = 6.0
endif
if( type = "huge" )
width = 0.30
height = 0.30
thickness = 9.0
endif
pt = strrep( type, 'pt', '' )
if( type != pt )
width = pt / 72.0
height = width
thickness = math_int( width * 30 )
if( thickness > 12 ) ; thickness = 12 ; endif
endif
'set strsiz 'width' 'height
'set string 'color' 'base' 'thickness' 'angle
return
*
* help
*
function help()
say ' Name:'
say ' setfont '_version' - Set font property'
say ' '
say ' Usage:'
say ' setfont size [-angle angle] [-base string-base]'
say ''
say ' size : tiny, small, normal, large, huge, or e.g., 10pt '
say ' -angle angle : string angle (0<=angle<360)'
say ' -base string-base : string base (c, tl, bc, etc...), default=c'
say ' -color color-num : color number'
say ''
say ' Note:'
say ' [arg-name] : specify if needed'
say ' (arg1 | arg2) : arg1 or arg2 must be specified'
say ''
say ' Copyright (C) 2009-2015 Chihiro Kodama'
say ' Distributed under GNU GPL (http://www.gnu.org/licenses/gpl.html)'
say ''
return