-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathadd_anchor_ext.ff
53 lines (50 loc) · 1.66 KB
/
add_anchor_ext.ff
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
/*
* Copyright (C) 2006 Andrey V. Panov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
# This fontforge script proposed for addition of anchor to glyph
#
class = $1
type = $2
position = $3 # same as for bounding box, i.e. 3 is y max, integer (1 or 3)
o_height = $4 # height of anchor mark, integer
tan_it = $5 # tangent of italic angle, real
if ($argc > 6)
delta_x = $6
else
delta_x = 0
endif
if ($argc > 7)
ext_point = $7 # number of x coordinate from GlyphInfo("Xextrema",...)
else
ext_point = 2
endif
if ( WorthOutputting() )
bbox = GlyphInfo("BBox")
if (position == 3)
x_max = GlyphInfo("Xextrema", Floor(bbox[position]))
else
x_max = GlyphInfo("Xextrema", Ceil(bbox[position]))
endif
# Print(GlyphInfo("Name")," ",bbox,x_max," ",class," ",type," ",position," ",o_height)
if(x_max[1] >= x_max[0])
if (ext_point == 0 || ext_point == 1 )
x_ext = x_max[ext_point]
else
x_ext = (x_max[1] - x_max[0])*0.5 + x_max[0]
endif
AddAnchorPoint(class, type, Round(x_ext + (bbox[position] - o_height)*tan_it + delta_x), o_height)
endif
endif