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 @@ ...@@ -2,7 +2,7 @@
* x11_font.cpp: X11 implementation of the Font class * x11_font.cpp: X11 implementation of the Font class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -47,10 +47,18 @@ X11Font::X11Font( intf_thread_t *_p_intf, string fontname, int size, ...@@ -47,10 +47,18 @@ X11Font::X11Font( intf_thread_t *_p_intf, string fontname, int size,
: SkinFont( _p_intf, fontname, size, color, weight, italic, underline ) : SkinFont( _p_intf, fontname, size, color, weight, italic, underline )
{ {
display = g_pIntf->p_sys->display; 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; XLOCK;
font = XLoadFont( display, "-misc-fixed-*-*-*-*-*-*-*-*-*-*-*-*" ); font = XLoadFont( display, name );
XUNLOCK; XUNLOCK;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -84,14 +92,29 @@ void X11Font::GenericPrint( Graphics *dest, string text, int x, int y, ...@@ -84,14 +92,29 @@ void X11Font::GenericPrint( Graphics *dest, string text, int x, int y,
GC gc = ( (X11Graphics *)dest )->GetGC(); GC gc = ( (X11Graphics *)dest )->GetGC();
XGCValues gcVal; XGCValues gcVal;
// Change color to avoid transparency
gcVal.foreground = (color == 0 ? 10 : color); gcVal.foreground = (color == 0 ? 10 : color);
gcVal.font = font; gcVal.font = font;
XRectangle rect;
// Render text on buffer rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h+1;
XLOCK; XLOCK;
XChangeGC( display, gc, GCForeground|GCFont, &gcVal ); XChangeGC( display, gc, GCForeground|GCFont, &gcVal );
XDrawString( display, drawable, gc, x, y+h, text.c_str(), // Set the clipping region
text.size()); 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; XUNLOCK;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11_font.h: X11 implementation of the Font class * x11_font.h: X11 implementation of the Font class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * 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> * Authors: Cyril Deguet <asmax@videolan.org>
* *
...@@ -43,6 +43,7 @@ class X11Font : SkinFont ...@@ -43,6 +43,7 @@ class X11Font : SkinFont
private: private:
Display *display; Display *display;
Font font; Font font;
bool Underline;
// Assign font to Device Context // Assign font to Device Context
virtual void AssignFont( Graphics *dest ); 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