By default, the hershey_text class produces its geometry in the xy-plane at z = 0, and the text is drawn in the positive quadrant of the xy-plane with its base point at the origin (left and bottom justified). Justification can be changed in both the x and y directions (see MESSAGES). The height of the font is normalized to 1.0 in the y- direction. Thus the default height of a string is 1.0 * (number of lines) and its width is dependent on the string length and the selected font. All fonts are proportional spaced.
Strings can contain the two-character sequence "\n" to indicate a new line. Note that these two characters are literal. This is because the LYMB parser does not recognize the special C newline character. Multi-line blocks of text remain justified just as single line strings are, that is, a three-line string with left and bottom justification will have the lower-left corner of its bounding box anchored at the origin (assuming no other transformations have been applied).
font The name of the file describing the Hershey font set. The default is "futura.l".
horizontal_align The type of horizontal justification (left, center or right).
vertical_align The type of vertical justification (bottom, middle or top).
num_lines The number of polylines in the modeller's geometry.
num_vertices The number of vertices in the modeller's geometry.
font[=?] Set/get the name of the Hershey font file.
horizontal_align[=?] Set/get the horizontal justification value (usually set with the left!, center!, and right! messages).
vertical_align[=?] Set/get the vertical justification value (usually set with the top!, middle!, and bottom! messages).
left!, center!, right! Set the horizontal justification to left-justified, centered or right-justified.
top!, middle!, bottom! Set the vertical justification to top-flush, centered or bottom-flush.
num_vertices? Get the number of vertices. Although the class interface allows this value to be set, it should not be since it is a value computed by the hershey_text when it builds itself.
num_lines? Get the number of lines. Like num_vertices, this value should not be set since it is computed by the hershey_text when it builds itself.
open! Sends the geomtry to the rendering primitive.
renderer_name? Returns the suffix of the class name used to draw the model on the graphics display.
bounds? Returns the minimum and maximum x, y and z values of the model's vertices. This is used by the inherited "bounding_box?" method.
calculate! Converts the current string stored in the text instance variable to its polyline representation using the current font definition.
size= Sets the size of the text by sending itself a
"scale+(s,s,1)" message.
matrix? This message is overridden in hershey_text to overcome a slight problem. When a modeller is rendered, it is first asked for its transformation matrix by its attached actor(s). The hershey_text class has a side effect in that its transformation matrix is modified when the polyline geometry is built. This is done in order to normalize the height of the text to 1. Thus, when "matrix?" is sent to a hershey_text modeller, it must first ensure that the transformation matrix is correct. This is done by sending a "calculate!" to itself if the geometry is not current, which in turn rebuilds the transformation matrix. The "matrix?" message is then chained up to its parent class where it is handled normally.
hershey_text new: text_model text="This is a very\nsimple example\nof Hershey text" center! middle! ;
actor new: txt modeller=text_model ;