fix: add liberation fonts to Docker image and configure resvg to use them for label rendering
Build and Push Multi-Platform Images / build-and-push (push) Successful in 31s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 31s
This commit is contained in:
@@ -8,7 +8,7 @@ RUN npm run build
|
|||||||
|
|
||||||
# Production
|
# Production
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
RUN apk add --no-cache ghostscript imagemagick
|
RUN apk add --no-cache ghostscript imagemagick font-liberation fontconfig
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/dist ./dist
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
|
|||||||
@@ -89,7 +89,14 @@ export class LabelRendererService {
|
|||||||
${parts.join('\n ')}
|
${parts.join('\n ')}
|
||||||
</svg>`;
|
</svg>`;
|
||||||
|
|
||||||
const resvg = new Resvg(svg, { font: { loadSystemFonts: true } });
|
const resvg = new Resvg(svg, {
|
||||||
|
font: {
|
||||||
|
loadSystemFonts: true,
|
||||||
|
fontDirs: ['/usr/share/fonts', '/usr/local/share/fonts'],
|
||||||
|
defaultFontFamily: 'Liberation Sans',
|
||||||
|
sansSerifFamily: 'Liberation Sans',
|
||||||
|
},
|
||||||
|
});
|
||||||
return Buffer.from(resvg.render().asPng());
|
return Buffer.from(resvg.render().asPng());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user