From a653fe559cb04d3e302bfb13fd3b390141c0417a Mon Sep 17 00:00:00 2001 From: allyoucanmap Date: Tue, 23 May 2017 11:37:12 +0200 Subject: [PATCH] Fixed font family and size on print --- web/client/components/print/Font.jsx | 7 +++++-- web/client/plugins/print/index.js | 1 + web/client/utils/PrintUtils.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/client/components/print/Font.jsx b/web/client/components/print/Font.jsx index c3ea0435f1..07e0239bb7 100644 --- a/web/client/components/print/Font.jsx +++ b/web/client/components/print/Font.jsx @@ -15,6 +15,7 @@ const Font = React.createClass({ fonts: React.PropTypes.array, label: React.PropTypes.string, onChangeFamily: React.PropTypes.func, + onChangeName: React.PropTypes.func, onChangeSize: React.PropTypes.func, onChangeBold: React.PropTypes.func, onChangeItalic: React.PropTypes.func, @@ -28,6 +29,7 @@ const Font = React.createClass({ fonts: ['Verdana', 'Serif', 'SansSerif', 'Arial', 'Courier New', 'Tahoma', 'Times New Roman'], label: 'Font', onChangeFamily: () => {}, + onChangeName: () => {}, onChangeSize: () => {}, family: '', size: 8, @@ -37,9 +39,10 @@ const Font = React.createClass({ }, onChangeFamily(family) { this.props.onChangeFamily(family); + this.props.onChangeName(family); }, - onChangeSize(size) { - this.props.onChangeSize(size); + onChangeSize(e) { + this.props.onChangeSize(parseFloat(e.target.value)); }, render() { return ( diff --git a/web/client/plugins/print/index.js b/web/client/plugins/print/index.js index 9ce72f58d0..141afabb02 100644 --- a/web/client/plugins/print/index.js +++ b/web/client/plugins/print/index.js @@ -119,6 +119,7 @@ const Font = connect((state) => ({ italic: state.print && state.print.spec && state.print.spec.italic }), { onChangeFamily: setPrintParameter.bind(null, 'fontFamily'), + onChangeName: setPrintParameter.bind(null, 'fontName'), onChangeSize: setPrintParameter.bind(null, 'fontSize'), onChangeBold: setPrintParameter.bind(null, 'bold'), onChangeItalic: setPrintParameter.bind(null, 'italic') diff --git a/web/client/utils/PrintUtils.js b/web/client/utils/PrintUtils.js index 64e213841c..2e05ca6148 100644 --- a/web/client/utils/PrintUtils.js +++ b/web/client/utils/PrintUtils.js @@ -206,7 +206,7 @@ const PrintUtils = { width: spec.iconSize, minSymbolSize: spec.iconSize, fontFamily: spec.fontFamily, - LEGEND_OPTIONS: "forceLabels:" + (spec.forceLabels ? "on" : "") + ";fontAntialiasing:" + spec.antiAliasing + ";dpi:" + spec.legendDpi + ";fontStyle:" + (spec.bold && "bold" || (spec.italic && "italic") || ''), + LEGEND_OPTIONS: "forceLabels:" + (spec.forceLabels ? "on" : "") + ";fontAntialiasing:" + spec.antiAliasing + ";dpi:" + spec.legendDpi + ";fontStyle:" + (spec.bold && "bold" || (spec.italic && "italic") || '') + ";fontName:" + spec.fontFamily + ";fontSize:" + spec.fontSize, format: "image/png", ...assign({}, layer.params) }