Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
504cb853
Commit
504cb853
authored
Apr 02, 2026
by
曹玉玺
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理字体
parent
515c9134
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
Dockerfile
+6
-6
scratch-web/app/base/api/impl/fonts/SourceHanSansSC-Regular.otf
+0
-0
scratch-web/app/base/api/impl/imghandle.js
+6
-4
No files found.
Dockerfile
View file @
504cb853
...
...
@@ -7,12 +7,12 @@ ADD scratch-web /apps/scratch-web/
WORKDIR
/apps/scratch-web/
# 安装思源宋体到系统字体目录并刷新缓存
RUN
yum install
-y
fontconfig
\
&&
mkdir
-p
/usr/share/fonts/zhichan
\
&&
cp /apps/scratch-web/app/base/api/impl/fonts/SourceHanSerif-Regular.ttc /usr/share/fonts/zhichan/
\
&&
chmod 644 /usr/share/fonts/zhichan/SourceHanSerif-Regular.ttc
\
&&
fc-cache
-fv
\
&&
yum clean all
#
RUN yum install -y fontconfig \
#
&& mkdir -p /usr/share/fonts/zhichan \
#
&& cp /apps/scratch-web/app/base/api/impl/fonts/SourceHanSerif-Regular.ttc /usr/share/fonts/zhichan/ \
#
&& chmod 644 /usr/share/fonts/zhichan/SourceHanSerif-Regular.ttc \
#
&& fc-cache -fv \
#
&& yum clean all
RUN
cnpm install
-S
CMD
["node","/apps/scratch-web/main.js"]
scratch-web/app/base/api/impl/fonts/SourceHanSansSC-Regular.otf
0 → 100644
View file @
504cb853
File added
scratch-web/app/base/api/impl/imghandle.js
View file @
504cb853
...
...
@@ -170,7 +170,7 @@ async png2jpg (srcPng, dstJpg) {
// var result = await this.ossClient.downfile(jpgpath);
var
downClient
=
system
.
getObject
(
"util.restClient"
);
var
result
=
await
downClient
.
execDownload
(
jpgpath
,
jpgpathtmp
);
//检查是否是 png
if
(
await
this
.
isPng
(
jpgpathtmp
))
{
let
pngPath
=
"/tmp/"
+
basename
+
".png"
...
...
@@ -180,14 +180,14 @@ async png2jpg (srcPng, dstJpg) {
await
this
.
png2jpg
(
pngPath
,
jpgpathtmp
)
fs
.
unlink
(
pngPath
,
function
(
err
)
{
});
}
//获取图片尺寸,判断是否需要横向 A4
var
imgSize
=
await
this
.
_getImgSize
(
jpgpathtmp
);
var
pageFormat
=
'a4'
;
// 默认竖向
if
(
imgSize
.
width
>
imgSize
.
height
)
{
pageFormat
=
'a4r'
;
// 横向 A4
}
//转换为 eps
var
cmd2eps
=
"jpeg2ps -p "
+
pageFormat
+
" "
+
jpgpathtmp
+
" -o "
+
epspath
;
var
x
=
await
this
.
execClient
.
exec
(
cmd2eps
);
...
...
@@ -389,8 +389,10 @@ async png2jpg (srcPng, dstJpg) {
//.font(__dirname+"/fonts/heiti.otf")
var
p
=
new
Promise
(
function
(
resv
,
reject
)
{
imageMagick
(
bs
,
bs
,
"#fff"
)
.
font
(
"/usr/share/fonts/zhichan/SourceHanSerif-Regular.ttc"
)
// .font(__dirname + "/fonts/songti.TTC")
.
font
(
__dirname
+
"/fonts/SourceHanSansSC-Regular.otf"
)
.
fontSize
(
fs
)
// .encoding("UTF-8")
.
drawText
(
0
,
0
,
word
,
"center"
)
.
write
(
destfile
,
function
(
err
)
{
if
(
!
err
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment