account for preview when sizing the title
This commit is contained in:
parent
055e42ecf7
commit
dc49eb961f
@ -103,7 +103,7 @@ export const cards: DominionCard[] = [
|
||||
image: "",
|
||||
artist: "",
|
||||
author: "Dylan",
|
||||
version: "0.1",
|
||||
version: "0.2",
|
||||
cost: "$3",
|
||||
preview: "$?",
|
||||
expansionIcon,
|
||||
|
10
src/draw.ts
10
src/draw.ts
@ -290,10 +290,16 @@ const drawStandardCard = async (
|
||||
context.drawImage(colorImage(getImage("card-brown"), "#ff9911"), 0, 0);
|
||||
// Draw the name
|
||||
context.fillStyle = colors.titleText;
|
||||
context.font = "90pt DominionText";
|
||||
const previewMeasure = await measureDominionText(
|
||||
context,
|
||||
parse(card.preview ?? "")
|
||||
);
|
||||
size = 78;
|
||||
context.font = `${size}pt DominionTitle`;
|
||||
while (
|
||||
(await measureDominionText(context, parse(card.title))).width > 1050
|
||||
(await measureDominionText(context, parse(card.title))).width >
|
||||
1050 - previewMeasure.width * 1.5
|
||||
) {
|
||||
size -= 1;
|
||||
context.font = `${size}pt DominionTitle`;
|
||||
@ -356,7 +362,7 @@ const drawStandardCard = async (
|
||||
await renderDominionText(context, parse(card.preview), 200, 210);
|
||||
await renderDominionText(context, parse(card.preview), w - 200, 210);
|
||||
}
|
||||
// Draw the icon
|
||||
// Draw the expansion icon
|
||||
// Draw the author credit
|
||||
context.fillStyle = "white";
|
||||
context.font = "31pt DominionText";
|
||||
|
Loading…
x
Reference in New Issue
Block a user