Fixing the offset of vertical CJK text
This commit is contained in:
parent
077f08fa6d
commit
6c3e5e5d92
@ -1199,11 +1199,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||
if (textSelection) {
|
||||
geom.canvasWidth = canvasWidth;
|
||||
if (vertical) {
|
||||
var vmetric = font.defaultVMetrics;
|
||||
geom.x += vmetric[1] * fontSize * current.fontMatrix[0] /
|
||||
fontSizeScale * geom.hScale;
|
||||
geom.y += vmetric[2] * fontSize * current.fontMatrix[0] /
|
||||
fontSizeScale * geom.vScale;
|
||||
var VERTICAL_TEXT_ROTATION = Math.PI / 2;
|
||||
geom.angle += VERTICAL_TEXT_ROTATION;
|
||||
}
|
||||
this.textLayer.appendText(geom);
|
||||
}
|
||||
@ -1259,12 +1256,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||
if (textSelection) {
|
||||
geom.canvasWidth = canvasWidth;
|
||||
if (vertical) {
|
||||
var fontSizeScale = current.fontSizeScale;
|
||||
var vmetric = font.defaultVMetrics;
|
||||
geom.x += vmetric[1] * fontSize * current.fontMatrix[0] /
|
||||
fontSizeScale * geom.hScale;
|
||||
geom.y += vmetric[2] * fontSize * current.fontMatrix[0] /
|
||||
fontSizeScale * geom.vScale;
|
||||
var VERTICAL_TEXT_ROTATION = Math.PI / 2;
|
||||
geom.angle += VERTICAL_TEXT_ROTATION;
|
||||
}
|
||||
this.textLayer.appendText(geom);
|
||||
}
|
||||
|
@ -83,9 +83,6 @@ var TextLayerBuilder = function textLayerBuilder(options) {
|
||||
var textScale = textDiv.dataset.canvasWidth / width;
|
||||
var rotation = textDiv.dataset.angle;
|
||||
var transform = 'scale(' + textScale + ', 1)';
|
||||
if (bidiTexts[i].dir === 'ttb') {
|
||||
rotation += 90;
|
||||
}
|
||||
transform = 'rotate(' + rotation + 'deg) ' + transform;
|
||||
CustomStyle.setProp('transform' , textDiv, transform);
|
||||
CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%');
|
||||
@ -161,7 +158,7 @@ var TextLayerBuilder = function textLayerBuilder(options) {
|
||||
|
||||
textDiv.textContent = bidiText.str;
|
||||
// bidiText.dir may be 'ttb' for vertical texts.
|
||||
textDiv.dir = bidiText.dir === 'rtl' ? 'rtl' : 'ltr';
|
||||
textDiv.dir = bidiText.dir;
|
||||
}
|
||||
|
||||
this.setupRenderLayoutTimer();
|
||||
|
Loading…
Reference in New Issue
Block a user