Jump to content

GpiSetCp: Difference between revisions

From EDM2
Created page with "This function sets the default graphics code page. ==Syntax== <PRE> #define INCL_GPILCIDS Or use INCL_GPI, INCL_PM,: #include <os2.h> HPS hps; /* Presentation-..."
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This function sets the default graphics code page.
This function sets the default graphics code page.
==Syntax==
==Syntax==
<PRE>
GpiSetCp(hps, ulCodePage)
#define INCL_GPILCIDS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>
 
HPS hps;          /* Presentation-space handle. */
ULONG ulCodePage;  /* Code-page identifier. */
BOOL rc;          /* Success indicator. */


rc = GpiSetCp(hps, ulCodePage);
</PRE>
==Parameters==
==Parameters==
; hps (HPS) - input : Presentation-space handle.
; hps (HPS) - input : Presentation-space handle.
; ulCodePage (ULONG) - input : Code-page identifier.
; ulCodePage (ULONG) - input : Code-page identifier.


==Return Code==
==Return Code==
; rc (BOOL) - returns : Success indicator.
; rc ([[BOOL]]) - returns : Success indicator.
* TRUE Successful completion
:;TRUE  
* FALSE Error occurred.
::Successful completion
:;FALSE  
::Error occurred.


==Errors==  
==Errors==  
Possible returns from WinGetLastError
Possible returns from WinGetLastError
; PMERR_INV_HPS (0x207F) : An invalid presentation-space handle was specified.
; 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_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.
; PMERR_INV_CODEPAGE (0x2052) : An invalid code-page parameter was specified with GpiSetCp.


Line 33: Line 25:


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:
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:
<PRE>
Country             Code Page
Country Code Page
Canadian-French     863
Canadian-French 863
Desktop Publishing 1004
Desktop Publishing 1004
Iceland             861
Iceland 861
Latin 1 Multilingual 850
Latin 1 Multilingual 850
Latin 2 Multilingual 852
Latin 2 Multilingual 852
Nordic               865
Nordic 865
Portuguese           860
Portuguese 860
Turkey               857
Turkey 857
U.S. (IBM PC)       437
U.S. (IBM PC) 437
</PRE>
Code page 1004 is compatible with Microsoft** Windows**.
Code page 1004 is compatible with Microsoft** Windows**.


The following EBCDIC code pages, based on character set 697, are also available for output:
The following EBCDIC code pages, based on character set 697, are also available for output:
<PRE>
<PRE>
Country Code Page
Country         Code Page
Austrian/German 273
Austrian/German 273
Belgian 500
Belgian         500
Brazil 037
Brazil           037
Czechoslovakia 870
Czechoslovakia   870
Danish/Norwegian 277
Danish/Norwegian 277
Finnish/Swedish 278
Finnish/Swedish 278
French 297
French           297
Hungary 870
Hungary         870
Iceland 871
Iceland         871
International 500
International   500
Italian 280
Italian         280
Poland 870
Poland           870
Portuguese 037
Portuguese       037
Spanish 284
Spanish         284
Turkey 1026
Turkey         1026
U.K.-English 285
UK English       285
U.S.-English 037
US English       037
Yugoslavia 870
Yugoslavia       870
</PRE>
</PRE>
Code pages 274 (Belgian) and 282 (Portuguese) can be used to provide access to old data.
Code pages 274 (Belgian) and 282 (Portuguese) can be used to provide access to old data.
Line 75: Line 65:
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.
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
'''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.
Presentation Manager Programming Reference for more information.


==Example Code==
==Example Code==
Line 82: Line 71:
<PRE>
<PRE>
#define INCL_GPILCIDS
#define INCL_GPILCIDS
#include <OS2.H>
#include <os2.h>


HPS hps;                /* Presentation space handle */
HPS hps;                /* Presentation space handle */
Line 91: Line 80:


==Related Functions==
==Related Functions==
Related Functions The DOS calls DosGetCp, DosSetCp, and DosSetProcCp are related to GpiSetCP, but they are not a part of the
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.
Presentation Manager, for more information on the mentioned DOS calls refer to the Control Program Reference .
*[[GpiCreateLogFont]]
* [[GpiCreateLogFont]]
*[[GpiQueryCurrentPosition]]
* [[GpiQueryCurrentPosition]]


[[Category:Gpi]]
[[Category:Gpi]]

Latest revision as of 19:46, 7 April 2025

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.