Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit f5eb193

Browse files
authored
Merge pull request #14 from tancred423/11-profile-title
improve brackets on the title. fix fonts in dev environment
2 parents 56a7d10 + d99ffed commit f5eb193

5 files changed

Lines changed: 50 additions & 2 deletions

File tree

.gitattributes

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Enforce LF line endings for all text files
2+
* text=auto eol=lf
3+
4+
# Explicitly set LF for common file types
5+
*.yml text eol=lf
6+
*.yaml text eol=lf
7+
*.md text eol=lf
8+
*.json text eol=lf
9+
*.ts text eol=lf
10+
*.js text eol=lf
11+
*.tsx text eol=lf
12+
*.jsx text eol=lf
13+
*.sh text eol=lf
14+
*.bash text eol=lf
15+
*.dockerfile text eol=lf
16+
docker-compose*.yml text eol=lf
17+
18+
# Binary files
19+
*.png binary
20+
*.jpg binary
21+
*.jpeg binary
22+
*.gif binary
23+
*.otf binary
24+
*.ttf binary
25+
*.woff binary
26+
*.woff2 binary
27+

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ WORKDIR /app
2121
COPY deno.json deno.lock* ./
2222
COPY . .
2323

24+
# Copy fonts to both app directory (for registerFont) and system fonts directory
2425
RUN if [ -d "fonts" ] && [ "$(ls -A fonts 2>/dev/null)" ]; then \
2526
cp -r fonts/* /usr/share/fonts/custom/ && \
2627
fc-cache -fv; \

Dockerfile.dev

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ COPY deno.json deno.lock* ./
2323

2424
# Install npm:canvas
2525
RUN deno install --allow-scripts=npm:canvas
26+
27+
# Copy fonts directory
28+
COPY fonts/ /app/fonts/

src/index.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
MessageFlags,
1212
ModalSubmitInteraction,
1313
} from "discord.js";
14-
import { CanvasRenderingContext2D } from "canvas";
14+
import { CanvasRenderingContext2D, registerFont } from "canvas";
1515
import moment from "moment";
1616
import cron from "node-cron";
1717
import * as log from "@std/log";
@@ -56,6 +56,23 @@ export class GlobalClient {
5656
// Moment
5757
moment.locale("en");
5858

59+
// Register custom fonts for canvas
60+
const fontsPath = join(__dirname, "..", "fonts");
61+
try {
62+
registerFont(join(fontsPath, "MiedingerMediumW00-Regular.ttf"), {
63+
family: "MiedingerMediumW00-Regular",
64+
});
65+
registerFont(join(fontsPath, "MyriadPro-Regular.OTF"), {
66+
family: "myriad pro",
67+
});
68+
registerFont(join(fontsPath, "Romanus.otf"), {
69+
family: "romanus",
70+
});
71+
log.info("Custom fonts registered successfully");
72+
} catch (err) {
73+
log.error(`Failed to register fonts: ${err instanceof Error ? err.stack : String(err)}`);
74+
}
75+
5976
// Canvas lib - Add roundRect method to CanvasRenderingContext2D
6077
declare module "canvas" {
6178
interface CanvasRenderingContext2D {

src/service/ProfileGeneratorService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ class Profile {
238238
if (this.character.title) {
239239
ctx.fillStyle = theme.title;
240240
ctx.font = `normal 35px myriad pro`;
241-
ctx.fillText(`< ${this.character.title} >`, 450 / 2, 100, 410);
241+
ctx.fillText(`« ${this.character.title} »`, 450 / 2, 100, 410);
242242
}
243243

244244
// Name

0 commit comments

Comments
 (0)