aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2012-12-21 11:11:00 +0100
committerwout <wout@impinc.co.uk>2012-12-21 11:11:00 +0100
commitb1516b2580dbdffd5ee68c75d4eb769b52faa100 (patch)
treef842efd4e31434a4c7f3834a9bae1911e6c50ff8 /README.md
parentf28a50eeb8a4c93512f65be5c8034d4d3d4fce82 (diff)
downloadsvg.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.md20
1 files changed, 19 insertions, 1 deletions
diff --git a/README.md b/README.md
index 57fa85f..60ca2aa 100644
--- a/README.md
+++ b/README.md
@@ -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