This commit is contained in:
BIN
app/assets/fonts/NotoSansSC-Regular.ttf
Normal file
BIN
app/assets/fonts/NotoSansSC-Regular.ttf
Normal file
Binary file not shown.
@@ -47,7 +47,8 @@ const findTemplatePathBySite = (site) => {
|
|||||||
|
|
||||||
const findUnicodeFontPath = (site) => {
|
const findUnicodeFontPath = (site) => {
|
||||||
const safeSite = [1, 2, 3].includes(Number(site)) ? Number(site) : 1;
|
const safeSite = [1, 2, 3].includes(Number(site)) ? Number(site) : 1;
|
||||||
const primaryFileName = "NotoSansSC-VF.ttf";
|
const primaryFileName = "NotoSansSC-Regular.ttf";
|
||||||
|
const secondaryFileName = "NotoSansSC-VF.ttf";
|
||||||
const fallbackFileName = "NotoSansCJKsc-Regular.otf";
|
const fallbackFileName = "NotoSansCJKsc-Regular.otf";
|
||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
const candidatePaths = [
|
const candidatePaths = [
|
||||||
@@ -62,6 +63,17 @@ const findUnicodeFontPath = (site) => {
|
|||||||
path.join("/www/wwwroot/upload", primaryFileName),
|
path.join("/www/wwwroot/upload", primaryFileName),
|
||||||
path.join(`/www/wwwroot/worldshine${safeSite}`, "app", "assets", "fonts", primaryFileName),
|
path.join(`/www/wwwroot/worldshine${safeSite}`, "app", "assets", "fonts", primaryFileName),
|
||||||
path.join(`/www/wwwroot/worldshine${safeSite}-tspt`, "app", "assets", "fonts", primaryFileName),
|
path.join(`/www/wwwroot/worldshine${safeSite}-tspt`, "app", "assets", "fonts", primaryFileName),
|
||||||
|
path.join(ROOT_DIR, "app", "assets", "fonts", secondaryFileName),
|
||||||
|
path.join(ROOT_DIR, "app", "views", "upload", secondaryFileName),
|
||||||
|
path.join(ROOT_DIR, "client", "build", "upload", secondaryFileName),
|
||||||
|
path.join(ROOT_DIR, "client", "public", "upload", secondaryFileName),
|
||||||
|
path.join(cwd, "app", "assets", "fonts", secondaryFileName),
|
||||||
|
path.join(cwd, "app", "views", "upload", secondaryFileName),
|
||||||
|
path.join(cwd, "client", "build", "upload", secondaryFileName),
|
||||||
|
path.join(cwd, "client", "public", "upload", secondaryFileName),
|
||||||
|
path.join("/www/wwwroot/upload", secondaryFileName),
|
||||||
|
path.join(`/www/wwwroot/worldshine${safeSite}`, "app", "assets", "fonts", secondaryFileName),
|
||||||
|
path.join(`/www/wwwroot/worldshine${safeSite}-tspt`, "app", "assets", "fonts", secondaryFileName),
|
||||||
path.join(ROOT_DIR, "app", "assets", "fonts", fallbackFileName),
|
path.join(ROOT_DIR, "app", "assets", "fonts", fallbackFileName),
|
||||||
path.join(ROOT_DIR, "app", "views", "upload", fallbackFileName),
|
path.join(ROOT_DIR, "app", "views", "upload", fallbackFileName),
|
||||||
path.join(ROOT_DIR, "client", "build", "upload", fallbackFileName),
|
path.join(ROOT_DIR, "client", "build", "upload", fallbackFileName),
|
||||||
@@ -290,7 +302,7 @@ exports.exportRouteReportZip = async (req, res) => {
|
|||||||
return res.status(500).send({ message: `Missing PDF template for site ${site}.` });
|
return res.status(500).send({ message: `Missing PDF template for site ${site}.` });
|
||||||
}
|
}
|
||||||
if (!unicodeFontPath) {
|
if (!unicodeFontPath) {
|
||||||
return res.status(500).send({ message: "Missing Unicode font file: NotoSansSC-VF.ttf" });
|
return res.status(500).send({ message: "Missing Unicode font file: NotoSansSC-Regular.ttf" });
|
||||||
}
|
}
|
||||||
|
|
||||||
const [routes, drivers, vehicles] = await Promise.all([
|
const [routes, drivers, vehicles] = await Promise.all([
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const rootDir = path.resolve(__dirname, "..");
|
|||||||
const sourceDir = path.join(rootDir, "public", "upload");
|
const sourceDir = path.join(rootDir, "public", "upload");
|
||||||
const targetDir = path.join(rootDir, "build", "upload");
|
const targetDir = path.join(rootDir, "build", "upload");
|
||||||
const templates = ["pdf_templete1.pdf", "pdf_templete2.pdf", "pdf_templete3.pdf"];
|
const templates = ["pdf_templete1.pdf", "pdf_templete2.pdf", "pdf_templete3.pdf"];
|
||||||
const unicodeFontFiles = ["NotoSansSC-VF.ttf", "NotoSansCJKsc-Regular.otf"];
|
const unicodeFontFiles = ["NotoSansSC-Regular.ttf", "NotoSansSC-VF.ttf", "NotoSansCJKsc-Regular.otf"];
|
||||||
|
|
||||||
if (!fs.existsSync(targetDir)) {
|
if (!fs.existsSync(targetDir)) {
|
||||||
fs.mkdirSync(targetDir, { recursive: true });
|
fs.mkdirSync(targetDir, { recursive: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user