diff options
author | wout <wout@impinc.co.uk> | 2012-12-21 11:11:00 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2012-12-21 11:11:00 +0100 |
commit | b1516b2580dbdffd5ee68c75d4eb769b52faa100 (patch) | |
tree | f842efd4e31434a4c7f3834a9bae1911e6c50ff8 /README.md | |
parent | f28a50eeb8a4c93512f65be5c8034d4d3d4fce82 (diff) | |
download | svg.js-b1516b2580dbdffd5ee68c75d4eb769b52faa100.tar.gz svg.js-b1516b2580dbdffd5ee68c75d4eb769b52faa100.zip |
text font() method can be used as a getter
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -102,8 +102,15 @@ var text = draw.text({ y: 0 }); ``` -Styling text can be done using the 'font()' method: +Styling text can be done using the 'font()' method which is both a setter and a getter: ```javascript +// get a single font property +text.font('size'); + +// set a single font property +text.font('anchor', 'start'); + +// set multiple font properties at once text.font({ family: 'Helvetica', size: 36, @@ -115,6 +122,17 @@ Changing text afterwards is also possible with the 'text()' method: ```javascript text.text('Brilliant!'); ``` +To get the raw text content: +```javascript +text.content; +``` +Setting attributes like fill, opacity, x and y is the same as other elements: +```javascript +text.attr({ + fill: '#333', + x: 100 +}); +``` ### Image element |