Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
Hello guys
Windows displays arabic digit shapes in arabic locale. I want to completely control digit shapes in my application. There are some settings in display language to disable this behavior, but I do not want to change them as It affects other applications, And even I do not know how to change them pragramatically.
I found no edit style to do this in the documentation of edit controls. any suggestions or links appreciated
mr.abzadeh

Edit: I use visual studio 2010
Posted
Updated 11-Aug-13 0:09am
v2
Comments
enhzflep 11-Aug-13 11:43am    
I would expect that you could simply create a font and use it to draw the numbers in your application. (english locale on my pc)
I've seen apps written here display text in Japanese or Chinese, so don't forsee an issue with latin numerals in an app running in an arabic locale.

Here's an excerpt from the c++ code preview from ResEdit (visual resource creator).

HFONT hfont0 = CreateFont(-11, 0, 0, 0, 0, FALSE, FALSE, FALSE, 1, 0, 0, 0, 0, ("Ms Shell Dlg"));
HWND hwnd = CreateWindowEx(0, ("WndClass")0, ("Custom Char Generator for 1602 lcds"), WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU, 0, 0, 311, 345, 0, 0, hInst, 0);
HWND hCtrl0_0 = CreateWindowEx(0, WC_STATIC, ("charPlaceHolder"), WS_VISIBLE | WS_CHILD | WS_GROUP | WS_BORDER | SS_LEFT, 0, 0, 117, 176, hwnd, (HMENU)IDC_LCD_CHAR_WND, hInst, 0);
SendMessage(hCtrl0_0, WM_SETFONT, (WPARAM), FALSE);

I'd suppose that you'd just create and assign the font in a similar manner.
mr.abzadeh 11-Aug-13 13:50pm    
It's a solution, but I do not want to restrict my application to use an special font. I want the users of my application to select thru the installed fonts freely.
Sergey Alexandrovich Kryukov 11-Aug-13 14:25pm    
No. If you see the later OP's comment, you will see it has nothing to do with fonts. See also my answer.
—SA
enhzflep 11-Aug-13 14:37pm    
Thanks Sergei. I did see it and realize I'd erroneously thought the problem more complex that it now appears. Articulate and verbose as ever!
Sergey Alexandrovich Kryukov 11-Aug-13 14:38pm    
Thank you very much for your nice words.
—SA

1 solution

This has nothing to do with "digit shapes".

The "locale" cannot change digit shapes. Those are just different Unicode code points, so called "Eastern Arabic numerals", http://en.wikipedia.org/wiki/Eastern_Arabic_numerals[^].

In contrast, all the Western world uses "Arabic numerals" in its Western form, in different glyphs and code points which have been standardized in ASCII and other early standards:
http://en.wikipedia.org/wiki/Arabic_numerals[^].

See also: http://en.wikipedia.org/wiki/Glyphs_used_with_the_Hindu-Arabic_numeral_system[^].

Both Unicode subsets are supported by most modern OS by default. You can ignore the locate and use the code points you want in your applications. In any case, it absolutely irrelevant to the fonts you use.

—SA
 
Share this answer
 
Comments
mr.abzadeh 11-Aug-13 15:08pm    
I think you have not noticed my question exactly. my problem is digit shapes, not digits, and neither code points.
for example, if in regional and language setting we set system locale to arabic, and one
calles this code:
SetTextW( hwndControl, WM_SETTEXT, 0, L"01234567890" );
the control translates unicode chars 0x30 thru 0x39 to unicode chars 0x6F0 thru 0x6F9 and displays "۰۱۲۳۴۵۶۷۸۹" which are arabic DIGIT SHAPES. Of course if this code is executed:
wchar_t wszBuffer[11];
SendMessageW( hWnd, WM_GETTEXT, 11, (LPARAM)wszBuffer );
then the contents of wszBuffer will be the original unicode chars 0x30 thru 0x39.
I want to find a way to disable this behaviour in my application, and display european digit SHAPES, independently of regional and language setting.
Sergey Alexandrovich Kryukov 11-Aug-13 16:55pm    
Even then, you need to make system output correct code point. It has nothing to do with shapes. Shapes are already available.
—SA
mr.abzadeh 11-Aug-13 22:36pm    
I use only unicode, especially, numerals 0x30 thru 0x39. I have nothing to do with code points. what I need is this:
The edit control display '0123456789' when it's text buffer contains L"0123456789"
I want only to disable displaying numbers in national digit shapes in edit controls.
Sergey Alexandrovich Kryukov 11-Aug-13 23:42pm    
You are confused. "Code points" is what is defined by Unicode: integer numbers corresponding to characters. Characters are understood as cultural entities, abstracted from their glyphs.
—SA
mr.abzadeh 11-Aug-13 15:21pm    
I forgot to emphasis that system may change digit shapes. If we set system locale to arabic, and in the Additional settings set the native digits to national, then the edit control displays L"0123456789" as L"۰۱۲۳۴۵۶۷۸۹", and so does TextOut( hDC, left, top, L"0123456789", 10 ); this behavior can be changed by NADS(0X206E) and NODS(0x206F), or by passing ETO_NUMERICSLATIN to ExtTextOut function, but for edit controls, this does not work

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900