Debian Codegraph @

doc/sphinx/ui/dialogs/transform.rst

raw
1 Transform Dialog
2 ================
3
4 .. figure:: /images/transform.png
5
6 This dialog is available in the font, outline and metrics views. In the font
7 view it applies to all selected glyphs. In the outline view if there is a
8 selection then it applies to that. if there is no selection then it applies to
9 the entire glyph.
10
11 You may choose whether you want the transformation to be centered at the glyph's
12 origin, the center of the selection (or of the glyph as a whole if there is no
13 selection), or the location of the last point on which you clicked the mouse.
14
15 You may apply several different transformations at once:
16
17 .. object:: Do Nothing
18
19 A very simple transformation.
20
21 .. object:: Move
22
23 You may move the selection an arbitrary amount in the x and y directions
24
25 .. object:: Rotate
26
27 You may rotate the selection an arbitrary number of degrees.
28
29 .. object:: Scale
30
31 You may scale the two coordinates differently
32
33 .. object:: Scale Uniformly
34
35 You may scale the two coordinates the same amount (which can of course be
36 done above, but it's slightly easier only to set one number).
37
38 .. object:: Flip
39
40 You may flip either horizontally or vertically
41
42 .. note::
43
44 After flipping an outline you will almost certainly want to apply
45 :ref:`Element->Correct Direction <elementmenu.Correct>`.
46
47 .. object:: Skew
48
49 You may skew the selection a certain number of degrees (to create an oblique
50 font for example).
51
52 .. object:: Rotate 3D Around...
53
54 You may do a three dimensional rotation of the glyph around either the X axis
55 or the Y axis. This operation is immediately followed by a projection of the
56 result back into the xy-plane (A rotation around the Z axis is a normal
57 rotaton (and isn't included here).
58
59 Following the rotation by a projection produces the same results no matter
60 what the sign of the angle (so there are no Clockwise/CounterClockwise
61 options here).
62
63 .. object:: Move by Ruler
64
65 Fill in the amount to move from the x and y offsets of the last measurements
66 made with the :ref:`ruler tool <charview.Ruler>`.
67
68 .. object:: Rotate by Ruler
69
70 Fill in the rotation angle from the angle of the last measurements made with
71 the :ref:`ruler tool <charview.Ruler>`.
72
73 .. object:: Skew by Ruler
74
75 Fill in the skew angle from the angle of the last measurements made with the
76 :ref:`ruler tool <charview.Ruler>`.
77
78 If you are in the font view, and if :ref:`Copy From <editmenu.From>` is set to
79 all fonts, then the transformation will also be applied to the bitmaps. Not all
80 of these transforms can be mapped to ones on the bitmap font (arbitrary
81 rotations, scales, etc. do not map). Only rotations by 90 degrees, flips, skews
82 and moves will be approximated on the bitmap glyphs.
83
84 If you are in the font view, then any pair-wise kerning information whose first
85 glyph is selected will be scaled (but not translated) by the transformation
86 matrix. Similarly and simple positioning features that apply to a selected glyph
87 will be transformed by the matrix (but again not translated). You may choose to
88 scale kerning classes as well.
89
90 If you are in the font view or the outline view and there is no selection (and
91 you are in the foreground) there is a "[] Transform Background Too" check box.
92 If you check this then anything in the background will be transformed with the
93 foreground.
94
95 If you check [] Round to Int then after the transformation has been applied
96 everything will be rounded to an integer value.
97
98 Transformations in the Outline glyph view are not applied to any bitmaps. (Nor
99 are transformations in the bitmap window mapped back to the outline).
100
101
102 .. _transform.Non-Linear:
103
104 Non-Linear Transformations
105 --------------------------
106
107 .. image:: /images/non-linear.png
108 :align: right
109
110 Non-linear transformations are defined by providing two expressions, one of
111 which results in the transformed value for the X coordinate, the other provides
112 the y coordinate. In the example at right:
113
114 .. math::
115
116 x' &= 5x^2 + x + 3\sin(y) \\
117 y' &= y
118
119 Expressions may be made up of the usual C operators: "+", "-", "*", "/", "%",
120 "!", "==", "<", ">", "<=", ">=", "!=", "&&", "||" and "? :" as well as "^" which
121 means "raise to the power of". They may also contain the standard functions:
122 "log", "exp", "sqrt", "sin", "cos", "tan", "atan2", "abs", "rint", "floor",
123 "ceil".
124
125 Note: In non-linear transformations the result is only an approximation to the
126 correct result (A linear transformation will transform a cubic spline to another
127 cubic spline. A non-linear transformation may not).
128
129
130 .. _transform.PoV:
131
132 Point of View Projection
133 ------------------------
134
135 .. image:: /images/PoV.png
136 :align: right
137
138 I have a hard time describing this. There are three different coordinate systems
139 involved. There is the (2D) coordinate system in which your glyph has been
140 drawn. There is a 3D coordinate system in which we embed it, and finally there
141 is another 2D coordinate system onto which we project it.
142
143 Assume your eye is at the origin of 3 space, and you are looking up along the Z
144 axis. Assume that the plane in which your glyph has been drawn is tilted by an
145 angle theta (from the XY plane in 3 space) and the intersection between the Z
146 axis and the drawing plane is z units along the Z axis. Assume that the
147 projection plane is parallel to the XY plane and is at a distance d along the Z
148 axis.
149
150 .. image:: /images/Bperspective.png
151 :align: left
152
153 Then for each point in the glyph we draw a line between that point and your eye
154 (which is at the origin). The location where that line intersects the projection
155 plane is the transformed location of that point. Again the result is only an
156 approximation.
157
158 The Point Of View dialog gives you a little more freedom than is described
159 above. It allows you to set the location of the eye (instead of fixing it at the
160 origin), and allows you to change in what direction the vanishing point will lie
161 (instead of fixing it on the y axis).
162
163 The dialog also calculates the location of the vanishing point as you change
164 fields (Note: It cannot figure out meta information like "Center of Selection",
165 so whenever the eye is positioned with this value, it just assumes a value of 0
166 for that coordinate.