fix: 上传字体文件的时候,读取字体名作为默认值。

This commit is contained in:
taojinlong
2024-12-17 15:12:22 +08:00
committed by taojinlong
parent 7e7737bb05
commit bc7c528501
2 changed files with 4 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ResourceLoader;
import java.awt.*;
import java.io.*;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
@@ -181,9 +182,10 @@ public class FontManage {
unit = "KB";
size = Double.valueOf(String.format("%.2f", (double) length / 1024));
}
Font font = Font.createFont(Font.TRUETYPE_FONT, new File(filePath));
fontDto.setSize(size);
fontDto.setSizeType(unit);
fontDto.setName(font.getFontName());
} catch (Exception e) {
DEException.throwException(e);
}

View File

@@ -20,6 +20,7 @@ const uploadExcel = () => {
loading.value = true
return uploadFontFile(formData)
.then(res => {
ruleForm.name = res.data.name
ruleForm.size = res.data.size
ruleForm.sizeType = res.data.sizeType
ruleForm.fileTransName = res.data.fileTransName