Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathtext.html
More file actions
128 lines (125 loc) · 10.8 KB
/
Copy pathtext.html
File metadata and controls
128 lines (125 loc) · 10.8 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>VPython Help</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<link href="VisualRef.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
<style type="text/css">
<!--
.style2 {
font-size: x-large;
font-weight: bold;
}
.style2 {font-size: xx-large}
-->
</style>
<!-- InstanceEndEditable -->
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<table width="800" border="0" cellpadding="1" cellspacing="0">
<!--DWLayoutDefaultTable-->
<tr>
<td width="10" valign="top" bgcolor="#FFFFFF"><!--DWLayoutEmptyCell--> </td>
<td width="10" height="272" valign="top" bgcolor="#DDDDDD"><p> </p> </td>
<td width="173" valign="top" bgcolor="#DDDDDD"><p class="Normal"><a href="index.html">Home</a></p>
<p class="Normal">If you're new to Python <br />
and VPython: <a href="VisualIntro.html">Introduction</a></p>
<p class="Normal">A VPython <a href="VPython_Intro.pdf" target="_blank">tutorial</a></p>
<p class="Normal"><a href="primitives.html">Pictures</a> of 3D objects</p>
<p><select id="menu1" onchange="jumpMenu(this)"></select></p>
<p><select id="menu2" onchange="jumpMenu(this)"></select></p>
<p><select id="menu3" onchange="jumpMenu(this)"></select></p>
<p class="Normal"><a href="new_features.html">What's new</a></p>
<p class="Normal"><a href="http://vpython.org" target="_blank">Classic VPython web site</a><br />
<a href="license.txt" target="_blank">VPython license</a><br />
<a href="http://www.python.org" target="_blank">Python web site</a> <br /></p></td>
<td width="21" valign="top" bgcolor="#FFFFFF"><!--DWLayoutEmptyCell--> </td>
<td width="586" rowspan="2" valign="top"><!-- InstanceBeginEditable name="content" -->
<table width="100%" border="1">
<tr>
<td width="21%"><div align="center"><span class="style2"><font color="#0000A0">text</font></span></div></td>
<td width="79%"><div align="center"><img src="images/newtext3d.png" alt="3D text" width="447" height="207" /></div></td>
</tr>
</table>
<p class="Normal">See the <a href="text_output.html"><strong>Text Output</strong></a> discussion for additional ways to output text in the GlowScript environment.</p>
<p class="Normal">With the text object you can display 3D text. The
green 3D text shown above was created with the following statement:</p>
<p class="program"> T = text(text='My text is\ngreen',<br />
align='center', color=color.green)</p>
<p class="Normal">Labels were added to the display above to illustrate
some of the main attributes of the text object. Whether you extrude into or out of the screen, the text is created so that it is readable left to right from the normal viewing position, in the +z direction.</p>
<p class="Normal"><strong>Limitations:</strong> It is important to know that this 3D text object is very complex and expensive to display, nor can you modify the letters displayed once the object has been created. If for example you want to display rapidly changing text, use the <strong><a href="label.html">label object</a></strong> (displayed in front of the canvas) or the <strong><a href="controls.html">wtext object</a></strong><a href="controls.html"></a> (displayed above the canvas as part of the title or below the canvas as part of the caption). Also see the section "Displaying text" of the <strong><a href="canvas.html">canvas documentation</a></strong>.</p>
<p class="Normal">Currently this 3D text object does not handle HTML options, such as bold, italic, subscript, or superscript. The label and wtext objects do however support these options.</p>
<p class="Normal">3D text is made out of <a href="triangle.html"><strong>quads</strong></a> and <a href="triangle.html"><strong>triangles</strong></a> which are then made into a <a href="compound.html"><strong>compound</strong></a> object for speed of display. You can make additional copies of a text object by <a href="clone.html">cloning</a> it. You can move the text by specifying a new <span class="attribute">pos</span>, and you can change its <span class="attribute">axis</span>, <span class="attribute">up</span>, <span class="attribute">color</span>, <span class="attribute">opacity</span>, <span class="attribute">shininess</span>, and <span class="attribute">emissive</span>, as with other objects, but note that color and size are "multiplicative"; see <a href="compound.html"><strong>compound</strong></a>.</p>
<p class="Normal"><strong><em>The 3D text object does not have a <span class="attribute">size</span> attribute.</em></strong> Instead, the size of the display is specified by <span class="attribute">height</span>, <span class="attribute">length</span> and <span class="attribute">depth</span> as discussed below.</p>
<p class="Normal">Here
is a list of text attributes, in addition to the usual attributes of canvas, color, shininess, and opacity (but not texture or bumpmap, currently):</p>
<p class="attributes"> <span class="attribute">pos</span> The
location of the baseline of the text, to the left, to the right,
or at the center of the text, as per align.<span class="attribute"></span><span class="attribute"></span></p>
<p class="attributes"> <span class="attribute">align </span>Specify 'left'
(default), 'right', or 'center'.</p>
<p class="attributes"> <span class="attribute">text</span> The text to
be displayed, such as "My text is\ngreen" in the example above ('\n' is a new-line character).
Unicode strings are supported. After creating the object, the text is read-only -- it cannot be changed. The reason for this is that it takes a significant portion of a second to create a 3D text object. If you need to change the text, make the current object invisible (visible=False) and create a new object. The text need not be a string; it can be anything that you could print.</p>
<p class="attributes"> <span class="attribute">height</span> Height
of an uppercase letter (see above); default is 1. Specifying the
height when creating the text object sets the scale for the entire text display. After creating the 3D text, you can change the height of the object. For example, if you say T.height = 0.5*T.height, the letters become shorter but the length stays the same. Changing
the height also changes descent and vertical_spacing.</p>
<p class="attributes"><span class="attribute">length</span> length
of the displayed text. You cannot specify a length when creating the 3D text, but you can change this later. For example, if you say T.length = 0.5*T.length, the letters become narrower but the height stays the same.</p>
<p class="attributes"><span class="attribute">depth</span> Depth
of the text; the default is 0.2 times the height when creating the 3D text. A positive number means extrude toward you, out of the screen; negative
means extrude away from you, into the screen. After creating the 3D text, you can change this. For example, if you say T.depth = 2*T.depth, the letters become twice as thick. If the depth is zero, the thickness is made to be 0.01 times the height, and the text looks like a thin sheet.</p>
<p class="attributes"> <span class="attribute">font </span>Name of
the desired font, either "sans" (sans serif, the default) or "serif". This is read-only.</p>
<p class="attributes"><span class="attribute">billboard</span> In computer graphics "billboard" behavior means that the object always faces you, no matter how you reorient the camera. Specifying billboard = True when creating the text turns this on, and then is read-only. Because lighting changes as you rotate the camera, you may wish to specify emissive = True, so that the text is always bright.</p>
<p class="attributes"> <span class="attribute">color </span>The color of the text.</p>
<p class="attributes"><span class="attribute">start_face_color</span> and <span class="attribute">end_face_color</span> By default,the starting and ending faces are given the same color as the rest of the text, as specified by <span class="attribute">color</span>, but you can specify that other colors be used for the starting or ending face of the extruded text.</p>
<p class="attributes"><span class="attribute">show_start_face</span> and <span class="attribute">show_end_face</span> By default, these attributes are True and the start and end faces of the extruded text are displayed. If you set one of these to False, that face is left open.</p>
<p class="attributes"><span class="attribute">descender</span> Height
of the descender on lower-case letters such as y (whether or not
there is such a letter in the text). This is typically about 0.3
times the height. This is read-only but is affected by changes in height.</p>
<p class="attributes"> <span class="attribute">upper_left, upper_right,
lower_right, lower_left </span>The bounding box of the displayed
text; all of these are read-only. For example, if you create <span class="program"><strong>title = text(text="My Text")</strong></span>,
you can place a sphere at the upper left corner with the statement <strong>sphere(pos=title.upper_left</strong>). See the screen display above.</p>
<p class="attributes"> <span class="attribute">start, end </span> The left-most and right-most
locations on the baseline. These are read-only. If align is 'left', pos is the same as start. If align is 'right', pos is the same as end.</p>
<p class="attributes"><span class="attribute">vertical_spacing</span> Vertical
distance from one baseline to the next in a multiline text. This is read-only.</p>
<p class="attributes"><span class="attribute">axis</span> The axis
points along the baseline; changing the axis changes the orientation
of text. The default is vector(1,0,0), with text going toward the right. Changing the axis only affects the direction of the line of text, not the length or size.</p>
<p class="attributes"> <span class="attribute">up</span> Controls
the up attribute of the text; changing up makes the text tip away
from the vertical.</p>
<!-- InstanceEndEditable --></td>
</tr>
<tr>
<td height="16" colspan="4"></td>
</tr>
</table>
</body>
<script type="text/javascript" language="javascript" src="navigation.js"></script>
<!-- InstanceEnd --></html>
You can’t perform that action at this time.
