Skip to content

Commit 0a1f7a8

Browse files
committed
implementation
1 parent 10d5558 commit 0a1f7a8

File tree

33 files changed

+209
-17
lines changed

33 files changed

+209
-17
lines changed

src/components/annotations/draw.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ function drawRaw(gd, options, index, subplotId, xa, ya) {
198198
fontColor: hoverFont.color,
199199
fontWeight: hoverFont.weight,
200200
fontStyle: hoverFont.style,
201-
fontVariant: hoverFont.variant
201+
fontVariant: hoverFont.variant,
202+
fontShadow: hoverFont.fontShadow,
203+
fontStriding: hoverFont.fontStriding,
204+
fontCapitalize: hoverFont.fontCapitalize,
202205
}, {
203206
container: fullLayout._hoverlayer.node(),
204207
outerContainer: fullLayout._paper.node(),

src/components/colorbar/defaults.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) {
128128
weight: font.weight,
129129
style: font.style,
130130
variant: font.variant,
131+
capitalize: font.capitalize,
132+
striding: font.striding,
133+
shadow: font.shadow,
131134
color: font.color,
132135
size: Lib.bigFont(tickFont.size)
133136
});

src/components/drawing/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,9 @@ drawing.textPointStyle = function(s, trace, gd) {
11641164
weight: d.tw || trace.textfont.weight,
11651165
style: d.ty || trace.textfont.style,
11661166
variant: d.tv || trace.textfont.variant,
1167+
capitalize: d.tC || trace.textfont.capitalize,
1168+
striding: d.tE || trace.textfont.striding,
1169+
shadow: d.tS || trace.textfont.shadow,
11671170
size: fontSize,
11681171
color: fontColor
11691172
})

src/components/fx/hover.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,9 @@ function createHoverText(hoverData, opts) {
961961
var fontWeight = opts.fontWeight || fullLayout.font.weight;
962962
var fontStyle = opts.fontStyle || fullLayout.font.style;
963963
var fontVariant = opts.fontVariant || fullLayout.font.variant;
964+
var fontCapitalize = opts.fontCapitalize || fullLayout.font.capitalize;
965+
var fontStriding = opts.fontStriding || fullLayout.font.striding;
966+
var fontShadow = opts.fontShadow || fullLayout.font.shadow;
964967

965968
var c0 = hoverData[0];
966969
var xa = c0.xa;
@@ -1045,6 +1048,9 @@ function createHoverText(hoverData, opts) {
10451048
weight: commonLabelOpts.font.weight || fontWeight,
10461049
style: commonLabelOpts.font.style || fontStyle,
10471050
variant: commonLabelOpts.font.variant || fontVariant,
1051+
capitalize: commonLabelOpts.font.capitalize || fontCapitalize,
1052+
striding: commonLabelOpts.font.striding || fontStriding,
1053+
shadow: commonLabelOpts.font.shadow || fontShadow,
10481054
family: commonLabelOpts.font.family || fontFamily,
10491055
size: commonLabelOpts.font.size || fontSize,
10501056
color: commonLabelOpts.font.color || contrastColor
@@ -1370,6 +1376,9 @@ function createHoverText(hoverData, opts) {
13701376
weight: fontWeight,
13711377
style: fontStyle,
13721378
variant: fontVariant,
1379+
capitalize: fontCapitalize,
1380+
striding: fontStriding,
1381+
shadow: fontShadow,
13731382
family: fontFamily,
13741383
size: fontSize
13751384
});
@@ -1413,7 +1422,10 @@ function createHoverText(hoverData, opts) {
14131422
color: d.fontColor || contrastColor,
14141423
weight: d.fontWeight || fontWeight,
14151424
style: d.fontStyle || fontStyle,
1416-
variant: d.fontVariant || fontVariant
1425+
variant: d.fontVariant || fontVariant,
1426+
capitalize: d.fontCapitalize || fontCapitalize,
1427+
striding: d.fontStriding || fontStriding,
1428+
shadow: d.fontShadow || fontShadow,
14171429
})
14181430
.text(text)
14191431
.attr('data-notex', 1)
@@ -1432,7 +1444,10 @@ function createHoverText(hoverData, opts) {
14321444
color: nameColor,
14331445
weight: d.fontWeight || fontWeight,
14341446
style: d.fontStyle || fontStyle,
1435-
variant: d.fontVariant || fontVariant
1447+
variant: d.fontVariant || fontVariant,
1448+
capitalize: d.fontCapitalize || fontCapitalize,
1449+
striding: d.fontStriding || fontStriding,
1450+
shadow: d.fontShadow || fontShadow,
14361451
}).text(name)
14371452
.attr('data-notex', 1)
14381453
.call(svgTextUtils.positionText, 0, 0)

src/components/legend/style.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ module.exports = function style(s, gd, legend) {
247247
dEdit.tw = boundVal('textfont.weight', pickFirst);
248248
dEdit.ty = boundVal('textfont.style', pickFirst);
249249
dEdit.tv = boundVal('textfont.variant', pickFirst);
250+
dEdit.tC = boundVal('textfont.capitalize', pickFirst);
251+
dEdit.tE = boundVal('textfont.striding', pickFirst);
252+
dEdit.tS = boundVal('textfont.shadow', pickFirst);
250253
}
251254

252255
dMod = [Lib.minExtend(d0, dEdit)];

src/components/titles/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ function draw(gd, titleClass, options) {
7171
var fontWeight = font.weight;
7272
var fontStyle = font.style;
7373
var fontVariant = font.variant;
74+
var fontCapitalize = font.capitalize;
75+
var fontStriding = font.striding;
76+
var fontShadow = font.shadow;
7477

7578
// only make this title editable if we positively identify its property
7679
// as one that has editing enabled.
@@ -151,7 +154,10 @@ function draw(gd, titleClass, options) {
151154
opacity: opacity * Color.opacity(fontColor),
152155
'font-weight': fontWeight,
153156
'font-style': fontStyle,
154-
'font-variant': fontVariant
157+
'font-variant': fontVariant,
158+
'text-transform': Drawing.capitalize2transform(fontCapitalize),
159+
'text-shadow': fontShadow === 'auto' ? svgTextUtils.makeTextShadow(Color.contrast(fontColor)) : fontShadow,
160+
'text-decoration-line': Drawing.striding2decorationLine(fontStriding),
155161
})
156162
.attr(attributes)
157163
.call(svgTextUtils.convertToTspans, gd);

src/lib/coerce.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ exports.coerceFont = function(coerce, attr, dfltObj, opts) {
469469
out.weight = coerce(attr + '.weight', dfltObj.weight);
470470
out.style = coerce(attr + '.style', dfltObj.style);
471471
if(!opts.noFontVariant) out.variant = coerce(attr + '.variant', dfltObj.variant);
472+
if(!opts.noFontShadow) out.shadow = coerce(attr + '.shadow', dfltObj.shadow);
473+
if(!opts.noFontStriding) out.striding = coerce(attr + '.striding', dfltObj.striding);
474+
if(!opts.noFontCapitalize) out.capitalize = coerce(attr + '.capitalize', dfltObj.capitalize);
472475

473476
return out;
474477
};

src/plots/cartesian/axes.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,9 @@ function tickTextObj(ax, x, text) {
17401740
fontWeight: tf.weight,
17411741
fontStyle: tf.style,
17421742
fontVariant: tf.variant,
1743+
fontCapitalize: tf.capitalize,
1744+
fontStriding: tf.striding,
1745+
fontShadow: tf.shadow,
17431746
fontColor: tf.color
17441747
};
17451748
}
@@ -3507,7 +3510,10 @@ axes.drawLabels = function(gd, ax, opts) {
35073510
color: d.fontColor,
35083511
weight: d.fontWeight,
35093512
style: d.fontStyle,
3510-
variant: d.fontVariant
3513+
variant: d.fontVariant,
3514+
capitalize: d.fontCapitalize,
3515+
striding: d.fontStriding,
3516+
shadow: d.fontShadow,
35113517
})
35123518
.text(d.text)
35133519
.call(svgTextUtils.convertToTspans, gd);

src/plots/cartesian/axis_defaults.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
116116
weight: font.weight,
117117
style: font.style,
118118
variant: font.variant,
119+
capitalize: font.capitalize,
120+
striding: font.striding,
121+
shadow: font.shadow,
119122
size: Lib.bigFont(font.size),
120123
color: dfltFontColor
121124
});

src/plots/cartesian/tick_label_defaults.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
3131
weight: font.weight,
3232
style: font.style,
3333
variant: font.variant,
34+
capitalize: font.capitalize,
35+
striding: font.striding,
36+
shadow: font.shadow,
3437
size: font.size,
3538
color: dfltFontColor
3639
});

0 commit comments

Comments
 (0)