diff options
Diffstat (limited to 'src/sugar.js')
-rw-r--r-- | src/sugar.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sugar.js b/src/sugar.js index 18f422e..b9ac577 100644 --- a/src/sugar.js +++ b/src/sugar.js @@ -54,6 +54,26 @@ SVG.extend(SVG.G, { }); +// Add text-specific functions +SVG.extend(SVG.Text, { + + // set font + font: function(o) { + var a = {}; + + for (var k in o) + k == 'leading' ? + a[k] = o[k] : + k == 'anchor' ? + a['text-anchor'] = o[k] : + this._s.indexOf(k) > -1 ? + a['font-'+ k] = o[k] : + void 0; + + return this.attr(a).text(this.content); + }, + +}); |