Use local font "Ubuntu Regular" for rendering tests

Set local font for all rendering tests including
TextStyles to enhance comparability on different
systems.
This commit is contained in:
Kai Volland
2019-03-21 14:43:54 +01:00
parent c4279ff665
commit 5665da6518
20 changed files with 4848 additions and 10 deletions

View File

@@ -90,7 +90,7 @@ layer2.setStyle(function(feature) {
return new Style({
text: new Text({
text: feature.get('text'),
font: '12px sans-serif'
font: '12px "Ubuntu Regular", sans-serif'
})
});
});
@@ -119,7 +119,7 @@ layer3.setStyle(function(feature) {
}),
text: new Text({
text: feature.get('text'),
font: '12px sans-serif',
font: '12px "Ubuntu Regular", sans-serif',
textBaseline: 'bottom',
offsetY: -5
})
@@ -151,7 +151,7 @@ line.setStyle(new Style({
text: new Text({
placement: 'line',
text: 'east-west',
font: '12px sans-serif'
font: '12px "Ubuntu Regular", sans-serif'
})
}));
source4.addFeature(point);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -23,6 +23,7 @@ feature1.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Hello world',
font: '"Ubuntu Regular", sans-serif',
placement: 'line'
})
}));
@@ -39,7 +40,7 @@ feature2.setStyle(new Style({
textBaseline: 'bottom',
textAlign: 'right',
placement: 'line',
font: 'bold italic 0.8em serif'
font: 'bold italic 0.8em "Ubuntu Regular", sans-serif'
})
}));
vectorSource.addFeature(feature2);
@@ -50,10 +51,11 @@ const feature3 = new Feature({geometry: lineString3});
feature3.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
font: '"Ubuntu Regular", sans-serif',
text: 'Set properties'
})
}));
feature3.getStyle().getText().setFont('bold italic 1.2em monospace');
feature3.getStyle().getText().setFont('bold italic 1.2em "Ubuntu Regular", sans-serif');
feature3.getStyle().getText().setTextAlign('left');
feature3.getStyle().getText().setOffsetX(10);
feature3.getStyle().getText().setOffsetY(-10);
@@ -71,6 +73,7 @@ feature4.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'negative offsetX',
font: '"Ubuntu Regular", sans-serif',
offsetX: -10,
textAlign: 'start',
textBaseline: 'top',
@@ -86,6 +89,7 @@ feature5.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Small text',
font: '"Ubuntu Regular", sans-serif',
offsetY: 5,
scale: 0.7,
textAlign: 'end',
@@ -101,6 +105,7 @@ feature6.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'FILL AND STROKE',
font: '"Ubuntu Regular", sans-serif',
placement: 'line',
fill: new Fill({color: '#FFC0CB'}),
stroke: new Stroke({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -20,6 +20,7 @@ feature1.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Hello world',
font: '"Ubuntu Regular", sans-serif',
placement: 'line',
overflow: true
})
@@ -37,7 +38,7 @@ feature2.setStyle(new Style({
textBaseline: 'bottom',
textAlign: 'right',
placement: 'line',
font: 'bold italic 0.8em serif',
font: 'bold italic 0.8em "Ubuntu Regular", sans-serif',
overflow: true
})
}));
@@ -72,6 +73,7 @@ feature4.setStyle(new Style({
stroke: new Stroke({color: 'red'}),
text: new Text({
text: 'PLEASE OMIT ME IM UGLY',
font: '"Ubuntu Regular", sans-serif',
offsetX: -10,
textAlign: 'start',
textBaseline: 'top',
@@ -88,6 +90,7 @@ feature5.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Small text',
font: '"Ubuntu Regular", sans-serif',
offsetY: 5,
scale: 0.7,
rotation: 4,
@@ -106,6 +109,7 @@ feature6.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'FILL AND STROKE',
font: '"Ubuntu Regular", sans-serif',
placement: 'line',
overflow: true,
fill: new Fill({color: '#FFC0CB'}),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -19,6 +19,7 @@ const vectorSource = new VectorSource();
const pointStyle = new Style({
text: new Text({
text: 'Point Label',
font: '"Ubuntu Regular", sans-serif',
fill: new Fill({
color: 'red'
}),
@@ -31,6 +32,7 @@ const lineStyle = new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Line Label',
font: '"Ubuntu Regular", sans-serif',
fill: new Fill({
color: 'red'
}),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -20,7 +20,7 @@ feature = new Feature({
feature.setStyle(new Style({
text: new Text({
text: 'hello',
font: '14px sans-serif',
font: '14px "Ubuntu Regular", sans-serif',
scale: 2,
fill: new Fill({
color: 'red'
@@ -39,7 +39,7 @@ feature = new Feature({
feature.setStyle(new Style({
text: new Text({
text: 'upside down',
font: '14px sans-serif',
font: '14px "Ubuntu Regular", sans-serif',
rotation: Math.PI,
stroke: new Stroke({
color: 'red',
@@ -55,6 +55,7 @@ feature = new Feature({
});
feature.setStyle(new Style({
text: new Text({
font: '"Ubuntu Regular", sans-serif',
text: 'rotateWithView',
rotateWithView: true,
stroke: new Stroke({
@@ -71,7 +72,7 @@ feature = new Feature({
feature.setStyle(new Style({
text: new Text({
text: 'hello',
font: '14px sans-serif',
font: '14px "Ubuntu Regular", sans-serif',
padding: [1, 2, 3, 5],
backgroundFill: new Fill({
color: 'rgba(55, 55, 55, 0.25)'
@@ -91,7 +92,7 @@ feature = new Feature({
feature.setStyle(new Style({
text: new Text({
text: 'hello',
font: '14px sans-serif',
font: '14px "Ubuntu Regular", sans-serif',
padding: [1, 2, 3, 5],
backgroundFill: new Fill({
color: 'rgba(55, 55, 55, 0.25)'