Commit 5d71559d authored by Cyril Deguet's avatar Cyril Deguet

* x11/x11_window.cpp: fixed clipping and text attributes

parent 12d6fe8f
......@@ -2,7 +2,7 @@
* x11_font.cpp: X11 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_font.cpp,v 1.5 2003/06/01 22:11:24 asmax Exp $
* $Id: x11_font.cpp,v 1.6 2003/06/06 21:47:18 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -47,10 +47,18 @@ X11Font::X11Font( intf_thread_t *_p_intf, string fontname, int size,
: SkinFont( _p_intf, fontname, size, color, weight, italic, underline )
{
display = g_pIntf->p_sys->display;
Underline = underline;
char name[256];
char slant = ( italic ? 'i' : 'r' );
// FIXME: a lot of work...
size = ( size < 10 ? 8 : 12 );
snprintf( name, 256, "-*-helvetica-bold-%c-*-*-*-%i-*-*-*-*-*-*",
slant, 10 * size );
msg_Warn( _p_intf, "loading font %s", name );
// FIXME: just a beginning...
XLOCK;
font = XLoadFont( display, "-misc-fixed-*-*-*-*-*-*-*-*-*-*-*-*" );
font = XLoadFont( display, name );
XUNLOCK;
}
//---------------------------------------------------------------------------
......@@ -84,14 +92,29 @@ void X11Font::GenericPrint( Graphics *dest, string text, int x, int y,
GC gc = ( (X11Graphics *)dest )->GetGC();
XGCValues gcVal;
// Change color to avoid transparency
gcVal.foreground = (color == 0 ? 10 : color);
gcVal.font = font;
XRectangle rect;
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h+1;
// Render text on buffer
XLOCK;
XChangeGC( display, gc, GCForeground|GCFont, &gcVal );
XDrawString( display, drawable, gc, x, y+h, text.c_str(),
text.size());
// Set the clipping region
XSetClipRectangles( display, gc, 0, 0, &rect, 1, Unsorted );
// Render text no the drawable
XDrawString( display, drawable, gc, x, y+h, text.c_str(), text.size());
if( Underline )
{
XDrawLine( display, drawable, gc, x, y+h, x+w, y+h );
}
// Reset the clip mask
XSetClipMask( display, gc, None );
XUNLOCK;
}
......
......@@ -2,7 +2,7 @@
* x11_font.h: X11 implementation of the Font class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: x11_font.h,v 1.2 2003/06/01 16:39:49 asmax Exp $
* $Id: x11_font.h,v 1.3 2003/06/06 21:47:18 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
......@@ -43,6 +43,7 @@ class X11Font : SkinFont
private:
Display *display;
Font font;
bool Underline;
// Assign font to Device Context
virtual void AssignFont( Graphics *dest );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment