Improve vertical font placement in Firefox
This commit is contained in:
@@ -323,19 +323,19 @@ ol.render.canvas.TextReplay.prototype.getImage = function(text, textKey, fillKey
|
|||||||
if (fillKey) {
|
if (fillKey) {
|
||||||
context.fillStyle = fillState.fillStyle;
|
context.fillStyle = fillState.fillStyle;
|
||||||
}
|
}
|
||||||
context.textBaseline = 'top';
|
context.textBaseline = 'middle';
|
||||||
context.textAlign = 'center';
|
context.textAlign = 'center';
|
||||||
var leftRight = (0.5 - align);
|
var leftRight = (0.5 - align);
|
||||||
var x = align * label.width / scale + leftRight * strokeWidth;
|
var x = align * label.width / scale + leftRight * strokeWidth;
|
||||||
var i;
|
var i;
|
||||||
if (strokeKey) {
|
if (strokeKey) {
|
||||||
for (i = 0; i < numLines; ++i) {
|
for (i = 0; i < numLines; ++i) {
|
||||||
context.strokeText(lines[i], x + leftRight * widths[i], 0.5 * strokeWidth + i * lineHeight);
|
context.strokeText(lines[i], x + leftRight * widths[i], 0.5 * (strokeWidth + lineHeight) + i * lineHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fillKey) {
|
if (fillKey) {
|
||||||
for (i = 0; i < numLines; ++i) {
|
for (i = 0; i < numLines; ++i) {
|
||||||
context.fillText(lines[i], x + leftRight * widths[i], 0.5 * strokeWidth + i * lineHeight);
|
context.fillText(lines[i], x + leftRight * widths[i], 0.5 * (strokeWidth + lineHeight) + i * lineHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user