source: trunk/src/gdi32/text.cpp@ 1937

Last change on this file since 1937 was 1931, checked in by sandervl, 26 years ago

Ported GetTextCharset & GetTextCharsetInfo (Wine: 991031)

File size: 1.9 KB
Line 
1/* $Id: text.cpp,v 1.1 1999-12-01 23:30:30 sandervl Exp $ */
2
3/*
4 * GDI32 text apis
5 *
6 * Based on Wine code (991031) (objects\text.c)
7 *
8 * Copyright 1993, 1994 Alexandre Julliard
9 *
10 *
11 * Project Odin Software License can be found in LICENSE.TXT
12 *
13 */
14#include <os2win.h>
15#include <stdlib.h>
16#include <misc.h>
17#include <string.h>
18
19//******************************************************************************
20//******************************************************************************
21UINT WINAPI GetTextCharsetInfo(
22 HDC hdc, /* [in] Handle to device context */
23 LPFONTSIGNATURE fs, /* [out] Pointer to struct to receive data */
24 DWORD flags) /* [in] Reserved - must be 0 */
25{
26 HGDIOBJ hFont;
27 UINT charSet = DEFAULT_CHARSET;
28 LOGFONTW lf;
29 CHARSETINFO csinfo;
30
31 dprintf(("GetTextCharsetInfo %x %x %x", hdc, fs, flags));
32
33 hFont = GetCurrentObject(hdc, OBJ_FONT);
34 if (hFont == 0)
35 return(DEFAULT_CHARSET);
36 if ( GetObjectW(hFont, sizeof(LOGFONTW), &lf) != 0 )
37 charSet = lf.lfCharSet;
38
39 if (fs != NULL) {
40 if (!TranslateCharsetInfo((LPDWORD)charSet, &csinfo, TCI_SRCCHARSET))
41 return (DEFAULT_CHARSET);
42 memcpy(fs, &csinfo.fs, sizeof(FONTSIGNATURE));
43 }
44 return charSet;
45}
46/***********************************************************************
47 * GetTextCharset32 [GDI32.226] Gets character set for font in DC
48 *
49 * NOTES
50 * Should it return a UINT32 instead of an INT32?
51 * => YES, as GetTextCharsetInfo returns UINT32
52 *
53 * RETURNS
54 * Success: Character set identifier
55 * Failure: DEFAULT_CHARSET
56 */
57UINT WINAPI GetTextCharset(HDC hdc) /* [in] Handle to device context */
58{
59 /* MSDN docs say this is equivalent */
60 return GetTextCharsetInfo(hdc, NULL, 0);
61}
62//******************************************************************************
63//******************************************************************************
Note: See TracBrowser for help on using the repository browser.