Skip to content
Snippets Groups Projects
Commit 36456e64 authored by Hidenori Takeshima's avatar Hidenori Takeshima Committed by Alexandre Julliard
Browse files

Added support for cp949.

parent 5bdf9b4c
No related merge requests found
...@@ -333,26 +333,22 @@ void X11DRV_DrawString_dbcs( fontObject* pfo, Display* pdisp, ...@@ -333,26 +333,22 @@ void X11DRV_DrawString_dbcs( fontObject* pfo, Display* pdisp,
} }
static static
int X11DRV_TextWidth_cp932( fontObject* pfo, XChar2b* pstr, int count ) int X11DRV_TextWidth_dbcs_2fonts( fontObject* pfo, XChar2b* pstr, int count )
{ {
int i; int i;
int width; int width;
fontObject* pfo_ansi = XFONT_GetFontObject( pfo->prefobjs[0] ); int curfont;
fontObject* pfos[X11FONT_REFOBJS_MAX+1];
pfos[0] = XFONT_GetFontObject( pfo->prefobjs[0] );
pfos[1] = pfo;
if ( pfos[0] == NULL ) pfos[0] = pfo;
width = 0; width = 0;
for ( i = 0; i < count; i++ ) for ( i = 0; i < count; i++ )
{ {
if ( pstr->byte1 != (BYTE)0 ) curfont = ( pstr->byte1 != 0 ) ? 1 : 0;
{ width += TSXTextWidth16( pfos[curfont]->fs, pstr, 1 );
width += TSXTextWidth16( pfo->fs, pstr, 1 );
}
else
{
if ( pfo_ansi != NULL )
{
width += TSXTextWidth16( pfo_ansi->fs, pstr, 1 );
}
}
pstr ++; pstr ++;
} }
...@@ -360,9 +356,9 @@ int X11DRV_TextWidth_cp932( fontObject* pfo, XChar2b* pstr, int count ) ...@@ -360,9 +356,9 @@ int X11DRV_TextWidth_cp932( fontObject* pfo, XChar2b* pstr, int count )
} }
static static
void X11DRV_DrawText_cp932( fontObject* pfo, Display* pdisp, Drawable d, void X11DRV_DrawText_dbcs_2fonts( fontObject* pfo, Display* pdisp, Drawable d,
GC gc, int x, int y, XTextItem16* pitems, GC gc, int x, int y, XTextItem16* pitems,
int count ) int count )
{ {
int i, nitems, prevfont = -1, curfont; int i, nitems, prevfont = -1, curfont;
XChar2b* pstr; XChar2b* pstr;
...@@ -372,6 +368,7 @@ void X11DRV_DrawText_cp932( fontObject* pfo, Display* pdisp, Drawable d, ...@@ -372,6 +368,7 @@ void X11DRV_DrawText_cp932( fontObject* pfo, Display* pdisp, Drawable d,
pfos[0] = XFONT_GetFontObject( pfo->prefobjs[0] ); pfos[0] = XFONT_GetFontObject( pfo->prefobjs[0] );
pfos[1] = pfo; pfos[1] = pfo;
if ( pfos[0] == NULL ) pfos[0] = pfo;
nitems = 0; nitems = 0;
for ( i = 0; i < count; i++ ) for ( i = 0; i < count; i++ )
...@@ -410,39 +407,32 @@ void X11DRV_DrawText_cp932( fontObject* pfo, Display* pdisp, Drawable d, ...@@ -410,39 +407,32 @@ void X11DRV_DrawText_cp932( fontObject* pfo, Display* pdisp, Drawable d,
} }
static static
void X11DRV_TextExtents_cp932( fontObject* pfo, XChar2b* pstr, int count, void X11DRV_TextExtents_dbcs_2fonts( fontObject* pfo, XChar2b* pstr, int count,
int* pdir, int* pascent, int* pdescent, int* pdir, int* pascent, int* pdescent,
int* pwidth ) int* pwidth )
{ {
XCharStruct info; XCharStruct info;
int ascent, descent, width; int ascent, descent, width;
int i; int i;
fontObject* pfo_ansi = XFONT_GetFontObject( pfo->prefobjs[0] ); int curfont;
fontObject* pfos[X11FONT_REFOBJS_MAX+1];
pfos[0] = XFONT_GetFontObject( pfo->prefobjs[0] );
pfos[1] = pfo;
if ( pfos[0] == NULL ) pfos[0] = pfo;
width = 0; width = 0;
*pascent = 0; *pascent = 0;
*pdescent = 0; *pdescent = 0;
for ( i = 0; i < count; i++ ) for ( i = 0; i < count; i++ )
{ {
if ( pstr->byte1 != (BYTE)0 ) curfont = ( pstr->byte1 != 0 ) ? 1 : 0;
{ TSXTextExtents16( pfos[curfont]->fs, pstr, 1, pdir,
TSXTextExtents16( pfo->fs, pstr, 1, pdir, &ascent, &descent, &info );
&ascent, &descent, &info ); if ( *pascent < ascent ) *pascent = ascent;
if ( *pascent < ascent ) *pascent = ascent; if ( *pdescent < descent ) *pdescent = descent;
if ( *pdescent < descent ) *pdescent = descent; width += info.width;
width += info.width;
}
else
{
if ( pfo_ansi != NULL )
{
TSXTextExtents16( pfo_ansi->fs, pstr, 1, pdir,
&ascent, &descent, &info );
if ( *pascent < ascent ) *pascent = ascent;
if ( *pdescent < descent ) *pdescent = descent;
width += info.width;
}
}
pstr ++; pstr ++;
} }
...@@ -544,9 +534,9 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] = ...@@ -544,9 +534,9 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] =
X11DRV_enum_subfont_charset_cp932, X11DRV_enum_subfont_charset_cp932,
X11DRV_unicode_to_char2b_cp932, X11DRV_unicode_to_char2b_cp932,
X11DRV_DrawString_dbcs, X11DRV_DrawString_dbcs,
X11DRV_TextWidth_cp932, X11DRV_TextWidth_dbcs_2fonts,
X11DRV_DrawText_cp932, X11DRV_DrawText_dbcs_2fonts,
X11DRV_TextExtents_cp932, X11DRV_TextExtents_dbcs_2fonts,
X11DRV_GetTextMetricsA_cp932, X11DRV_GetTextMetricsA_cp932,
}, },
{ /* CP936 */ { /* CP936 */
...@@ -561,10 +551,10 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] = ...@@ -561,10 +551,10 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] =
{ /* CP949 */ { /* CP949 */
X11DRV_enum_subfont_charset_cp949, X11DRV_enum_subfont_charset_cp949,
X11DRV_unicode_to_char2b_cp949, X11DRV_unicode_to_char2b_cp949,
X11DRV_DrawString_normal, /* FIXME */ X11DRV_DrawString_dbcs,
X11DRV_TextWidth_normal, /* FIXME */ X11DRV_TextWidth_dbcs_2fonts,
X11DRV_DrawText_normal, /* FIXME */ X11DRV_DrawText_dbcs_2fonts,
X11DRV_TextExtents_normal, /* FIXME */ X11DRV_TextExtents_dbcs_2fonts,
X11DRV_GetTextMetricsA_normal, /* FIXME */ X11DRV_GetTextMetricsA_normal, /* FIXME */
}, },
{ /* CP950 */ { /* CP950 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment