new LineFont()
Generates text in a shell or mesh using a line-based font.
Methods
-
this.addTextToBuffers(vertices, indices, coords, text [, align]) <static>
-
Adds text using a vector font to the given mesh vertex and index buffers.
Parameters:
Name Type Argument Description verticesArray.<number> A flat linear array for receiving x, y, z vertex coordinates.
indicesArray.<number> A flat linear array for receiving line vertex indexes.
coordsPD.LocalCoordinates The local coordinates to use for positioning the text.
textstring The text string to display. This is limited to the 7-bit ANSI character set (0-128).
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`{|}~.alignPD.ALIGN <optional>
The alignment of the text, defaults to LEFT on baseline.
Returns:
Returns this line font to support method chaining.
- Type
- PD.LineFont
-
this.addTextToMesh(mesh, coords, text [, align]) <static>
-
Adds text using a vector font to the given mesh.
Parameters:
Name Type Argument Description meshPD.PolyMesh The mesh to which the text lines will be added.
coordsPD.LocalCoordinates The local coordinates to use for positioning the text.
textstring The text string to display. This is limited to the 7-bit ANSI character set (0-128). !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`{|}~.
alignPD.ALIGN <optional>
The alignment of the text, defaults to LEFT on baseline.
Returns:
Returns the mesh to which the text lines were added.
- Type
- PD.PolyMesh
-
this.aspectRatio(aspect [, char_width] [, space_width]) <static>
-
Gets/sets the aspect ratio of text characters.
Parameters:
Name Type Argument Description aspectnumber The aspect ratio as a decimal value (0.1 - 10.0).
char_widthnumber <optional>
The relative width of each character (0.1 - 10.0).
space_widthnumber <optional>
The relative width of inter-word spacing (0.1 - 10.0).
Returns:
Returns this line font to support method chaining.
- Type
- object
-
this.averageKerning( [new_value]) <static>
-
Gets/sets the average horizontal kerning between characters. This value defaults to 1.40 times the character size.
Parameters:
Name Type Argument Description new_valuenumber <optional>
An optional new value for the kerning to (0.1 - 10.0).
Returns:
Returns the kerning value or this line font to support method chaining.
- Type
- object
-
this.fontSize( [new_value]) <static>
-
Gets/sets the character size of the font in model units.
This value defaults to 100mm and is effectively the height from the bottom to top in thE local Y axis of each character.
Parameters:
Name Type Argument Description new_valuenumber <optional>
An optional new value for the character size in model units.
Returns:
Returns the character size or this line font to support method chaining.
- Type
- object
-
this.getTextWidth(text) <static>
-
Retrieves the width of the vector text within the model. The width is always given in relative units, being the effective number of characters wide.
Parameters:
Name Type Description textstring The string to calculate the width of.
Returns:
Returns the width of the text in relative units.
- Type
- number
-
this.italicSlant( [new_value]) <static>
-
Gets/sets the level of italic slant in the X axis.
Parameters:
Name Type Argument Description new_valuenumber <optional>
An optional value to set the slant to (-1.0 to 1.0).
Returns:
Returns the italic slant or this line font to support method chaining.
- Type
- object
-
this.lineHeight( [new_value]) <static>
-
Gets/sets the vertical distance between each text line.
This value is given as a multiplier of the character size and defaults to 2.
Parameters:
Name Type Argument Description new_valuenumber <optional>
An optional new value for the line height.
Returns:
Returns the character size or this line font to support method chaining.
- Type
- object
-
this.resetMetrics() <static>
-
Resets all font style variable to their default values.
Returns:
Returns this line font to support method chaining.
- Type
- PD.LineFont
-
this.wordSpacing( [new_value]) <static>
-
Gets/sets the horizontal spacing between words. This value defaults to 0.8 times the character size.
Parameters:
Name Type Argument Description new_valuenumber <optional>
An optional new value for the word spacing to (0.1 - 10.0).
Returns:
Returns the word spacing or this line font to support method chaining.
- Type
- object