mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix
This commit is contained in:
@@ -43,7 +43,7 @@ export async function drawTimePattern(data: {
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
// 加载背景图
|
||||
const backgroundImage = await loadImage(path.join(current_path,'.\\fonts\\post.jpg'));
|
||||
const backgroundImage = await loadImage(path.join(current_path,'./fonts/post.jpg'));
|
||||
const pattern = ctx.createPattern(backgroundImage, 'repeat');
|
||||
ctx.fillStyle = pattern;
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
|
@@ -29,7 +29,7 @@ export async function drawJsonContent(jsonContent: string) {
|
||||
const finalCanvas = createCanvas(width, height);
|
||||
const finalCtx = finalCanvas.getContext('2d');
|
||||
|
||||
const backgroundImage = await loadImage(path.join(current_path,'.\\fonts\\post.jpg'));
|
||||
const backgroundImage = await loadImage(path.join(current_path,'./fonts/post.jpg'));
|
||||
const pattern = finalCtx.createPattern(backgroundImage, 'repeat');
|
||||
finalCtx.fillStyle = pattern;
|
||||
finalCtx.fillRect(0, 0, width, height);
|
||||
|
@@ -1,9 +1,10 @@
|
||||
import { dirname, join } from 'node:path';
|
||||
|
||||
import { NCoreInitShell } from './base';
|
||||
import { GlobalFonts } from '@napi-rs/canvas';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { current_path } from '@/plugin/data';
|
||||
import path from 'path';
|
||||
|
||||
let current_path = dirname(fileURLToPath(import.meta.url));
|
||||
GlobalFonts.registerFromPath(join(current_path, '.\\fonts\\JetBrainsMono.ttf'), 'JetBrains Mono');
|
||||
GlobalFonts.registerFromPath(join(current_path, '.\\fonts\\AaCute.ttf', 'Aa偷吃可爱长大的'));
|
||||
GlobalFonts.registerFromPath(path.join(current_path, './fonts/JetBrainsMono.ttf'), 'JetBrains Mono');
|
||||
GlobalFonts.registerFromPath(path.join(current_path, './fonts/AaCute.ttf'), 'Aa偷吃可爱长大的');
|
||||
console.log('字体注册完成');
|
||||
NCoreInitShell();
|
Reference in New Issue
Block a user