JSignage:TextTutorial3

From SpinetiX Support Wiki

Jump to: navigation, search

Description

Automatic wrapping of text in an area

  • Text will wrap to multiple lines when it is too large to fit on one line.
  • Use the lineIncrement attribute of textArea to control the spacing between lines.
  • The default value is 110% of the font's size and this is generally too compact for long text.
  • Note as well how to include extended unicode character such as the reverse quotes in javascript strings.

Source code

$(function(){
      var theDuchess = "\u201CI quite agree with you. And the moral of that is: Be what you would seem to be, "
                     + "or if you'd like it put more simply: Never imagine yourself not to be otherwise than "
                     + "what it might appear to others that what you were or might have been was not otherwise "
                     + "than what you had been would have appeared to them to be otherwise.\u201D";

      $.textArea({
        left: 240,
        top: 60,
        width: 800,
        height: 600,
        textAlign: 'start',
        fontFamily: 'Georgia',
        fontSize: 36,
        lineIncrement: 48
      }).text( theDuchess ).addTo( 'svg' );

});

Preview

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