winex11: Remove support for server-side fonts.

This commit is contained in:
Alexandre Julliard 2012-04-18 13:07:17 +02:00
parent 7468238539
commit bb62ddeba7
11 changed files with 35 additions and 4868 deletions

View File

@ -9,7 +9,6 @@ C_SRCS = \
bitmap.c \
brush.c \
clipboard.c \
codepage.c \
desktop.c \
event.c \
graphics.c \
@ -23,12 +22,10 @@ C_SRCS = \
scroll.c \
settings.c \
systray.c \
text.c \
window.c \
wintab.c \
x11drv_main.c \
xdnd.c \
xfont.c \
xim.c \
xinerama.c \
xrandr.c \

View File

@ -1,768 +0,0 @@
/*
* X11 codepage handling
*
* Copyright 2000 Hidenori Takeshima <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <math.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "x11font.h"
/***********************************************************************
* IsLegalDBCSChar for cp932/936/949/950/euc
*/
static inline
int IsLegalDBCSChar_cp932( BYTE lead, BYTE trail )
{
return ( ( ( lead >= (BYTE)0x81 && lead <= (BYTE)0x9f ) ||
( lead >= (BYTE)0xe0 && lead <= (BYTE)0xfc ) ) &&
( ( trail >= (BYTE)0x40 && trail <= (BYTE)0x7e ) ||
( trail >= (BYTE)0x80 && trail <= (BYTE)0xfc ) ) );
}
static inline
int IsLegalDBCSChar_cp936( BYTE lead, BYTE trail )
{
return ( ( lead >= (BYTE)0x81 && lead <= (BYTE)0xfe ) &&
( trail >= (BYTE)0x40 && trail <= (BYTE)0xfe ) );
}
static inline
int IsLegalDBCSChar_cp949( BYTE lead, BYTE trail )
{
return ( ( lead >= (BYTE)0x81 && lead <= (BYTE)0xfe ) &&
( trail >= (BYTE)0x41 && trail <= (BYTE)0xfe ) );
}
static inline
int IsLegalDBCSChar_cp950( BYTE lead, BYTE trail )
{
return ( ( lead >= (BYTE)0x81 && lead <= (BYTE)0xfe ) &&
( ( trail >= (BYTE)0x40 && trail <= (BYTE)0x7e ) ||
( trail >= (BYTE)0xa1 && trail <= (BYTE)0xfe ) ) );
}
/***********************************************************************
* DBCSCharToXChar2b for cp932/euc
*/
static inline
void DBCSCharToXChar2b_cp932( XChar2b* pch, BYTE lead, BYTE trail )
{
unsigned int high, low;
high = (unsigned int)lead;
low = (unsigned int)trail;
if ( high <= 0x9f )
high = (high<<1) - 0xe0;
else
high = (high<<1) - 0x160;
if ( low < 0x9f )
{
high --;
if ( low < 0x7f )
low -= 0x1f;
else
low -= 0x20;
}
else
{
low -= 0x7e;
}
pch->byte1 = (unsigned char)high;
pch->byte2 = (unsigned char)low;
}
static WORD X11DRV_enum_subfont_charset_normal( UINT index )
{
return DEFAULT_CHARSET;
}
static WORD X11DRV_enum_subfont_charset_cp932( UINT index )
{
switch ( index )
{
case 0: return X11FONT_JISX0201_CHARSET;
case 1: return X11FONT_JISX0212_CHARSET;
}
return DEFAULT_CHARSET;
}
static WORD X11DRV_enum_subfont_charset_cp936( UINT index )
{
switch ( index )
{
case 0: return ANSI_CHARSET;
}
return DEFAULT_CHARSET;
}
static WORD X11DRV_enum_subfont_charset_cp949( UINT index )
{
switch ( index )
{
case 0: return ANSI_CHARSET;
}
return DEFAULT_CHARSET;
}
static WORD X11DRV_enum_subfont_charset_cp950( UINT index )
{
switch ( index )
{
case 0: return ANSI_CHARSET;
}
return DEFAULT_CHARSET;
}
static XChar2b* X11DRV_unicode_to_char2b_sbcs( fontObject* pfo,
LPCWSTR lpwstr, UINT count )
{
XChar2b *str2b;
UINT i;
char *str;
UINT codepage = pfo->fi->codepage;
char ch = pfo->fs->default_char;
if (!(str2b = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XChar2b) )))
return NULL;
if (!(str = HeapAlloc( GetProcessHeap(), 0, count )))
{
HeapFree( GetProcessHeap(), 0, str2b );
return NULL;
}
WideCharToMultiByte( codepage, 0, lpwstr, count, str, count, &ch, NULL );
for (i = 0; i < count; i++)
{
str2b[i].byte1 = 0;
str2b[i].byte2 = str[i];
}
HeapFree( GetProcessHeap(), 0, str );
return str2b;
}
static XChar2b* X11DRV_unicode_to_char2b_unicode( fontObject* pfo,
LPCWSTR lpwstr, UINT count )
{
XChar2b *str2b;
UINT i;
if (!(str2b = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XChar2b) )))
return NULL;
for (i = 0; i < count; i++)
{
str2b[i].byte1 = lpwstr[i] >> 8;
str2b[i].byte2 = lpwstr[i] & 0xff;
}
return str2b;
}
/* FIXME: handle jisx0212.1990... */
static XChar2b* X11DRV_unicode_to_char2b_cp932( fontObject* pfo,
LPCWSTR lpwstr, UINT count )
{
XChar2b *str2b;
XChar2b *str2b_dst;
char *str;
BYTE *str_src;
UINT i;
char ch = pfo->fs->default_char;
if (!(str2b = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XChar2b) )))
return NULL;
if (!(str = HeapAlloc( GetProcessHeap(), 0, count*2 )))
{
HeapFree( GetProcessHeap(), 0, str2b );
return NULL;
}
/* handle jisx0212.1990... */
WideCharToMultiByte( 932, 0, lpwstr, count, str, count*2, &ch, NULL );
str_src = (BYTE*) str;
str2b_dst = str2b;
for (i = 0; i < count; i++, str_src++, str2b_dst++)
{
if ( IsLegalDBCSChar_cp932( *str_src, *(str_src+1) ) )
{
DBCSCharToXChar2b_cp932( str2b_dst, *str_src, *(str_src+1) );
str_src++;
}
else
{
str2b_dst->byte1 = 0;
str2b_dst->byte2 = *str_src;
}
}
HeapFree( GetProcessHeap(), 0, str );
return str2b;
}
static XChar2b* X11DRV_unicode_to_char2b_cp936( fontObject* pfo,
LPCWSTR lpwstr, UINT count )
{
XChar2b *str2b;
XChar2b *str2b_dst;
char *str;
BYTE *str_src;
UINT i;
char ch = pfo->fs->default_char;
if (!(str2b = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XChar2b) )))
return NULL;
if (!(str = HeapAlloc( GetProcessHeap(), 0, count*2 )))
{
HeapFree( GetProcessHeap(), 0, str2b );
return NULL;
}
WideCharToMultiByte( 936, 0, lpwstr, count, str, count*2, &ch, NULL );
str_src = (BYTE*) str;
str2b_dst = str2b;
for (i = 0; i < count; i++, str_src++, str2b_dst++)
{
if ( IsLegalDBCSChar_cp936( *str_src, *(str_src+1) ) )
{
str2b_dst->byte1 = *str_src;
str2b_dst->byte2 = *(str_src+1);
str_src++;
}
else
{
str2b_dst->byte1 = 0;
str2b_dst->byte2 = *str_src;
}
}
HeapFree( GetProcessHeap(), 0, str );
return str2b;
}
static XChar2b* X11DRV_unicode_to_char2b_cp949( fontObject* pfo,
LPCWSTR lpwstr, UINT count )
{
XChar2b *str2b;
XChar2b *str2b_dst;
char *str;
BYTE *str_src;
UINT i;
char ch = pfo->fs->default_char;
if (!(str2b = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XChar2b) )))
return NULL;
if (!(str = HeapAlloc( GetProcessHeap(), 0, count*2 )))
{
HeapFree( GetProcessHeap(), 0, str2b );
return NULL;
}
WideCharToMultiByte( 949, 0, lpwstr, count, str, count*2, &ch, NULL );
str_src = (BYTE*) str;
str2b_dst = str2b;
for (i = 0; i < count; i++, str_src++, str2b_dst++)
{
if ( IsLegalDBCSChar_cp949( *str_src, *(str_src+1) ) )
{
str2b_dst->byte1 = *str_src;
str2b_dst->byte2 = *(str_src+1);
str_src++;
}
else
{
str2b_dst->byte1 = 0;
str2b_dst->byte2 = *str_src;
}
}
HeapFree( GetProcessHeap(), 0, str );
return str2b;
}
static XChar2b* X11DRV_unicode_to_char2b_cp950( fontObject* pfo,
LPCWSTR lpwstr, UINT count )
{
XChar2b *str2b;
XChar2b *str2b_dst;
char *str;
BYTE *str_src;
UINT i;
char ch = pfo->fs->default_char;
if (!(str2b = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XChar2b) )))
return NULL;
if (!(str = HeapAlloc( GetProcessHeap(), 0, count*2 )))
{
HeapFree( GetProcessHeap(), 0, str2b );
return NULL;
}
WideCharToMultiByte( 950, 0, lpwstr, count, str, count*2, &ch, NULL );
str_src = (BYTE*) str;
str2b_dst = str2b;
for (i = 0; i < count; i++, str_src++, str2b_dst++)
{
if ( IsLegalDBCSChar_cp950( *str_src, *(str_src+1) ) )
{
str2b_dst->byte1 = *str_src;
str2b_dst->byte2 = *(str_src+1);
str_src++;
}
else
{
str2b_dst->byte1 = 0;
str2b_dst->byte2 = *str_src;
}
}
HeapFree( GetProcessHeap(), 0, str );
return str2b;
}
static XChar2b* X11DRV_unicode_to_char2b_symbol( fontObject* pfo,
LPCWSTR lpwstr, UINT count )
{
XChar2b *str2b;
UINT i;
char ch = pfo->fs->default_char;
if (!(str2b = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XChar2b) )))
return NULL;
for (i = 0; i < count; i++)
{
str2b[i].byte1 = 0;
if(lpwstr[i] >= 0xf000 && lpwstr[i] < 0xf100)
str2b[i].byte2 = lpwstr[i] - 0xf000;
else if(lpwstr[i] < 0x100)
str2b[i].byte2 = lpwstr[i];
else
str2b[i].byte2 = ch;
}
return str2b;
}
static void X11DRV_DrawString_normal( fontObject* pfo, Display* pdisp,
Drawable d, GC gc, int x, int y,
XChar2b* pstr, int count )
{
wine_tsx11_lock();
XDrawString16( pdisp, d, gc, x, y, pstr, count );
wine_tsx11_unlock();
}
static int X11DRV_TextWidth_normal( fontObject* pfo, XChar2b* pstr, int count )
{
int ret;
wine_tsx11_lock();
ret = XTextWidth16( pfo->fs, pstr, count );
wine_tsx11_unlock();
return ret;
}
static void X11DRV_DrawText_normal( fontObject* pfo, Display* pdisp, Drawable d,
GC gc, int x, int y, XTextItem16* pitems,
int count )
{
wine_tsx11_lock();
XDrawText16( pdisp, d, gc, x, y, pitems, count );
wine_tsx11_unlock();
}
static void X11DRV_TextExtents_normal( fontObject* pfo, XChar2b* pstr, int count,
int* pdir, int* pascent, int* pdescent,
int* pwidth, int max_extent, int* pfit,
int* partial_extents )
{
XCharStruct info;
int ascent, descent, width;
int i, fit;
width = 0;
fit = 0;
*pascent = 0;
*pdescent = 0;
wine_tsx11_lock();
for ( i = 0; i < count; i++ )
{
XTextExtents16( pfo->fs, pstr, 1, pdir, &ascent, &descent, &info );
if ( *pascent < ascent ) *pascent = ascent;
if ( *pdescent < descent ) *pdescent = descent;
width += info.width;
if ( partial_extents ) partial_extents[i] = width;
if ( width < max_extent ) fit++;
pstr++;
}
wine_tsx11_unlock();
*pwidth = width;
if ( pfit ) *pfit = fit;
}
static void X11DRV_GetTextMetricsW_normal( fontObject* pfo, LPTEXTMETRICW pTM )
{
LPIFONTINFO16 pdf = &pfo->fi->df;
if( ! pfo->lpX11Trans ) {
pTM->tmAscent = pfo->fs->ascent;
pTM->tmDescent = pfo->fs->descent;
} else {
pTM->tmAscent = pfo->lpX11Trans->ascent;
pTM->tmDescent = pfo->lpX11Trans->descent;
}
pTM->tmAscent *= pfo->rescale;
pTM->tmDescent *= pfo->rescale;
pTM->tmHeight = pTM->tmAscent + pTM->tmDescent;
pTM->tmAveCharWidth = pfo->foAvgCharWidth * pfo->rescale;
pTM->tmMaxCharWidth = pfo->foMaxCharWidth * pfo->rescale;
pTM->tmInternalLeading = pfo->foInternalLeading * pfo->rescale;
pTM->tmExternalLeading = pdf->dfExternalLeading * pfo->rescale;
pTM->tmStruckOut = (pfo->fo_flags & FO_SYNTH_STRIKEOUT )
? 1 : pdf->dfStrikeOut;
pTM->tmUnderlined = (pfo->fo_flags & FO_SYNTH_UNDERLINE )
? 1 : pdf->dfUnderline;
pTM->tmOverhang = 0;
if( pfo->fo_flags & FO_SYNTH_ITALIC )
{
pTM->tmOverhang += pTM->tmHeight/3;
pTM->tmItalic = 1;
} else
pTM->tmItalic = pdf->dfItalic;
pTM->tmWeight = pdf->dfWeight;
if( pfo->fo_flags & FO_SYNTH_BOLD )
{
pTM->tmOverhang++;
pTM->tmWeight += 100;
}
pTM->tmFirstChar = pdf->dfFirstChar;
pTM->tmLastChar = pdf->dfLastChar;
pTM->tmDefaultChar = pdf->dfDefaultChar;
pTM->tmBreakChar = pdf->dfBreakChar;
pTM->tmCharSet = pdf->dfCharSet;
pTM->tmPitchAndFamily = pdf->dfPitchAndFamily;
pTM->tmDigitizedAspectX = pdf->dfHorizRes;
pTM->tmDigitizedAspectY = pdf->dfVertRes;
}
static
void X11DRV_DrawString_dbcs( fontObject* pfo, Display* pdisp,
Drawable d, GC gc, int x, int y,
XChar2b* pstr, int count )
{
XTextItem16 item;
item.chars = pstr;
item.delta = 0;
item.nchars = count;
item.font = None;
X11DRV_cptable[pfo->fi->cptable].pDrawText(
pfo, pdisp, d, gc, x, y, &item, 1 );
}
static
int X11DRV_TextWidth_dbcs_2fonts( fontObject* pfo, XChar2b* pstr, int count )
{
int i;
int width;
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;
wine_tsx11_lock();
for ( i = 0; i < count; i++ )
{
curfont = ( pstr->byte1 != 0 ) ? 1 : 0;
width += XTextWidth16( pfos[curfont]->fs, pstr, 1 );
pstr ++;
}
wine_tsx11_unlock();
return width;
}
static
void X11DRV_DrawText_dbcs_2fonts( fontObject* pfo, Display* pdisp, Drawable d,
GC gc, int x, int y, XTextItem16* pitems,
int count )
{
int i, nitems, prevfont = -1, curfont;
XChar2b* pstr;
XTextItem16* ptibuf;
XTextItem16* pti;
fontObject* pfos[X11FONT_REFOBJS_MAX+1];
pfos[0] = XFONT_GetFontObject( pfo->prefobjs[0] );
pfos[1] = pfo;
if ( pfos[0] == NULL ) pfos[0] = pfo;
nitems = 0;
for ( i = 0; i < count; i++ )
nitems += pitems->nchars;
ptibuf = HeapAlloc( GetProcessHeap(), 0, sizeof(XTextItem16) * nitems );
if ( ptibuf == NULL )
return; /* out of memory */
pti = ptibuf;
while ( count-- > 0 )
{
pti->chars = pstr = pitems->chars;
pti->delta = pitems->delta;
pti->font = None;
for ( i = 0; i < pitems->nchars; i++, pstr++ )
{
curfont = ( pstr->byte1 != 0 ) ? 1 : 0;
if ( curfont != prevfont )
{
if ( pstr != pti->chars )
{
pti->nchars = pstr - pti->chars;
pti ++;
pti->chars = pstr;
pti->delta = 0;
}
pti->font = pfos[curfont]->fs->fid;
prevfont = curfont;
}
}
pti->nchars = pstr - pti->chars;
pitems ++; pti ++;
}
wine_tsx11_lock();
XDrawText16( pdisp, d, gc, x, y, ptibuf, pti - ptibuf );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, ptibuf );
}
static
void X11DRV_TextExtents_dbcs_2fonts( fontObject* pfo, XChar2b* pstr, int count,
int* pdir, int* pascent, int* pdescent,
int* pwidth, int max_extent, int* pfit,
int* partial_extents )
{
XCharStruct info;
int ascent, descent, width;
int i;
int fit;
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;
fit = 0;
*pascent = 0;
*pdescent = 0;
wine_tsx11_lock();
for ( i = 0; i < count; i++ )
{
curfont = ( pstr->byte1 != 0 ) ? 1 : 0;
XTextExtents16( pfos[curfont]->fs, pstr, 1, pdir, &ascent, &descent, &info );
if ( *pascent < ascent ) *pascent = ascent;
if ( *pdescent < descent ) *pdescent = descent;
width += info.width;
if ( partial_extents ) partial_extents[i] = width;
if ( width <= max_extent ) fit++;
pstr ++;
}
wine_tsx11_unlock();
*pwidth = width;
if ( pfit ) *pfit = fit;
}
static void X11DRV_GetTextMetricsW_cp932( fontObject* pfo, LPTEXTMETRICW pTM )
{
fontObject* pfo_ansi = XFONT_GetFontObject( pfo->prefobjs[0] );
LPIFONTINFO16 pdf = &pfo->fi->df;
LPIFONTINFO16 pdf_ansi;
pdf_ansi = ( pfo_ansi != NULL ) ? (&pfo_ansi->fi->df) : pdf;
if( ! pfo->lpX11Trans ) {
pTM->tmAscent = pfo->fs->ascent;
pTM->tmDescent = pfo->fs->descent;
} else {
pTM->tmAscent = pfo->lpX11Trans->ascent;
pTM->tmDescent = pfo->lpX11Trans->descent;
}
pTM->tmAscent *= pfo->rescale;
pTM->tmDescent *= pfo->rescale;
pTM->tmHeight = pTM->tmAscent + pTM->tmDescent;
if ( pfo_ansi != NULL )
{
pTM->tmAveCharWidth = floor((pfo_ansi->foAvgCharWidth * 2.0 + pfo->foAvgCharWidth) / 3.0 * pfo->rescale + 0.5);
pTM->tmMaxCharWidth = max(pfo_ansi->foMaxCharWidth, pfo->foMaxCharWidth) * pfo->rescale;
}
else
{
pTM->tmAveCharWidth = floor((pfo->foAvgCharWidth * pfo->rescale + 1.0) / 2.0);
pTM->tmMaxCharWidth = pfo->foMaxCharWidth * pfo->rescale;
}
pTM->tmInternalLeading = pfo->foInternalLeading * pfo->rescale;
pTM->tmExternalLeading = pdf->dfExternalLeading * pfo->rescale;
pTM->tmStruckOut = (pfo->fo_flags & FO_SYNTH_STRIKEOUT )
? 1 : pdf->dfStrikeOut;
pTM->tmUnderlined = (pfo->fo_flags & FO_SYNTH_UNDERLINE )
? 1 : pdf->dfUnderline;
pTM->tmOverhang = 0;
if( pfo->fo_flags & FO_SYNTH_ITALIC )
{
pTM->tmOverhang += pTM->tmHeight/3;
pTM->tmItalic = 1;
} else
pTM->tmItalic = pdf->dfItalic;
pTM->tmWeight = pdf->dfWeight;
if( pfo->fo_flags & FO_SYNTH_BOLD )
{
pTM->tmOverhang++;
pTM->tmWeight += 100;
}
pTM->tmFirstChar = pdf_ansi->dfFirstChar;
pTM->tmLastChar = pdf_ansi->dfLastChar;
pTM->tmDefaultChar = pdf_ansi->dfDefaultChar;
pTM->tmBreakChar = pdf_ansi->dfBreakChar;
pTM->tmCharSet = pdf->dfCharSet;
pTM->tmPitchAndFamily = pdf->dfPitchAndFamily;
pTM->tmDigitizedAspectX = pdf->dfHorizRes;
pTM->tmDigitizedAspectY = pdf->dfVertRes;
}
const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] =
{
{ /* SBCS */
X11DRV_enum_subfont_charset_normal,
X11DRV_unicode_to_char2b_sbcs,
X11DRV_DrawString_normal,
X11DRV_TextWidth_normal,
X11DRV_DrawText_normal,
X11DRV_TextExtents_normal,
X11DRV_GetTextMetricsW_normal,
},
{ /* UNICODE */
X11DRV_enum_subfont_charset_normal,
X11DRV_unicode_to_char2b_unicode,
X11DRV_DrawString_normal,
X11DRV_TextWidth_normal,
X11DRV_DrawText_normal,
X11DRV_TextExtents_normal,
X11DRV_GetTextMetricsW_normal,
},
{ /* CP932 */
X11DRV_enum_subfont_charset_cp932,
X11DRV_unicode_to_char2b_cp932,
X11DRV_DrawString_dbcs,
X11DRV_TextWidth_dbcs_2fonts,
X11DRV_DrawText_dbcs_2fonts,
X11DRV_TextExtents_dbcs_2fonts,
X11DRV_GetTextMetricsW_cp932,
},
{ /* CP936 */
X11DRV_enum_subfont_charset_cp936,
X11DRV_unicode_to_char2b_cp936,
X11DRV_DrawString_dbcs,
X11DRV_TextWidth_dbcs_2fonts,
X11DRV_DrawText_dbcs_2fonts,
X11DRV_TextExtents_dbcs_2fonts,
X11DRV_GetTextMetricsW_normal, /* FIXME */
},
{ /* CP949 */
X11DRV_enum_subfont_charset_cp949,
X11DRV_unicode_to_char2b_cp949,
X11DRV_DrawString_dbcs,
X11DRV_TextWidth_dbcs_2fonts,
X11DRV_DrawText_dbcs_2fonts,
X11DRV_TextExtents_dbcs_2fonts,
X11DRV_GetTextMetricsW_normal, /* FIXME */
},
{ /* CP950 */
X11DRV_enum_subfont_charset_cp950,
X11DRV_unicode_to_char2b_cp950,
X11DRV_DrawString_dbcs,
X11DRV_TextWidth_dbcs_2fonts,
X11DRV_DrawText_dbcs_2fonts,
X11DRV_TextExtents_dbcs_2fonts,
X11DRV_GetTextMetricsW_cp932,
},
{ /* SYMBOL */
X11DRV_enum_subfont_charset_normal,
X11DRV_unicode_to_char2b_symbol,
X11DRV_DrawString_normal,
X11DRV_TextWidth_normal,
X11DRV_DrawText_normal,
X11DRV_TextExtents_normal,
X11DRV_GetTextMetricsW_normal,
}
};

View File

@ -43,7 +43,6 @@
#include "winreg.h"
#include "x11drv.h"
#include "x11font.h"
#include "wine/debug.h"
#include "wine/unicode.h"
@ -465,37 +464,6 @@ static BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev )
}
/***********************************************************************
* X11DRV_SetupGCForText
*
* Setup physDev->gc for text drawing operations.
* Return FALSE if the font is null, TRUE otherwise.
*/
BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev )
{
XFontStruct* xfs = XFONT_GetFontStruct( physDev->font );
if( xfs )
{
XGCValues val;
val.function = GXcopy; /* Text is always GXcopy */
val.foreground = X11DRV_PALETTE_ToPhysical( physDev, GetTextColor(physDev->dev.hdc) );
val.background = X11DRV_PALETTE_ToPhysical( physDev, GetBkColor(physDev->dev.hdc) );
val.fill_style = FillSolid;
val.font = xfs->fid;
wine_tsx11_lock();
XChangeGC( gdi_display, physDev->gc,
GCFunction | GCForeground | GCBackground | GCFillStyle |
GCFont, &val );
wine_tsx11_unlock();
return TRUE;
}
WARN("Physical font failure\n" );
return FALSE;
}
/***********************************************************************
* X11DRV_XWStoDS
*

View File

@ -27,7 +27,6 @@
#include "winbase.h"
#include "winreg.h"
#include "x11drv.h"
#include "x11font.h"
#include "ddrawi.h"
#include "wine/debug.h"
@ -42,10 +41,6 @@ static int horz_size; /* horz. size of screen in millimeters */
static int vert_size; /* vert. size of screen in millimeters */
static int palette_size;
static int device_init_done;
unsigned int text_caps = (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
TC_CR_ANY | TC_SA_DOUBLE | TC_SA_INTEGER |
TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE);
/* X11R6 adds TC_SF_X_YINDEP, Xrender adds TC_VA_ABLE */
static const WCHAR dpi_key_name[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
@ -102,9 +97,6 @@ static void device_init(void)
log_pixels_x = log_pixels_y = get_dpi();
horz_size = MulDiv( screen_width, 254, log_pixels_x * 10 );
vert_size = MulDiv( screen_height, 254, log_pixels_y * 10 );
/* Initialize fonts and text caps */
X11DRV_FONT_Init(log_pixels_x, log_pixels_y);
}
/**********************************************************************
@ -247,7 +239,9 @@ static INT X11DRV_GetDeviceCaps( PHYSDEV dev, INT cap )
return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE |
PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
case TEXTCAPS:
return text_caps;
return (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
TC_CR_ANY | TC_SF_X_YINDEP | TC_SA_DOUBLE | TC_SA_INTEGER |
TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE | TC_VA_ABLE);
case CLIPCAPS:
return CP_REGION;
case COLORRES:
@ -338,15 +332,6 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d
return TRUE;
}
break;
case X11DRV_GET_FONT:
if (out_count >= sizeof(Font))
{
fontObject* pfo = XFONT_GetFontObject( physDev->font );
if (pfo == NULL) return FALSE;
*(Font *)out_data = pfo->fs->fid;
return TRUE;
}
break;
case X11DRV_SET_DRAWABLE:
if (in_count >= sizeof(struct x11drv_escape_set_drawable))
{
@ -427,6 +412,7 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d
return TRUE;
}
break;
case X11DRV_GET_FONT:
case X11DRV_GET_DCE:
case X11DRV_SET_DCE:
case X11DRV_SYNC_PIXMAP:
@ -476,14 +462,14 @@ static const struct gdi_dc_funcs x11drv_funcs =
NULL, /* pEndDoc */
NULL, /* pEndPage */
NULL, /* pEndPath */
X11DRV_EnumFonts, /* pEnumFonts */
NULL, /* pEnumFonts */
X11DRV_EnumICMProfiles, /* pEnumICMProfiles */
NULL, /* pExcludeClipRect */
NULL, /* pExtDeviceMode */
X11DRV_ExtEscape, /* pExtEscape */
X11DRV_ExtFloodFill, /* pExtFloodFill */
NULL, /* pExtSelectClipRgn */
X11DRV_ExtTextOut, /* pExtTextOut */
NULL, /* pExtTextOut */
NULL, /* pFillPath */
NULL, /* pFillRgn */
NULL, /* pFlattenPath */
@ -494,7 +480,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
NULL, /* pGetBoundsRect */
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */
X11DRV_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetCharWidth */
X11DRV_GetDeviceCaps, /* pGetDeviceCaps */
X11DRV_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */
@ -510,10 +496,10 @@ static const struct gdi_dc_funcs x11drv_funcs =
X11DRV_GetPixelFormat, /* pGetPixelFormat */
X11DRV_GetSystemPaletteEntries, /* pGetSystemPaletteEntries */
NULL, /* pGetTextCharsetInfo */
X11DRV_GetTextExtentExPoint, /* pGetTextExtentExPoint */
NULL, /* pGetTextExtentExPoint */
NULL, /* pGetTextExtentExPointI */
NULL, /* pGetTextFace */
X11DRV_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pGetTextMetrics */
X11DRV_GradientFill, /* pGradientFill */
NULL, /* pIntersectClipRect */
NULL, /* pInvertRgn */
@ -547,7 +533,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
X11DRV_SelectBitmap, /* pSelectBitmap */
X11DRV_SelectBrush, /* pSelectBrush */
NULL, /* pSelectClipPath */
X11DRV_SelectFont, /* pSelectFont */
NULL, /* pSelectFont */
NULL, /* pSelectPalette */
X11DRV_SelectPen, /* pSelectPen */
NULL, /* pSetArcDirection */

View File

@ -233,7 +233,6 @@ MAKE_FUNCPTR(glXMakeCurrent)
MAKE_FUNCPTR(glXSwapBuffers)
MAKE_FUNCPTR(glXQueryExtension)
MAKE_FUNCPTR(glXQueryVersion)
MAKE_FUNCPTR(glXUseXFont)
/* GLX 1.1 */
MAKE_FUNCPTR(glXGetClientString)
@ -478,7 +477,6 @@ static BOOL has_opengl(void)
LOAD_FUNCPTR(glXSwapBuffers);
LOAD_FUNCPTR(glXQueryExtension);
LOAD_FUNCPTR(glXQueryVersion);
LOAD_FUNCPTR(glXUseXFont);
/* GLX 1.1 */
LOAD_FUNCPTR(glXGetClientString);
@ -2199,22 +2197,10 @@ static BOOL internal_wglUseFontBitmaps(HDC hdc, DWORD first, DWORD count, DWORD
*/
BOOL X11DRV_wglUseFontBitmapsA(PHYSDEV dev, DWORD first, DWORD count, DWORD listBase)
{
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
Font fid = physDev->font;
TRACE("(%p, %d, %d, %d) using font %ld\n", dev->hdc, first, count, listBase, fid);
TRACE("(%p, %d, %d, %d)\n", dev->hdc, first, count, listBase);
if (!has_opengl()) return FALSE;
if (fid == 0) {
return internal_wglUseFontBitmaps(dev->hdc, first, count, listBase, GetGlyphOutlineA);
}
wine_tsx11_lock();
/* I assume that the glyphs are at the same position for X and for Windows */
pglXUseXFont(fid, first, count, listBase);
wine_tsx11_unlock();
return TRUE;
return internal_wglUseFontBitmaps(dev->hdc, first, count, listBase, GetGlyphOutlineA);
}
/**
@ -2224,24 +2210,10 @@ BOOL X11DRV_wglUseFontBitmapsA(PHYSDEV dev, DWORD first, DWORD count, DWORD list
*/
BOOL X11DRV_wglUseFontBitmapsW(PHYSDEV dev, DWORD first, DWORD count, DWORD listBase)
{
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
Font fid = physDev->font;
TRACE("(%p, %d, %d, %d) using font %ld\n", dev->hdc, first, count, listBase, fid);
TRACE("(%p, %d, %d, %d)\n", dev->hdc, first, count, listBase);
if (!has_opengl()) return FALSE;
if (fid == 0) {
return internal_wglUseFontBitmaps(dev->hdc, first, count, listBase, GetGlyphOutlineW);
}
WARN("Using the glX API for the WCHAR variant - some characters may come out incorrectly !\n");
wine_tsx11_lock();
/* I assume that the glyphs are at the same position for X and for Windows */
pglXUseXFont(fid, first, count, listBase);
wine_tsx11_unlock();
return TRUE;
return internal_wglUseFontBitmaps(dev->hdc, first, count, listBase, GetGlyphOutlineW);
}
/* WGL helper function which handles differences in glGetIntegerv from WGL and GLX */

View File

@ -1,234 +0,0 @@
/*
* X11 graphics driver text functions
*
* Copyright 1993,1994 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <stdlib.h>
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "x11font.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(text);
#define IROUND(x) (int)((x)>0? (x)+0.5 : (x) - 0.5)
/***********************************************************************
* X11DRV_ExtTextOut
*/
BOOL X11DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR wstr, UINT count, const INT *lpDx )
{
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
BOOL restore_region = FALSE;
unsigned int i;
int pixel;
fontObject* pfo = XFONT_GetFontObject( physDev->font );
XFontStruct* font;
BOOL rotated = FALSE;
XChar2b *str2b = NULL;
BOOL result = TRUE;
if (!pfo)
{
dev = GET_NEXT_PHYSDEV( dev, pExtTextOut );
return dev->funcs->pExtTextOut( dev, x, y, flags, lprect, wstr, count, lpDx );
}
if (!X11DRV_SetupGCForText( physDev )) return TRUE;
font = pfo->fs;
if (pfo->lf.lfEscapement && pfo->lpX11Trans)
rotated = TRUE;
TRACE("hdc=%p df=%04x %d,%d rc %s %s, %d flags=%d lpDx=%p\n",
dev->hdc, (UINT16)physDev->font, x, y, wine_dbgstr_rect(lprect),
debugstr_wn (wstr, count), count, flags, lpDx);
/* Draw the rectangle */
if (flags & ETO_OPAQUE)
{
pixel = X11DRV_PALETTE_ToPhysical( physDev, GetBkColor(physDev->dev.hdc) );
wine_tsx11_lock();
XSetForeground( gdi_display, physDev->gc, pixel );
XFillRectangle( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + lprect->left, physDev->dc_rect.top + lprect->top,
lprect->right - lprect->left, lprect->bottom - lprect->top );
wine_tsx11_unlock();
}
if (!count) goto END; /* Nothing more to do */
/* Set the clip region */
if (flags & ETO_CLIPPED)
{
HRGN clip_region = CreateRectRgnIndirect( lprect );
restore_region = add_extra_clipping_region( physDev, clip_region );
DeleteObject( clip_region );
}
/* Draw the text (count > 0 verified) */
if (!(str2b = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, wstr, count )))
{
result = FALSE;
goto END;
}
pixel = X11DRV_PALETTE_ToPhysical( physDev, GetTextColor(physDev->dev.hdc) );
wine_tsx11_lock();
XSetForeground( gdi_display, physDev->gc, pixel );
wine_tsx11_unlock();
if(!rotated)
{
if (!lpDx)
{
X11DRV_cptable[pfo->fi->cptable].pDrawString(
pfo, gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + x, physDev->dc_rect.top + y, str2b, count );
}
else
{
XTextItem16 *items;
items = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XTextItem16) );
if(items == NULL)
{
result = FALSE;
goto END;
}
items[0].chars = str2b;
items[0].delta = 0;
items[0].nchars = 1;
items[0].font = None;
for(i = 1; i < count; i++)
{
items[i].chars = str2b + i;
items[i].delta = (flags & ETO_PDY) ? lpDx[(i - 1) * 2] : lpDx[i - 1];
items[i].delta -= X11DRV_cptable[pfo->fi->cptable].pTextWidth( pfo, str2b + i - 1, 1 );
items[i].nchars = 1;
items[i].font = None;
}
X11DRV_cptable[pfo->fi->cptable].pDrawText( pfo, gdi_display,
physDev->drawable, physDev->gc,
physDev->dc_rect.left + x, physDev->dc_rect.top + y, items, count );
HeapFree( GetProcessHeap(), 0, items );
}
}
else /* rotated */
{
/* have to render character by character. */
double offset = 0.0;
UINT i;
for (i=0; i<count; i++)
{
int char_metric_offset = str2b[i].byte2 + (str2b[i].byte1 << 8)
- font->min_char_or_byte2;
int x_i = IROUND((double) (physDev->dc_rect.left + x) + offset *
pfo->lpX11Trans->a / pfo->lpX11Trans->pixelsize );
int y_i = IROUND((double) (physDev->dc_rect.top + y) - offset *
pfo->lpX11Trans->b / pfo->lpX11Trans->pixelsize );
X11DRV_cptable[pfo->fi->cptable].pDrawString(
pfo, gdi_display, physDev->drawable, physDev->gc,
x_i, y_i, &str2b[i], 1);
if (lpDx)
{
offset += (flags & ETO_PDY) ? lpDx[i * 2] : lpDx[i];
}
else
{
offset += (double) (font->per_char ?
font->per_char[char_metric_offset].attributes:
font->min_bounds.attributes)
* pfo->lpX11Trans->pixelsize / 1000.0;
}
}
}
END:
HeapFree( GetProcessHeap(), 0, str2b );
if (restore_region) restore_clipping_region( physDev );
return result;
}
/***********************************************************************
* X11DRV_GetTextExtentExPoint
*/
BOOL X11DRV_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count,
INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size )
{
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
fontObject* pfo = XFONT_GetFontObject( physDev->font );
TRACE("%s %d\n", debugstr_wn(str,count), count);
if( pfo ) {
XChar2b *p = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, str, count );
if (!p) return FALSE;
if( !pfo->lpX11Trans ) {
int dir, ascent, descent;
int info_width;
X11DRV_cptable[pfo->fi->cptable].pTextExtents( pfo, p,
count, &dir, &ascent, &descent, &info_width,
maxExt, lpnFit, alpDx );
size->cx = info_width;
size->cy = pfo->fs->ascent + pfo->fs->descent;
} else {
INT i;
INT nfit = 0;
float x = 0.0, y = 0.0;
float scaled_x = 0.0, pixsize = pfo->lpX11Trans->pixelsize;
/* FIXME: Deal with *_char_or_byte2 != 0 situations */
for(i = 0; i < count; i++) {
x += pfo->fs->per_char ?
pfo->fs->per_char[p[i].byte2 - pfo->fs->min_char_or_byte2].attributes :
pfo->fs->min_bounds.attributes;
scaled_x = x * pixsize / 1000.0;
if (alpDx)
alpDx[i] = scaled_x;
if (scaled_x <= maxExt)
++nfit;
}
y = pfo->lpX11Trans->RAW_ASCENT + pfo->lpX11Trans->RAW_DESCENT;
TRACE("x = %f y = %f\n", x, y);
size->cx = x * pfo->lpX11Trans->pixelsize / 1000.0;
size->cy = y * pfo->lpX11Trans->pixelsize / 1000.0;
if (lpnFit)
*lpnFit = nfit;
}
size->cx *= pfo->rescale;
size->cy *= pfo->rescale;
HeapFree( GetProcessHeap(), 0, p );
return TRUE;
}
dev = GET_NEXT_PHYSDEV( dev, pGetTextExtentExPoint );
return dev->funcs->pGetTextExtentExPoint( dev, str, count, maxExt, lpnFit, alpDx, size );
}

View File

@ -114,9 +114,6 @@ typedef struct
BOOL trueColor;
} X_PHYSBITMAP;
/* X physical font */
typedef UINT X_PHYSFONT;
/* X physical device */
typedef struct
{
@ -126,11 +123,9 @@ typedef struct
RECT dc_rect; /* DC rectangle relative to drawable */
RECT drawable_rect; /* Drawable rectangle relative to screen */
HRGN region; /* Device region (visible region & clip region) */
X_PHYSFONT font;
X_PHYSPEN pen;
X_PHYSBRUSH brush;
X_PHYSBITMAP *bitmap; /* currently selected bitmap for memory DCs */
BOOL has_gdi_font; /* is current font a GDI font? */
int depth; /* bit depth of the DC */
ColorShifts *color_shifts; /* color shifts of the DC */
int exposures; /* count of graphics exposures operations */
@ -160,21 +155,14 @@ extern BOOL X11DRV_CopyBitmap( HBITMAP src, HBITMAP dst ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_DeleteBitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_EnumFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW dfeproc, LPARAM lp ) DECLSPEC_HIDDEN;
extern INT X11DRV_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW proc, LPARAM lparam ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect,
LPCWSTR str, UINT count, const INT *lpDx ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_GetCharWidth( PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_GetDeviceGammaRamp( PHYSDEV dev, LPVOID ramp ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename ) DECLSPEC_HIDDEN;
extern DWORD X11DRV_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
struct gdi_image_bits *bits, struct bitblt_coords *src ) DECLSPEC_HIDDEN;
extern COLORREF X11DRV_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern UINT X11DRV_GetSystemPaletteEntries( PHYSDEV dev, UINT start, UINT count, LPPALETTEENTRY entries ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT maxExt,
LPINT lpnFit, LPINT alpDx, LPSIZE size ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics) DECLSPEC_HIDDEN;
extern BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_LineTo( PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN;
@ -195,7 +183,6 @@ extern BOOL X11DRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bot
INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
extern HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDDEN;
extern HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
extern HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont ) DECLSPEC_HIDDEN;
extern HPEN X11DRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
extern COLORREF X11DRV_SetDCBrushColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_HIDDEN;
extern COLORREF X11DRV_SetDCPenColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_HIDDEN;
@ -233,7 +220,6 @@ extern void X11DRV_OpenGL_Cleanup(void) DECLSPEC_HIDDEN;
extern void X11DRV_Xcursor_Init(void) DECLSPEC_HIDDEN;
extern void X11DRV_BITMAP_Init(void) DECLSPEC_HIDDEN;
extern void X11DRV_FONT_Init( int log_pixels_x, int log_pixels_y ) DECLSPEC_HIDDEN;
extern void X11DRV_XInput2_Init(void) DECLSPEC_HIDDEN;
extern HBITMAP create_brush_bitmap( X11DRV_PDEVICE *physDev, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
@ -253,7 +239,6 @@ extern void execute_rop( X11DRV_PDEVICE *physdev, Pixmap src_pixmap, GC gc, cons
extern BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_SetupGCForBrush( X11DRV_PDEVICE *physDev ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev ) DECLSPEC_HIDDEN;
extern INT X11DRV_XWStoDS( HDC hdc, INT width ) DECLSPEC_HIDDEN;
extern INT X11DRV_YWStoDS( HDC hdc, INT height ) DECLSPEC_HIDDEN;
@ -261,11 +246,9 @@ extern const int X11DRV_XROPfunction[];
extern void _XInitImageFuncPtrs(XImage *) DECLSPEC_HIDDEN;
extern int client_side_with_core DECLSPEC_HIDDEN;
extern int client_side_with_render DECLSPEC_HIDDEN;
extern int client_side_antialias_with_core DECLSPEC_HIDDEN;
extern int client_side_antialias_with_render DECLSPEC_HIDDEN;
extern int using_client_side_fonts DECLSPEC_HIDDEN;
extern const struct gdi_dc_funcs *X11DRV_XRender_Init(void) DECLSPEC_HIDDEN;
extern void X11DRV_XRender_Finalize(void) DECLSPEC_HIDDEN;
@ -415,7 +398,6 @@ extern unsigned int screen_height DECLSPEC_HIDDEN;
extern unsigned int screen_bpp DECLSPEC_HIDDEN;
extern unsigned int screen_depth DECLSPEC_HIDDEN;
extern RECT virtual_screen_rect DECLSPEC_HIDDEN;
extern unsigned int text_caps DECLSPEC_HIDDEN;
extern int use_xkb DECLSPEC_HIDDEN;
extern int usexrandr DECLSPEC_HIDDEN;
extern int usexvidmode DECLSPEC_HIDDEN;

View File

@ -90,7 +90,6 @@ int managed_mode = 1;
int decorated_mode = 1;
int private_color_map = 0;
int primary_monitor = 0;
int client_side_with_core = 1;
int client_side_with_render = 1;
int client_side_antialias_with_core = 1;
int client_side_antialias_with_render = 1;
@ -423,9 +422,6 @@ static void setup_options(void)
if (!get_config_key( hkey, appkey, "ScreenDepth", buffer, sizeof(buffer) ))
screen_depth = atoi(buffer);
if (!get_config_key( hkey, appkey, "ClientSideWithCore", buffer, sizeof(buffer) ))
client_side_with_core = IS_OPTION_TRUE( buffer[0] );
if (!get_config_key( hkey, appkey, "ClientSideWithRender", buffer, sizeof(buffer) ))
client_side_with_render = IS_OPTION_TRUE( buffer[0] );

View File

@ -1,249 +0,0 @@
/*
* X11 physical font definitions
*
* Copyright 1997 Alex Korobka
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_X11FONT_H
#define __WINE_X11FONT_H
#include "wine/wingdi16.h"
#include "x11drv.h"
#include "pshpack1.h"
/* this is a part of the font resource header, should
* make it easier to implement dynamic softfont loading */
typedef struct
{
INT16 dfType;
INT16 dfPoints;
INT16 dfVertRes;
INT16 dfHorizRes;
INT16 dfAscent;
INT16 dfInternalLeading;
INT16 dfExternalLeading;
CHAR dfItalic;
CHAR dfUnderline;
CHAR dfStrikeOut;
INT16 dfWeight;
BYTE dfCharSet;
INT16 dfPixWidth;
INT16 dfPixHeight;
CHAR dfPitchAndFamily;
INT16 dfAvgWidth;
INT16 dfMaxWidth;
CHAR dfFirstChar;
CHAR dfLastChar;
CHAR dfDefaultChar;
CHAR dfBreakChar;
INT16 dfWidthBytes;
LPCSTR dfDevice;
LPCSTR dfFace;
} IFONTINFO16, *LPIFONTINFO16;
#include "poppack.h"
/* internal flags */
#define FI_POLYWEIGHT 0x0001
#define FI_POLYSLANT 0x0002
#define FI_OBLIQUE 0x0004
#define FI_SCALABLE 0x0008
#define FI_FW_BOOK 0x0010
#define FI_FW_DEMI 0x0020
#define FI_VARIABLEPITCH 0x0040
#define FI_FIXEDPITCH 0x0080
#define FI_FIXEDEX 0x1000
#define FI_NORMAL 0x2000
#define FI_SUBSET 0x4000
#define FI_TRUETYPE 0x8000
/* code pages */
#define FI_ENC_ANSI 0
#define FI_ENC_ISO8859 1
#define FI_ENC_ISO646 2
#define FI_ENC_MICROSOFT 3
#define FI_ENC_KOI8 4
#define FI_ENC_ASCII 5
#define FI_ENC_VISCII 6
#define FI_ENC_TCVN 7
#define FI_ENC_TIS620 8
enum X11DRV_CPTABLE
{
X11DRV_CPTABLE_SBCS,
X11DRV_CPTABLE_UNICODE,
X11DRV_CPTABLE_CP932,
X11DRV_CPTABLE_CP936,
X11DRV_CPTABLE_CP949,
X11DRV_CPTABLE_CP950,
X11DRV_CPTABLE_SYMBOL,
X11DRV_CPTABLE_COUNT
};
typedef struct tagFontInfo
{
struct tagFontInfo* next;
UINT16 fi_flags;
UINT16 fi_encoding;
UINT16 codepage;
UINT16 cptable;
WORD internal_charset;
/* LFD parameters can be quite different from the actual metrics */
UINT16 lfd_height;
UINT16 lfd_resolution;
IFONTINFO16 df;
} fontInfo;
/* Font resource list for EnumFont() purposes */
#define FR_SOFTFONT 0x1000 /* - .FON or .FOT file */
#define FR_SOFTRESOURCE 0x2000 /* - resource handle */
#define FR_REMOVED 0x4000 /* delayed remove */
#define FR_NAMESET 0x8000
#define LFD_FIELDS 14
typedef struct
{
const char* foundry;
const char* family;
const char* weight;
const char* slant;
const char* set_width;
const char* add_style;
const char* pixel_size;
const char* point_size;
const char* resolution_x;
const char* resolution_y;
const char* spacing;
const char* average_width;
const char* charset_registry;
const char* charset_encoding;
} LFD;
typedef struct tagFontResource
{
struct tagFontResource* next;
UINT16 fr_flags;
UINT16 fr_penalty;
UINT16 fi_count;
UINT16 fo_count;
fontInfo* fi;
LFD* resource;
HANDLE hOwner; /* For FR_SOFTFONT/FR_SOFTRESOURCE fonts */
CHAR lfFaceName[LF_FACESIZE];
} fontResource;
typedef struct {
float a,b,c,d; /* pixelsize matrix, FIXME: switch to MAT2 format */
unsigned long RAW_ASCENT;
unsigned long RAW_DESCENT;
float pixelsize;
float ascent;
float descent;
} XFONTTRANS;
#define FO_RESOURCE_MASK 0x000F
#define FO_SYSTEM 0x0001 /* resident in cache */
#define FO_SOFTFONT 0x0002 /* installed at runtime */
#define FO_SHARED 0x0004 /* MITSHM */
#define FO_REMOVED 0x0008 /* remove when count falls to 0 */
#define FO_MATCH_MASK 0x00F0
#define FO_MATCH_NORASTER 0x0010
#define FO_MATCH_PAF 0x0020
#define FO_MATCH_XYINDEP 0x0040
#define FO_SYNTH_MASK 0xFF00
#define FO_SYNTH_HEIGHT 0x2000
#define FO_SYNTH_WIDTH 0x4000
#define FO_SYNTH_ROTATE 0x8000
#define FO_SYNTH_BOLD 0x0100
#define FO_SYNTH_ITALIC 0x0200
#define FO_SYNTH_UNDERLINE 0x0400
#define FO_SYNTH_STRIKEOUT 0x0800
/* Realized screen font */
#define X11FONT_REFOBJS_MAX 4
typedef struct
{
XFontStruct* fs; /* text metrics */
fontResource* fr; /* font family */
fontInfo* fi; /* font instance info */
Pixmap* lpPixmap; /* optional character bitmasks for synth fonts */
X_PHYSFONT prefobjs[X11FONT_REFOBJS_MAX]; /* font objects for DBCS charsets */
XFONTTRANS *lpX11Trans; /* Info for X11R6 transform */
float rescale; /* Rescale for large fonts */
INT16 foInternalLeading;
INT16 foAvgCharWidth;
INT16 foMaxCharWidth;
UINT16 fo_flags;
/* font cache housekeeping */
UINT16 count;
UINT16 lru;
UINT16 lfchecksum;
LOGFONT16 lf;
} fontObject;
typedef struct
{
fontResource* pfr;
fontInfo* pfi;
UINT16 height;
UINT16 flags;
LPLOGFONT16 plf;
WORD internal_charset;
} fontMatch;
extern fontObject* XFONT_GetFontObject( X_PHYSFONT pFont ) DECLSPEC_HIDDEN;
extern XFontStruct* XFONT_GetFontStruct( X_PHYSFONT pFont ) DECLSPEC_HIDDEN;
/* internal charset(hibyte must be set) */
/* lobyte is DEFAULT_CHARSET(=0). */
#define X11FONT_JISX0201_CHARSET 0x100
#define X11FONT_JISX0212_CHARSET 0x200
typedef struct tagX11DRV_CP
{
WORD (*penum_subfont_charset)( UINT index );
XChar2b* (*punicode_to_char2b)( fontObject* pfo,
LPCWSTR lpwstr, UINT count );
void (*pDrawString)( fontObject* pfo, Display* pdisp, Drawable d, GC gc,
int x, int y, XChar2b* pstr, int count );
int (*pTextWidth)( fontObject* pfo, XChar2b* pstr, int count );
void (*pDrawText)( fontObject* pfo, Display* pdisp, Drawable d, GC gc,
int x, int y, XTextItem16* pitems, int count );
void (*pTextExtents)( fontObject* pfo, XChar2b* pstr, int count,
int* pdir, int* pascent, int* pdescent,
int* pwidth, int max_extent, int *pfit,
int* partial_extents );
void (*pGetTextMetricsW)( fontObject* pfo, LPTEXTMETRICW pTM );
} X11DRV_CP;
extern const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] DECLSPEC_HIDDEN;
#endif /* __WINE_X11FONT_H */

File diff suppressed because it is too large Load Diff

View File

@ -38,8 +38,6 @@
#include "wine/unicode.h"
#include "wine/debug.h"
int using_client_side_fonts = FALSE;
WINE_DEFAULT_DEBUG_CHANNEL(xrender);
#ifdef SONAME_LIBXRENDER
@ -365,8 +363,6 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void)
int event_base, i;
BOOL ok;
using_client_side_fonts = client_side_with_render || client_side_with_core;
if (!client_side_with_render) return NULL;
if (!(xrender_handle = wine_dlopen(SONAME_LIBXRENDER, RTLD_NOW, NULL, 0))) return NULL;
@ -1109,50 +1105,39 @@ void X11DRV_XRender_Finalize(void)
*/
static HFONT xrenderdrv_SelectFont( PHYSDEV dev, HFONT hfont )
{
LFANDSIZE lfsz;
struct xrender_physdev *physdev = get_xrender_dev( dev );
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectFont );
HFONT ret = next->funcs->pSelectFont( next, hfont );
if (!ret) return 0;
if (physdev->x11dev->has_gdi_font)
{
LFANDSIZE lfsz;
GetObjectW( hfont, sizeof(lfsz.lf), &lfsz.lf );
GetObjectW( hfont, sizeof(lfsz.lf), &lfsz.lf );
TRACE("h=%d w=%d weight=%d it=%d charset=%d name=%s\n",
lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight,
lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName));
lfsz.lf.lfWidth = abs( lfsz.lf.lfWidth );
lfsz.devsize.cx = X11DRV_XWStoDS( dev->hdc, lfsz.lf.lfWidth );
lfsz.devsize.cy = X11DRV_YWStoDS( dev->hdc, lfsz.lf.lfHeight );
TRACE("h=%d w=%d weight=%d it=%d charset=%d name=%s\n",
lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight,
lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName));
lfsz.lf.lfWidth = abs( lfsz.lf.lfWidth );
lfsz.devsize.cx = X11DRV_XWStoDS( dev->hdc, lfsz.lf.lfWidth );
lfsz.devsize.cy = X11DRV_YWStoDS( dev->hdc, lfsz.lf.lfHeight );
GetTransform( dev->hdc, 0x204, &lfsz.xform );
TRACE("font transform %f %f %f %f\n", lfsz.xform.eM11, lfsz.xform.eM12,
lfsz.xform.eM21, lfsz.xform.eM22);
GetTransform( dev->hdc, 0x204, &lfsz.xform );
TRACE("font transform %f %f %f %f\n", lfsz.xform.eM11, lfsz.xform.eM12,
lfsz.xform.eM21, lfsz.xform.eM22);
if (GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE && lfsz.xform.eM11 * lfsz.xform.eM22 < 0)
lfsz.lf.lfOrientation = -lfsz.lf.lfOrientation;
if (GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE && lfsz.xform.eM11 * lfsz.xform.eM22 < 0)
lfsz.lf.lfOrientation = -lfsz.lf.lfOrientation;
/* Not used fields, would break hashing */
lfsz.xform.eDx = lfsz.xform.eDy = 0;
/* Not used fields, would break hashing */
lfsz.xform.eDx = lfsz.xform.eDy = 0;
lfsz_calc_hash(&lfsz);
lfsz_calc_hash(&lfsz);
EnterCriticalSection(&xrender_cs);
if (physdev->cache_index != -1)
dec_ref_cache( physdev->cache_index );
physdev->cache_index = GetCacheEntry( dev->hdc, &lfsz );
LeaveCriticalSection(&xrender_cs);
}
else
{
EnterCriticalSection( &xrender_cs );
if (physdev->cache_index != -1) dec_ref_cache( physdev->cache_index );
physdev->cache_index = -1;
LeaveCriticalSection( &xrender_cs );
}
EnterCriticalSection(&xrender_cs);
if (physdev->cache_index != -1)
dec_ref_cache( physdev->cache_index );
physdev->cache_index = GetCacheEntry( dev->hdc, &lfsz );
LeaveCriticalSection(&xrender_cs);
return ret;
}
@ -1696,12 +1681,6 @@ static BOOL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
int render_op = PictOpOver;
XRenderColor col;
if (!physdev->x11dev->has_gdi_font)
{
dev = GET_NEXT_PHYSDEV( dev, pExtTextOut );
return dev->funcs->pExtTextOut( dev, x, y, flags, lprect, wstr, count, lpDx );
}
get_xrender_color( physdev, GetTextColor( physdev->dev.hdc ), &col );
pict = get_xrender_picture( physdev, 0, (flags & ETO_CLIPPED) ? lprect : NULL );