Skip to content

Commit

Permalink
修复svg无法渲染中文字体
Browse files Browse the repository at this point in the history
  • Loading branch information
jark006 committed Oct 22, 2024
1 parent 09a19b4 commit b2a932a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions jarkViewer/include/ImageDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,13 @@ class ImageDatabase:public LRU<wstring, Frames> {

cv::Mat loadSVG(const wstring& path, const vector<uchar>& buf){
const int maxEdge = 3840;
static bool isInitFont = false;

if (!isInitFont) {
isInitFont = true;
auto rc = Utils::GetResource(IDR_MSYHMONO_TTF, L"TTF");
lunasvg_add_font_face_from_data("", false, false, rc.addr, rc.size, nullptr, nullptr);
}

auto document = lunasvg::Document::loadFromData((const char*)buf.data(), buf.size());
if (!document) {
Expand Down
2 changes: 1 addition & 1 deletion jarkViewer/include/exifParse.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class ExifParse{
public:
static std::string getSimpleInfo(const wstring& path, int width, int height, const uint8_t* buf, size_t fileSize) {
return path.ends_with(L".ico") ?
return (path.ends_with(L".ico") || (width == 0 && height == 0)) ?
std::format("路径: {}\n大小: {}\n",
Utils::wstringToUtf8(path), Utils::size2Str(fileSize)) :
std::format("路径: {}\n大小: {}\n分辨率: {}x{}",
Expand Down
Binary file modified jarkViewer/jarkViewer.aps
Binary file not shown.
Binary file modified jarkViewer/jarkViewer.rc
Binary file not shown.
2 changes: 1 addition & 1 deletion jarkViewer/src/jarkViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
1. 部分AVIF图像仍不能正常解码 AVIF_RESULT_BMFF_PARSE_FAILED
*/

const wstring appName = L"JarkViewer v1.20";
const wstring appName = L"JarkViewer v1.21";



Expand Down

0 comments on commit b2a932a

Please sign in to comment.