Skip to content

Fix Firefox toImage failures #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plots/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var extendFlat = Plotly.Lib.extendFlat;
module.exports = {
font: {
family: extendFlat({}, fontAttrs.family, {
dflt: '"Open sans", verdana, arial, sans-serif'
dflt: '"Open Sans", verdana, arial, sans-serif'
}),
size: extendFlat({}, fontAttrs.size, {
dflt: 12
Expand Down
4 changes: 2 additions & 2 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ plots.addLinks = function(gd) {
linkContainer.enter().append('text')
.classed('js-plot-link-container', true)
.style({
'font-family':'"Open Sans",Arial,sans-serif',
'font-size':'12px',
'font-family':'"Open Sans", Arial, sans-serif',
'font-size': '12px',
'fill': Plotly.Color.defaultLine,
'pointer-events': 'all'
})
Expand Down
15 changes: 14 additions & 1 deletion src/snapshot/tosvg.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,21 @@ module.exports = function toSVG(gd, format) {
// serialized svg because the style attribute itself is double-quoted!
// Is this an IE thing? Any other attributes or style elements that can have quotes in them?
// TODO: this looks like a noop right now - what happened to it?

/*
* Font-family styles with double quotes in them breaks the to-image
* step in FF42 because the style attribute itself is wrapped in
* double quotes. See:
*
* - http://codepen.io/etpinard/pen/bEdQWK
* - https://github.com/plotly/plotly.js/pull/104
*
* for more info.
*/
var ff = txt.style('font-family');
if(ff && ff.indexOf('"') !== -1) txt.style('font-family', ff.replace(/"/g, '"'));
if(ff && ff.indexOf('"') !== -1) {
txt.style('font-family', ff.replace(/"/g, '\\\''));
}
});

if(format === 'pdf' || format === 'eps') {
Expand Down