GpiSetCp

From EDM2
Jump to: navigation, search

This function sets the default graphics code page.

Syntax

GpiSetCp(hps, ulCodePage)

Parameters

hps (HPS) - input 
Presentation-space handle.
ulCodePage (ULONG) - input 
Code-page identifier.

Return Code

rc (BOOL) - returns 
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Errors

Possible returns from WinGetLastError

PMERR_INV_HPS (0x207F) 
An invalid presentation-space handle was specified.
PMERR_PS_BUSY (0x20F4) 
An attempt was made to access the presentation space from more than one thread simultaneously.
PMERR_INV_CODEPAGE (0x2052) 
An invalid code-page parameter was specified with GpiSetCp.

Remarks

The default graphics code page is used for the default font (unless it is overridden by GpiCreateLogFont). It is also used for other fonts for which the usCodePage field in the FATTRS structure for GpiCreateLogFont is specified as 0. This includes existing fonts that are defined in this way.

Any code page that is defined in the CONFIG.SYS file, or is a supported EBCDIC code page, can be selected. The following is the list of valid code pages:

Country             Code Page
Canadian-French      863
Desktop Publishing  1004
Iceland              861
Latin 1 Multilingual 850
Latin 2 Multilingual 852
Nordic               865
Portuguese           860
Turkey               857
U.S. (IBM PC)        437

Code page 1004 is compatible with Microsoft** Windows**.

The following EBCDIC code pages, based on character set 697, are also available for output:

 Country          Code Page
 Austrian/German  273
 Belgian          500
 Brazil           037
 Czechoslovakia   870
 Danish/Norwegian 277
 Finnish/Swedish  278
 French           297
 Hungary          870
 Iceland          871
 International    500
 Italian          280
 Poland           870
 Portuguese       037
 Spanish          284
 Turkey          1026
 UK English       285
 US English       037
 Yugoslavia       870

Code pages 274 (Belgian) and 282 (Portuguese) can be used to provide access to old data.

When a GPI presentation space is first created, it uses code page 850 if available, otherwise it uses the current code page.

If this function occurs within a path definition when the drawing mode (see GpiSetDrawingMode) is retain or draw-and-retain, its effect is not stored with the definition.

Note: There are restrictions on the use of this function when creating SAA-conforming metafiles; see "MetaFile Resolutions" in the Presentation Manager Programming Reference for more information.

Example Code

This example sets the code page to 850.

#define INCL_GPILCIDS
#include <os2.h>

HPS hps;                 /* Presentation space handle */
ULONG ulCodePage = 850;

GpiSetCp(hps, ulCodePage);

Related Functions

The DOS calls DosGetCp, DosSetCp, and DosSetProcCp are related to GpiSetCp, but they are not a part of the Presentation Manager, for more information on the mentioned DOS calls refer to the Control Program Reference.