Commit 504cb853 by 曹玉玺

处理字体

parent 515c9134
...@@ -7,12 +7,12 @@ ADD scratch-web /apps/scratch-web/ ...@@ -7,12 +7,12 @@ ADD scratch-web /apps/scratch-web/
WORKDIR /apps/scratch-web/ WORKDIR /apps/scratch-web/
# 安装思源宋体到系统字体目录并刷新缓存 # 安装思源宋体到系统字体目录并刷新缓存
RUN yum install -y fontconfig \ #RUN yum install -y fontconfig \
&& mkdir -p /usr/share/fonts/zhichan \ # && mkdir -p /usr/share/fonts/zhichan \
&& cp /apps/scratch-web/app/base/api/impl/fonts/SourceHanSerif-Regular.ttc /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 \ # && chmod 644 /usr/share/fonts/zhichan/SourceHanSerif-Regular.ttc \
&& fc-cache -fv \ # && fc-cache -fv \
&& yum clean all # && yum clean all
RUN cnpm install -S RUN cnpm install -S
CMD ["node","/apps/scratch-web/main.js"] CMD ["node","/apps/scratch-web/main.js"]
...@@ -389,8 +389,10 @@ async png2jpg (srcPng, dstJpg) { ...@@ -389,8 +389,10 @@ async png2jpg (srcPng, dstJpg) {
//.font(__dirname+"/fonts/heiti.otf") //.font(__dirname+"/fonts/heiti.otf")
var p = new Promise(function (resv, reject) { var p = new Promise(function (resv, reject) {
imageMagick(bs, bs, "#fff") 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) .fontSize(fs)
// .encoding("UTF-8")
.drawText(0, 0, word, "center") .drawText(0, 0, word, "center")
.write(destfile, function (err) { .write(destfile, function (err) {
if (!err) { if (!err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment