mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
feat: add rtl render support (#2653)
This commit is contained in:

committed by
GitHub

parent
437b367d3b
commit
6947982848
@ -43,6 +43,7 @@ import {TextShadow} from '../../css/property-descriptors/text-shadow';
|
||||
import {PAINT_ORDER_LAYER} from '../../css/property-descriptors/paint-order';
|
||||
import {Renderer} from '../renderer';
|
||||
import {Context} from '../../core/context';
|
||||
import {DIRECTION} from '../../css/property-descriptors/direction';
|
||||
import {splitGraphemes} from 'text-segmentation';
|
||||
|
||||
export type RenderConfigurations = RenderOptions & {
|
||||
@ -174,6 +175,8 @@ export class CanvasRenderer extends Renderer {
|
||||
|
||||
this.ctx.font = font;
|
||||
|
||||
this.ctx.direction = styles.direction === DIRECTION.RTL ? 'rtl' : 'ltr';
|
||||
this.ctx.textAlign = 'left';
|
||||
this.ctx.textBaseline = 'alphabetic';
|
||||
const {baseline, middle} = this.fontMetrics.getMetrics(fontFamily, fontSize);
|
||||
const paintOrder = styles.paintOrder;
|
||||
|
Reference in New Issue
Block a user