flat assembler
Message board for the users of flat assembler.

Index > Windows > gdi text, asian characters

Author
Thread Post new topic Reply to topic
vivik



Joined: 29 Oct 2016
Posts: 671
vivik 07 Jun 2018, 16:52
So, I just tried to render a string that contains both english and japanese characters, and used "Courier New" font for that. Both were displayed correctly. And I'm pretty sure that Courier New doesn't have any japanese support in it. Which font was used for japanese?

Code:
                        HDC dc;
                        res = pdds->GetDC(&dc);
                        if (res != DD_OK) FUCK();


                        //TEXT("Courier New")
                        //TEXT("Impact")
                        //TEXT("MS PGothic")
                        //msgothic.ttc
                        HFONT hFont = CreateFont(24,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_OUTLINE_PRECIS,
                CLIP_DEFAULT_PRECIS,CLEARTYPE_QUALITY, FIXED_PITCH,TEXT("Courier New"));

                        SelectObject(dc, hFont);


                        RECT rect;
                        rect.top = 0;
                        rect.left = 0;
                        rect.right = 64;
                        rect.bottom = 64;
                        //DrawTextW(dc, L"hello!", -1, &rect, DT_NOCLIP);
                        DrawTextW(dc, L"はっはっは!suckers!lWlW", -1, &rect, DT_NOCLIP);
                        pdds->ReleaseDC(dc); //it's just a number    


Result:

Image


Last edited by vivik on 07 Jun 2018, 17:05; edited 2 times in total
Post 07 Jun 2018, 16:52
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 07 Jun 2018, 16:56
MS have been updating the font sets with lots of characters.

You can use the "character map" program to browse the available characters in each font.
Post 07 Jun 2018, 16:56
View user's profile Send private message Visit poster's website Reply with quote
vivik



Joined: 29 Oct 2016
Posts: 671
vivik 07 Jun 2018, 17:15
msgothic.ttc is 9MB, cour.ttf is 700KB, I can tell the difference without even opening them. I need to understand in which fonts windows seeks, if needed characters are missing.
Post 07 Jun 2018, 17:15
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 08 Jun 2018, 05:47
MS windows has font linking feature, some font with chinese characters is linked to the courier, and if courier font does not contain certain character the system searches linked fonts for such character.
Linking of fonts is set up in windows registry (I do not remember exact place)
Post 08 Jun 2018, 05:47
View user's profile Send private message Visit poster's website Reply with quote
vivik



Joined: 29 Oct 2016
Posts: 671
vivik 08 Jun 2018, 12:41
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink

https://docs.microsoft.com/en-us/globalization/input/font-technology

FontLink doesn't exist on my pc, maybe I can create it though. Looks kinda risky, I can break some other apps.

That same link says: "Each application and each operating system can define its own fallback font for any Unicode script range.". I wonder how though.
Post 08 Jun 2018, 12:41
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.