Skip to content

Commit cff60fb

Browse files
committed
use Drawing.font to style titles
1 parent 84bc75c commit cff60fb

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/components/drawing/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ var textcase2transformOptions = {
6161
function textcase2transform(textcase) {
6262
return textcase2transformOptions[textcase];
6363
}
64-
drawing.textcase2transform = textcase2transform;
6564

6665
function decorline2decorationLine(decorline) {
6766
return (
@@ -73,7 +72,6 @@ function decorline2decorationLine(decorline) {
7372
.join(' ')
7473
);
7574
}
76-
drawing.decorline2decorationLine = decorline2decorationLine;
7775

7876
/*
7977
* Positioning helpers

src/components/titles/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,17 @@ function draw(gd, titleClass, options) {
147147

148148
titleEl.attr('transform', transformVal);
149149

150-
titleEl.style({
151-
'font-family': fontFamily,
152-
'font-size': d3.round(fontSize, 2) + 'px',
153-
fill: Color.rgb(fontColor),
154-
opacity: opacity * Color.opacity(fontColor),
155-
'font-weight': fontWeight,
156-
'font-style': fontStyle,
157-
'font-variant': fontVariant,
158-
'text-transform': Drawing.textcase2transform(fontTextcase),
159-
'text-shadow': fontShadow === 'auto' ? svgTextUtils.makeTextShadow(Color.contrast(fontColor)) : fontShadow,
160-
'text-decoration-line': Drawing.decorline2decorationLine(fontDecorline),
150+
titleEl.style('opacity', opacity * Color.opacity(fontColor))
151+
.call(Drawing.font, {
152+
color: Color.rgb(fontColor),
153+
size: d3.round(fontSize, 2),
154+
family: fontFamily,
155+
weight: fontWeight,
156+
style: fontStyle,
157+
variant: fontVariant,
158+
textcase: fontTextcase,
159+
shadow: fontShadow,
160+
decorline: fontDecorline,
161161
})
162162
.attr(attributes)
163163
.call(svgTextUtils.convertToTspans, gd);

0 commit comments

Comments
 (0)