JSignage:TextTutorial2
From SpinetiX Support Wiki
Description
Adding formatting to text
- Use multiple tspans to apply some formatting to selected portions of the text.
- The text attributes specified on a tspan override or complete the text attributes set on the textArea.
- The .tspan() methods returns this, so it is possible to call it repeatdly on the same object as shown below.
Source code
var layer = $.textArea({
left: 240,
top: 60,
width: 800,
height: 600,
frame: { frameColor: 'black', frameSize: 2 },
fontFamily: 'Georgia',
fontSize: 40
});
layer.text( $.tspan( 'This is some really ' ).tspan( 'cool', { fontStyle: 'italic', fontWeight: 'bold' } ).tspan( ' text.' ) );
layer.addTo( 'svg' );