Need help displaying Japanese text using GDI + without installing East Asian Language on Windows XP

I am writing a quiz program in Japanese, and I do not want to require people to install the East Asian language pack for Windows XP. I use GDI + to draw text. I tried to download the free Unicode font and use it to draw text. I tested it on my computer (with the package installed from East Asia), and it correctly displayed Japanese characters using the downloaded font, but it did not work on another computer without a language pack.

I am looking for suggestions on how to make this work. The program is quite simple and written in C ++ using only the Win32 API, GDI + and STL. If possible, I would like to stick to these very libraries. I have UNICODE #defined.

The code that I mainly use for drawing is pasted below:

#include <gdiplus.h>
using namespace Gdiplus ;

Graphics * gi ;

PrivateFontCollection _fonts ;
_fonts.AddFontFile(fontFilename) ;
Font * currentFont = new Font(fontName, fontSize, FontStyleRegular, UnitPoint, &_fonts) ;

std::wstring text = L"Some text" ;
gi->DrawString(text.c_str(), (INT)text.size(), currentFont, rectangle, &format, &brush) ;
+3
source share
3 answers

I was wrong. If you have a font that includes Japanese characters, it will display correctly in Windows XP, even if the East Asian Language Pack is not installed.

East Asian Language Pack, , Windows , , , . , , , , , .

Microsoft Meiryo Collection Version 5.00. , . - .

+1

. , , , . PNG, JPEG ( )

+1

There is also a Lucida Sans Unicode font that can help fix problems.

0
source

Source: https://habr.com/ru/post/1704484/


All Articles