]> git.saurik.com Git - wxWidgets.git/blob - src/freetype/autohint/mather.py
added common regex
[wxWidgets.git] / src / freetype / autohint / mather.py
1 #!/usr/bin/env python
2 #
3
4 #
5 # autohint math table builder
6 #
7
8
9 # Copyright 1996-2000 by
10 # David Turner, Robert Wilhelm, and Werner Lemberg.
11 #
12 # This file is part of the FreeType project, and may only be used, modified,
13 # and distributed under the terms of the FreeType project license,
14 # LICENSE.TXT. By continuing to use, modify, or distribute this file you
15 # indicate that you have read the license and understand and accept it
16 # fully.
17
18
19 import math
20
21 ag_pi = 256
22
23 def print_arctan( atan_bits ):
24 atan_base = 1 << atan_bits
25
26 print " static AH_Angle ag_arctan[1L << AG_ATAN_BITS] ="
27 print " {"
28
29 count = 0
30 line = " "
31
32 for n in range( atan_base ):
33 comma = ","
34 if ( n == atan_base - 1 ):
35 comma = ""
36
37 angle = math.atan( n * 1.0 / atan_base ) / math.pi * ag_pi
38 line = line + " " + repr( int( angle + 0.5 ) ) + comma
39 count = count + 1;
40 if ( count == 8 ):
41 count = 0
42 print line
43 line = " "
44
45 if ( count > 0 ):
46 print line
47 print " };"
48
49
50 # This routine is not used currently.
51 #
52 def print_sines():
53 print " static FT_Fixed ah_sines[AG_HALF_PI + 1] ="
54 print " {"
55
56 count = 0
57 line = " "
58
59 for n in range( ag_pi / 2 ):
60 sinus = math.sin( n * math.pi / ag_pi )
61 line = line + " " + repr( int( 65536.0 * sinus ) ) + ","
62 count = count + 1
63 if ( count == 8 ):
64 count = 0
65 print line
66 line = " "
67
68 if ( count > 0 ):
69 print line
70 print " 65536"
71 print " };"
72
73
74 print_arctan( 8 )
75 print
76
77
78 # END