start on making a text framework
This commit is contained in:
@@ -94,7 +94,7 @@ const wrapText = (
|
||||
return text.split("\n").flatMap((paragraph) => {
|
||||
const lines: string[] = [];
|
||||
let words = 0;
|
||||
let remainingText = paragraph.trim().replace(/\s+/g, " ");
|
||||
let remainingText = paragraph.trim().replace(/ +/g, " ");
|
||||
let oldLine = "";
|
||||
let countdown = 100;
|
||||
while (remainingText.length > 0) {
|
||||
@@ -131,7 +131,7 @@ const measureText = (
|
||||
allowWrap: boolean | undefined
|
||||
) => {
|
||||
const measure = context.measureText(text);
|
||||
const lineHeight = measure.emHeightAscent + measure.emHeightDescent;
|
||||
const lineHeight = 1.2 * (measure.emHeightAscent + measure.emHeightDescent);
|
||||
if (!allowWrap || !maxWidth) {
|
||||
return {
|
||||
width: measure.width,
|
||||
@@ -193,7 +193,7 @@ const drawTextCentered = (
|
||||
}
|
||||
}
|
||||
const measure = context.measureText(text);
|
||||
const lineHeight = measure.emHeightAscent + measure.emHeightDescent;
|
||||
const lineHeight = 1.2 * (measure.emHeightAscent + measure.emHeightDescent);
|
||||
context.textAlign = "center";
|
||||
context.textBaseline = "middle";
|
||||
if (allowWrap && maxWidth) {
|
||||
@@ -235,7 +235,7 @@ const drawStandardCard = async (
|
||||
// Draw the description
|
||||
drawTextCentered(
|
||||
context,
|
||||
"You may play an Action card from your hand.",
|
||||
"You may play an Action card from your hand costing up to \u202f◯\u202f.",
|
||||
w / 2,
|
||||
1520,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user