JSignage:TextTutorial4

From SpinetiX Support Wiki

Jump to: navigation, search

Description

Forcing line breaks

  • You can use the .tbreak() method to force line breaks.
  • .tbreak() works exactly like .tspan() but inserts a line break instead of text.

Source code

$(function(){
      var layer = $.textArea({
        left: 240,
        top: 60,
        width: 800,
        height: 600,
        textAlign: 'start',
        fontFamily: 'Georgia',
        fontSize: 36,
        lineIncrement: 48
      });

      var txt = $.tspan( "I quite agree with you." );
      txt.tbreak();
      txt.tspan( "And the moral of that is:" ).tbreak();
      txt.tspan( "Be what you would seem to be." ).tbreak();

      layer.text( txt ).addTo( 'svg' );

});

Preview

This page was last modified on 9 August 2017, at 17:21.