Skip to content

Commit

Permalink
Make sure font family works for SLD as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van den Eijnden committed Mar 3, 2015
1 parent dd9b49c commit d3ffa55
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lib/edit/style/SLDStyleConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ exports.SLDStyleConverter = function() {
};
},
createTextSymbolizer: function(style) {
var fontFamily;
if (style.label.fontFamily === 'serif') {
fontFamily = 'Serif';
} else if (style.label.fontFamily === 'sans-serif') {
fontFamily = 'SansSerif';
} else if (style.label.fontFamily === 'cursive') {
fontFamily = 'Comic Sans MS';
} else if (style.label.fontFamily === 'monospace') {
fontFamily = 'Courier New';
}
return {
name: {
localPart: 'TextSymbolizer',
Expand Down Expand Up @@ -243,7 +253,7 @@ exports.SLDStyleConverter = function() {
font: {
cssParameter: [{
name: 'font-family',
content: [style.label.fontFamily]
content: [fontFamily]
}, {
name: 'font-size',
content: [String(style.label.fontSize)]
Expand Down
2 changes: 1 addition & 1 deletion test/test-SLDStyleConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('SLDStyleConverter', function() {
"label": {
"attribute": "foo",
"fillColor": "#000000",
"fontFamily": "Serif",
"fontFamily": "serif",
"fontSize": 10,
"fontStyle": "normal",
"fontWeight": "normal"
Expand Down

0 comments on commit d3ffa55

Please sign in to comment.