flat assembler
Message board for the users of flat assembler.

Index > Windows > how do i change font?

Author
Thread Post new topic Reply to topic
b1528932



Joined: 21 May 2010
Posts: 287
b1528932 29 Dec 2010, 16:59
how can i change font used by windows to write character byfunctions like TextOut()?
I have font with wrong mapings (i want diffrent glyph for sertain code points).

I have set a japanese codepage (ansi/oem), so programs using ANSI functions would go through them (GUI -> ansi, console -> oem). However, widechar functions use font wich contain wrong mappings of backslash. I dont know why is that, why font used by os changed, wheni set diffrent default code pages, it maes no sense! I belive that each code point should be represented by distinct glyph. Why backslash and yen share one then? Why this is no problem when using other default codepages?

Do windows doesnt have universal font containing all glyphs for all code points, so it must change fonts?
Post 29 Dec 2010, 16:59
View user's profile Send private message Reply with quote
b1528932



Joined: 21 May 2010
Posts: 287
b1528932 29 Dec 2010, 17:00
quote from menu that can change it:
Quote:
The system locale determines the default character set (letters, symbols, and numbers) and font used to enter and display information in programs that don't use Unicode.

in programs that don't use Unicode! When i use widechar functions, i demand to see \ instead of ¥!
Post 29 Dec 2010, 17:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20450
Location: In your JS exploiting you and your system
revolution 29 Dec 2010, 17:43
You change the font like this:
Code:
CreateFont  ...
SelectObject ...
TextOut ...    
But this has nothing do to with the character sets used. They are set by locale settings.
b1528932 wrote:
Do windows doesnt have universal font containing all glyphs for all code points, so it must change fonts?
The ARIALUNI.TTF file has many of the unicode glyphs, but not all.
Post 29 Dec 2010, 17:43
View user's profile Send private message Visit poster's website Reply with quote
b1528932



Joined: 21 May 2010
Posts: 287
b1528932 29 Dec 2010, 23:41
tell me why not make (extend?) a font to contain all glyphs?
Post 29 Dec 2010, 23:41
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler 30 Dec 2010, 02:41
Post 30 Dec 2010, 02:41
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler 30 Dec 2010, 02:45
Post 30 Dec 2010, 02:45
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 30 Dec 2010, 07:06
there is a font linking in windows 2k/xp also: you can set tahoma to edit window, but it will able to display chinese characters due to linking with another font.

look at registry into HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink to check it.

i've not study it well, so i can not say more how it is used exactly. i just do know that some custom richedits declares unicode support but can not display characters from linked fonts.


Description:
Filesize: 1.81 KB
Viewed: 6239 Time(s)

systemlink.png


Post 30 Dec 2010, 07:06
View user's profile Send private message Visit poster's website Reply with quote
b1528932



Joined: 21 May 2010
Posts: 287
b1528932 30 Dec 2010, 13:09
what i know about characters:
- system use 2 code pages, ANSI for GUI, and OEM for console. Right or Wrong?
- when changing this thing (image below), it not only change default codepages, but also might replace font (glyphs). Its simply not mentioned that font used by widechar functions will be changed.Right or Wrong.
- font linking is used only when 'default?' font is missing a glyph. Right or Wrong
- windows internally use ansi functions, thats why font change (seconfd image). Right or Wrong
image1:
Image


image2:
Image

please give me answers to those questions, and short explanation if im Wrong.
Post 30 Dec 2010, 13:09
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 30 Dec 2010, 15:26
as i do understand, changing system locale changes how system treats ansi characters, no fonts are replaced, just different font used as default (matching to codepage)

font linking is used exactly when character is missing in base font

windows nt/2k/xp uses unicode internally (unlike 9x), the default font is changed for ansi applications (not whole font, changed just character set for
extended ascii range)

_________________
UNICODE forever!
Post 30 Dec 2010, 15:26
View user's profile Send private message Visit poster's website Reply with quote
b1528932



Joined: 21 May 2010
Posts: 287
b1528932 30 Dec 2010, 15:51
No, example character (backslash) is translated to U+0x5C everytime.
Its just graphical representation of u+0x5c (or 0x005C in utf16) changing, thats the whole problem. I would understand it if due to the change of CP i couldnt 'cd \..\', but everything stays the same, except glyph! Meaning that even unicode font is CHANGED! I ask WHY, whats the reason? Why dont they clarify it in help page, that ALL, even unicode programs are AFFECTED in glyph way! Of course that OS still treats characters exactly the same, but its drawing them diffrently!
Post 30 Dec 2010, 15:51
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20450
Location: In your JS exploiting you and your system
revolution 31 Dec 2010, 00:00
b1528932: Did you see the link by mindcooler:

https://board.flatassembler.net/topic.php?p=124332#124332

It explains the backslash problem.

The font is not changed, only the character mapping is affected.
Post 31 Dec 2010, 00:00
View user's profile Send private message Visit poster's website Reply with quote
b1528932



Joined: 21 May 2010
Posts: 287
b1528932 31 Dec 2010, 03:06
yes i know about backslash mapping. But tell me how its possible to change mapping (glyph <=> utf16_code) of a character without changing a font? Font IS the mapping, or at elast i think so. If im wrong please tell me how does it work.
Post 31 Dec 2010, 03:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20450
Location: In your JS exploiting you and your system
revolution 31 Dec 2010, 03:18
A font describes the shape of the characters, nothing else. You will still get the Arial font regardless of the character mapping. The hex character 0x5c can be mapped to different glyphs within the same font. The mapping depends upon the locale setting.

Locale English: Char 0x005c maps to glyph 0x005c
Locale English: Char 0x00a5 maps to glyph 0x00a5
Locale English: Char 0x20a9 maps to glyph 0x20a9

Locale Japanese: Char 0x005c maps to glyph 0x00a5
Locale Japanese: Char 0x00a5 maps to glyph 0x00a5
Locale Japanese: Char 0x20a9 maps to glyph 0x20a9

Locale Korean: Char 0x005c maps to glyph 0x20a9
Locale Korean: Char 0x00a5 maps to glyph 0x00a5
Locale Korean: Char 0x20a9 maps to glyph 0x20a9

All are still within the Arial (or whatever) font face.
Post 31 Dec 2010, 03:18
View user's profile Send private message Visit poster's website Reply with quote
b1528932



Joined: 21 May 2010
Posts: 287
b1528932 31 Dec 2010, 17:00
So there is something else (not glyph index = utf16 index) that decide about mappings, right? utf16 <=> something <=> glyph. And by changing 'locale?' this something is also changed. Thank you for claryfiing this to me. I belive font is no concern from programmers point of view, it just contain shapes, glyph table is what i want to address.

I can read on manual that locale is just a way of formatting time, date, currency, length, it contain month names, week day names, and so on. Locale is a set of variables to represent the same thing in diffrent ways (world regions). So locale also contain intermediate font - codepoint mapping, interesting.

But this doesnt explain why window title bars ALWAYS have glyph 0x005C, regardless of locale!

I also have a question about UI and keyboard input. I want to display a message (or any part of UI) in few languages, does the windows support autodetect of wich language user use?

GetUserGeoID is for checking where user is located, so i can display weather info or latest news.
GetUserDefaultLCID is for checing how should i call 5th day of week, or what length unit to use.
GetThreadLocale is same as above, and it should be used instead because user might want to have multiple locales at once.
GetUserDefaultUILanguage if for checking what stirng to use. When i detect german language i display german text, when i detect english - i use english.

what is locale?
wikipedia say 1 thing, microsoft other. What is locale, and how to dump its info, its my main question right now!
Post 31 Dec 2010, 17:00
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.