gdi32: Store font code page in DC_ATTR.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-08-20 10:42:24 +02:00 committed by Alexandre Julliard
parent 6caf861a63
commit 7ad7ec5b8b
5 changed files with 17 additions and 24 deletions

View File

@ -80,8 +80,8 @@ static void set_initial_dc_state( DC *dc )
dc->attr->vport_ext.cy = 1;
dc->attr->miter_limit = 10.0f; /* 10.0 is the default, from MSDN */
dc->attr->layout = 0;
dc->font_code_page = CP_ACP;
dc->attr->rop_mode = R2_COPYPEN;
dc->attr->font_code_page = CP_ACP;
dc->attr->poly_fill_mode = ALTERNATE;
dc->attr->stretch_blt_mode = BLACKONWHITE;
dc->attr->rel_abs_mode = ABSOLUTE;

View File

@ -4163,22 +4163,6 @@ static BOOL get_char_positions_indices( DC *dc, const WORD *indices, INT count,
return TRUE;
}
/***********************************************************************
* GdiGetCodePage (GDI32.@)
*/
DWORD WINAPI GdiGetCodePage( HDC hdc )
{
UINT cp = CP_ACP;
DC *dc = get_dc_ptr( hdc );
if (dc)
{
cp = dc->font_code_page;
release_dc_ptr( dc );
}
return cp;
}
/***********************************************************************
* get_text_charset_info
*
@ -4457,14 +4441,14 @@ static void update_font_code_page( DC *dc, HANDLE font )
/* Hmm, nicely designed api this one! */
if (TranslateCharsetInfo( ULongToPtr(charset), &csi, TCI_SRCCHARSET) )
dc->font_code_page = csi.ciACP;
dc->attr->font_code_page = csi.ciACP;
else {
switch(charset) {
case OEM_CHARSET:
dc->font_code_page = GetOEMCP();
dc->attr->font_code_page = GetOEMCP();
break;
case DEFAULT_CHARSET:
dc->font_code_page = GetACP();
dc->attr->font_code_page = GetACP();
break;
case VISCII_CHARSET:
@ -4481,17 +4465,17 @@ static void update_font_code_page( DC *dc, HANDLE font )
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;
dc->attr->font_code_page = CP_ACP;
break;
default:
FIXME("Can't find codepage for charset %d\n", charset);
dc->font_code_page = CP_ACP;
dc->attr->font_code_page = CP_ACP;
break;
}
}
TRACE("charset %d => cp %d\n", charset, dc->font_code_page);
TRACE( "charset %d => cp %d\n", charset, dc->attr->font_code_page );
}
/***********************************************************************

View File

@ -99,7 +99,6 @@ typedef struct tagDC
const struct font_gamma_ramp *font_gamma_ramp;
UINT font_code_page;
INT breakExtra; /* breakTotalExtra / breakCount */
INT breakRem; /* breakTotalExtra % breakCount */
ABORTPROC pAbortProc; /* AbortProc for Printing */

View File

@ -737,6 +737,15 @@ static void text_metric_WtoA( const TEXTMETRICW *tmW, TEXTMETRICA *tmA )
tmA->tmCharSet = tmW->tmCharSet;
}
/***********************************************************************
* GdiGetCodePage (GDI32.@)
*/
DWORD WINAPI GdiGetCodePage( HDC hdc )
{
DC_ATTR *dc_attr = get_dc_attr( hdc );
return dc_attr ? dc_attr->font_code_page : CP_ACP;
}
/***********************************************************************
* ExtTextOutW (GDI32.@)
*/

View File

@ -156,6 +156,7 @@ typedef struct DC_ATTR
SIZE vport_ext; /* viewport extent */
SIZE virtual_res;
SIZE virtual_size;
UINT font_code_page;
void *emf;
} DC_ATTR;