Skip to content

Commit

Permalink
fix bug in svg text color
Browse files Browse the repository at this point in the history
  • Loading branch information
skanaar committed Oct 27, 2019
1 parent 8571cab commit 50917bb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dist/nomnoml.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,10 @@ var nomnoml;
return newElement('path', { d: '' });
},
fillText: function (text, x, y) {
var attr = { x: tX(x), y: tY(y), style: '' };
var attr = { x: tX(x), y: tY(y), style: 'fill: ' + last(states).fill + ';' };
var font = lastDefined('font');
if (font.indexOf('bold') === -1) {
attr.style = 'font-weight:normal;';
attr.style += 'font-weight:normal;';
}
if (font.indexOf('italic') > -1) {
attr.style += 'font-style:italic;';
Expand Down
4 changes: 2 additions & 2 deletions src/skanaar.svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ namespace nomnoml.skanaar {
return newElement('path', {d:''})
},
fillText: function (text, x, y){
var attr = { x: tX(x), y: tY(y), style: '' }
var attr = { x: tX(x), y: tY(y), style: 'fill: '+last(states).fill+';' }
var font = lastDefined('font')
if (font.indexOf('bold') === -1) {
attr.style = 'font-weight:normal;'
attr.style += 'font-weight:normal;'
}
if (font.indexOf('italic') > -1) {
attr.style += 'font-style:italic;'
Expand Down
2 changes: 1 addition & 1 deletion test/box.style.nomnoml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#.box: fill=pink italic bold visual=rhomb
#.box: fill=pink stroke=red italic bold visual=rhomb
4 changes: 2 additions & 2 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h1>Svg</h1>
<div nomnoml=svg>
<script type="text/vnd.nomnoml">
#font: Arial
#.hello: underline
#.hello: underline stroke=teal fill=#ffa
[Pirate|
eyeCount: Int|
[a]--[b]
Expand Down Expand Up @@ -202,7 +202,7 @@ <h1>Label placement</h1>
</div>

<div class=testcase>
<h1>NodeJS render</h1>
<h1>CLI output</h1>
<img src="output.node-test.svg">
</div>

Expand Down

0 comments on commit 50917bb

Please sign in to comment.