Skip to content

Commit

Permalink
Add direction option
Browse files Browse the repository at this point in the history
  • Loading branch information
AviadSofer committed Apr 1, 2021
1 parent d338882 commit 889013e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/textToImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const defaults = {

const createTextData = (
text,
direction,
maxWidth,
fontSize,
lineHeight,
Expand All @@ -43,6 +44,9 @@ const createTextData = (
}
textContext.textAlign = textAlign;

// set direction
textContext.direction = direction;

// make background the color passed in
textContext.fillStyle = bgColor;
textContext.fillRect(0, 0, textCanvas.width, textCanvas.height);
Expand Down Expand Up @@ -108,6 +112,7 @@ const createTextData = (
const createCanvas = (content, conf) => {
const textData = createTextData(
content,
conf.direction,
conf.maxWidth - conf.margin,
conf.fontSize,
conf.lineHeight,
Expand Down

0 comments on commit 889013e

Please sign in to comment.