Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4bb8d9c1
Commit
4bb8d9c1
authored
Apr 06, 2009
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Apr 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Cache current font code page in the DC structure.
parent
301b5d27
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
37 deletions
+54
-37
dc.c
dlls/gdi32/dc.c
+1
-0
font.c
dlls/gdi32/font.c
+52
-37
gdi_private.h
dlls/gdi32/gdi_private.h
+1
-0
No files found.
dlls/gdi32/dc.c
View file @
4bb8d9c1
...
...
@@ -110,6 +110,7 @@ DC *alloc_dc_ptr( const DC_FUNCTIONS *funcs, WORD magic )
dc
->
hDevice
=
0
;
dc
->
hPalette
=
GetStockObject
(
DEFAULT_PALETTE
);
dc
->
gdiFont
=
0
;
dc
->
font_code_page
=
CP_ACP
;
dc
->
ROPmode
=
R2_COPYPEN
;
dc
->
polyFillMode
=
ALTERNATE
;
dc
->
stretchBltMode
=
BLACKONWHITE
;
...
...
dlls/gdi32/font.c
View file @
4bb8d9c1
...
...
@@ -247,45 +247,13 @@ static void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, NEWTEXTMETRIC
DWORD
WINAPI
GdiGetCodePage
(
HDC
hdc
)
{
UINT
cp
=
CP_ACP
;
CHARSETINFO
csi
;
int
charset
=
GetTextCharset
(
hdc
);
/* Hmm, nicely designed api this one! */
if
(
TranslateCharsetInfo
(
ULongToPtr
(
charset
),
&
csi
,
TCI_SRCCHARSET
))
cp
=
csi
.
ciACP
;
else
{
switch
(
charset
)
{
case
OEM_CHARSET
:
cp
=
GetOEMCP
();
break
;
case
DEFAULT_CHARSET
:
cp
=
GetACP
();
break
;
case
VISCII_CHARSET
:
case
TCVN_CHARSET
:
case
KOI8_CHARSET
:
case
ISO3_CHARSET
:
case
ISO4_CHARSET
:
case
ISO10_CHARSET
:
case
CELTIC_CHARSET
:
/* FIXME: These have no place here, but because x11drv
enumerates fonts with these (made up) charsets some apps
might use them and then the FIXME below would become
annoying. Now we could pick the intended codepage for
each of these, but since it's broken anyway we'll just
use CP_ACP and hope it'll go away...
*/
cp
=
CP_ACP
;
break
;
DC
*
dc
=
get_dc_ptr
(
hdc
);
default:
FIXME
(
"Can't find codepage for charset %d
\n
"
,
charset
);
break
;
}
if
(
dc
)
{
cp
=
dc
->
font_code_page
;
release_dc_ptr
(
dc
);
}
TRACE
(
"charset %d => cp %d
\n
"
,
charset
,
cp
);
return
cp
;
}
...
...
@@ -465,6 +433,52 @@ HFONT WINAPI CreateFontW( INT height, INT width, INT esc,
return
CreateFontIndirectW
(
&
logfont
);
}
static
void
update_font_code_page
(
DC
*
dc
)
{
CHARSETINFO
csi
;
int
charset
=
DEFAULT_CHARSET
;
if
(
dc
->
gdiFont
)
charset
=
WineEngGetTextCharsetInfo
(
dc
->
gdiFont
,
NULL
,
0
);
/* Hmm, nicely designed api this one! */
if
(
TranslateCharsetInfo
(
ULongToPtr
(
charset
),
&
csi
,
TCI_SRCCHARSET
)
)
dc
->
font_code_page
=
csi
.
ciACP
;
else
{
switch
(
charset
)
{
case
OEM_CHARSET
:
dc
->
font_code_page
=
GetOEMCP
();
break
;
case
DEFAULT_CHARSET
:
dc
->
font_code_page
=
GetACP
();
break
;
case
VISCII_CHARSET
:
case
TCVN_CHARSET
:
case
KOI8_CHARSET
:
case
ISO3_CHARSET
:
case
ISO4_CHARSET
:
case
ISO10_CHARSET
:
case
CELTIC_CHARSET
:
/* FIXME: These have no place here, but because x11drv
enumerates fonts with these (made up) charsets some apps
might use them and then the FIXME below would become
annoying. Now we could pick the intended codepage for
each of these, but since it's broken anyway we'll just
use CP_ACP and hope it'll go away...
*/
dc
->
font_code_page
=
CP_ACP
;
break
;
default:
FIXME
(
"Can't find codepage for charset %d
\n
"
,
charset
);
dc
->
font_code_page
=
CP_ACP
;
break
;
}
}
TRACE
(
"charset %d => cp %d
\n
"
,
charset
,
dc
->
font_code_page
);
}
/***********************************************************************
* FONT_SelectObject
...
...
@@ -506,6 +520,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
{
ret
=
dc
->
hFont
;
dc
->
hFont
=
handle
;
update_font_code_page
(
dc
);
GDI_dec_ref_count
(
ret
);
}
release_dc_ptr
(
dc
);
...
...
dlls/gdi32/gdi_private.h
View file @
4bb8d9c1
...
...
@@ -281,6 +281,7 @@ typedef struct tagDC
GdiFont
*
gdiFont
;
GdiPath
path
;
UINT
font_code_page
;
WORD
ROPmode
;
WORD
polyFillMode
;
WORD
stretchBltMode
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment