How do I get full unicode support including chinese characters in VCL controls or Windows Common Controls on XP like it is in Win7

StackOverflow https://stackoverflow.com/questions/5395742

Question

I have an application that I have been testing for internationalization support.

There is, for example, a standard TEdit control, with the font.Name = 'Arial'.

On Windows 7, it seems to automatically grab the glyphs for CJK characters, from Arial Unicode MS, or somewhere else, for EDIT common controls, if the font that is assigned to that control, does not contain a certain international character.

On Windows XP, it seems that chinese characters show up as boxes, even when Arial Unicode MS font is installed, unless I change the Font name in the delphi form, to Arial Unicode MS.

Is this something that everybody encounters with international font support on windows XP? Do windows common controls behave differently? The behaviour I see on Windows 7 is certainly friendlier than the behaviour I see on Windows XP.

This behaviour difference is not constrained just to Windows Common Controls. It seems even Internet Explorer and the MS Explorer shell have problems doing tests like the picture here: enter image description here

  1. What do people do about this?

  2. What is the expected platform behaviour on Windows XP? Do you have to go find what language the user wants to use, and go find a font for them to to use, that supports that language? I guess Arial Unicode MS might be a good default, since it has almost every unicode language that there is.

Update: It looks like the Microsoft term "supplemental language support" refers to the "windows doesn't show my unicode characters as boxes" feature of Windows.

Was it helpful?

Solution

Vista and Windows 7 include support for East Asian languages out of the box. To enable it on Windows XP go into the Control Panel, open Regional and Language Options dialog, switch to the Languages tab, and check Install files for East Asian languages under Supplemental language support.

You can detect whether they've been installed using IsValidLanguageGroup by checking for one of the relevant languages with the LGRIP_INSTALLED flag:

uses
  Windows;

type
  LGRPID = DWORD;

const
  LGRPID_INSTALLED = $00000001;  // installed language group ids
  LGRPID_SUPPORTED = $00000002;  // supported language group ids

  LGRPID_WESTERN_EUROPE       = $0001; // Western Europe & U.S.
  LGRPID_CENTRAL_EUROPE       = $0002; // Central Europe
  LGRPID_BALTIC               = $0003; // Baltic
  LGRPID_GREEK                = $0004; // Greek
  LGRPID_CYRILLIC             = $0005; // Cyrillic
  LGRPID_TURKISH              = $0006; // Turkish
  LGRPID_JAPANESE             = $0007; // Japanese
  LGRPID_KOREAN               = $0008; // Korean
  LGRPID_TRADITIONAL_CHINESE  = $0009; // Traditional Chinese
  LGRPID_SIMPLIFIED_CHINESE   = $000a; // Simplified Chinese
  LGRPID_THAI                 = $000b; // Thai
  LGRPID_HEBREW               = $000c; // Hebrew
  LGRPID_ARABIC               = $000d; // Arabic
  LGRPID_VIETNAMESE           = $000e; // Vietnamese
  LGRPID_INDIC                = $000f; // Indic
  LGRPID_GEORGIAN             = $0010; // Georgian
  LGRPID_ARMENIAN             = $0011; // Armenian

function IsValidLanguageGroup(LanguageGroup: LGRPID; dwFlags: DWORD): BOOL; stdcall;
  external kernel32;

function IsCJKInstalled: Boolean;
begin    
  Result := IsValidLanguageGroup(LGRPID_SIMPLIFIED_CHINESE, LGRPID_INSTALLED);
end;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top