Added Support for testBaseline
This commit is contained in:
parent
a8203ee337
commit
d9834027c5
@ -65,6 +65,13 @@
|
|||||||
return mapping[textAlign] || mapping.start;
|
return mapping[textAlign] || mapping.start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//helper function to map canvas-textBaseline to svg-dominantBaseline
|
||||||
|
function getDominantBaseline(textBaseline) {
|
||||||
|
//INFO: not supported in all browsers
|
||||||
|
var mapping = {"alphabetic": "alphabetic", "hanging": "hanging", "top":"text-before-edge", "bottom":"text-after-edge", "middle":"central"};
|
||||||
|
return mapping[textBaseline] || mapping.start;
|
||||||
|
}
|
||||||
|
|
||||||
// Unpack entities lookup where the numbers are in radix 32 to reduce the size
|
// Unpack entities lookup where the numbers are in radix 32 to reduce the size
|
||||||
// entity mapping courtesy of tinymce
|
// entity mapping courtesy of tinymce
|
||||||
namedEntities = createNamedToNumberedLookup(
|
namedEntities = createNamedToNumberedLookup(
|
||||||
@ -757,7 +764,8 @@
|
|||||||
"text-decoration" : font.decoration,
|
"text-decoration" : font.decoration,
|
||||||
"x" : x,
|
"x" : x,
|
||||||
"y" : y,
|
"y" : y,
|
||||||
"text-anchor": getTextAnchor(this.textAlign)
|
"text-anchor": getTextAnchor(this.textAlign),
|
||||||
|
"dominant-baseline": getDominantBaseline(this.textBaseline)
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
textElement.appendChild(document.createTextNode(text));
|
textElement.appendChild(document.createTextNode(text));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user