Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
212 views
in Technique[技术] by (71.8m points)

visual c++ - Unique Problem with AddFontResource() in c++

I have this unique problem. I am loading fonts with Python using code below:

gdi32 = ctypes.WinDLL('gdi32')
gdi32.AddFontResourceW.argtypes = (ctypes.c_wchar_p,)
gdi32.AddFontResourceW(FontsFileNamewithPAth)

While I am using c++ code in Visual Studio as below:

  int x =   AddFontResource(FontsFileNamewithPAth);

Both codes are working perfect Now the problem..

Fonts installed with C++ code are not rendering in windows word versions 2013 and above. Word 2010 and below its working perfect . On all other software they are working fine. In WORD, font is listed in the dropdown box but upon applying its not rendering.

While the same fonts installed with Python code are working fine.

I have C++ application and hence wants to use c++ code but This is something unique problem I am encountering.

I have tried using word "run with Administrator" and also in "Safe Mode" but problem was still the same.

It is important to note that problem is only in word versions 2013 and above.

Can anyone guide me what could be solution?

question from:https://stackoverflow.com/questions/65840384/unique-problem-with-addfontresource-in-c

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...