Changeset 20b81062cbc8c4fdd68441adf6996bfad80a9af2

Show
Ignore:
Timestamp:
19/04/03 14:39:14 (6 years ago)
Author:
Emmanuel Puig <karibu@videolan.org>
git-committer:
Emmanuel Puig <karibu@videolan.org> 1050755954 +0000
git-parent:

[b06e5e49714c119f5067eea816f6d2ac66d07c39]

git-author:
Emmanuel Puig <karibu@videolan.org> 1050755954 +0000
Message:

* Font fixed

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/gui/skins/gtk2/gtk2_font.cpp

    r5ee0310 r20b8106  
    33 ***************************************************************************** 
    44 * Copyright (C) 2003 VideoLAN 
    5  * $Id: gtk2_font.cpp,v 1.10 2003/04/19 02:34:47 karibu Exp $ 
     5 * $Id: gtk2_font.cpp,v 1.11 2003/04/19 12:39:14 karibu Exp $ 
    66 * 
    77 * Authors: Cyril Deguet     <asmax@videolan.org> 
     
    5151 
    5252    // Text properties setting 
    53     FontDesc = pango_font_description_new(); 
     53    FontDesc    = pango_font_description_new(); 
    5454 
    5555    pango_font_description_set_family( FontDesc, fontname.c_str() ); 
     
    5858 
    5959    if( italic ) 
     60    { 
    6061        pango_font_description_set_style( FontDesc, PANGO_STYLE_ITALIC ); 
     62    } 
    6163    else 
     64    { 
    6265        pango_font_description_set_style( FontDesc, PANGO_STYLE_NORMAL ); 
     66    } 
    6367 
    6468    pango_font_description_set_weight( FontDesc, (PangoWeight)weight ); 
     
    6771 
    6872    // Set attributes 
     73    //PangoFont* font = pango_context_load_font( Context, FontDesc ); 
     74 
     75    //pango_context_set_font_description( Context, FontDesc ); 
    6976    pango_layout_set_font_description( Layout, FontDesc ); 
    7077} 
     
    8794                                 int w, int h, int align, int color ) 
    8895{ 
    89     // Get handles 
    90     GdkDrawable *drawable = ( (GTK2Graphics *)dest )->GetImage(); 
    91     GdkGC *gc = ( (GTK2Graphics *)dest )->GetGC(); 
    92  
    9396    // Set text 
    94     pango_layout_set_text( Layout, text.c_str(), text.length() ); 
     97    pango_layout_set_text( Layout, text.c_str(), -1 ); 
    9598 
    9699    // Set size 
     100    pango_layout_set_width( Layout, -1 ); 
    97101    int real_w, real_h; 
    98     GetSize( text, real_w, real_h ); 
    99     if( real_w > w ) 
    100     { 
    101         // Change clipping region 
    102         Region *TextClipRgn = (Region *)new OSRegion( x, y, w, h ); 
    103         dest->SetClipRegion( TextClipRgn ); 
    104         delete TextClipRgn; 
    105102 
    106         w = real_w; 
    107         if( align == VLC_FONT_ALIGN_RIGHT ) 
    108             x += w - real_w; 
    109         else if( align == VLC_FONT_ALIGN_CENTER ) 
    110             x += ( w - real_w ) / 2; 
     103    // Create buffer image 
     104    Graphics* cov = (Graphics *)new OSGraphics( w, h ); 
     105    cov->CopyFrom( 0, 0, w, h, dest, x, y, SRC_COPY ); 
    111106 
    112         // Put old clip region 
    113         dest->ResetClipRegion(); 
    114     } 
    115     else 
    116     { 
    117         pango_layout_set_width( Layout, w * PANGO_SCALE ); 
    118     } 
     107    // Get handles 
     108    GdkDrawable *drawable = ( (GTK2Graphics *)cov )->GetImage(); 
     109    GdkGC *gc = ( (GTK2Graphics *)cov )->GetGC(); 
     110 
     111    // Set width of text 
     112    pango_layout_set_width( Layout, w * PANGO_SCALE ); 
    119113 
    120114    // Set attributes 
     
    122116    gdk_rgb_gc_set_foreground( gc, color ); 
    123117 
    124     // Render text 
    125     gdk_draw_layout( drawable, gc, x, y, Layout ); 
     118    // Render text on buffer 
     119    gdk_draw_layout( drawable, gc, 0, 0, Layout ); 
     120 
     121    // Copy buffer on dest graphics 
     122    dest->CopyFrom( x, y, w, h, cov, 0, 0, SRC_COPY ); 
     123 
     124    // Free memory 
     125    delete (OSGraphics *)cov; 
    126126} 
    127127 
  • modules/gui/skins/gtk2/gtk2_graphics.cpp

    r5ee0310 r20b8106  
    33 ***************************************************************************** 
    44 * Copyright (C) 2003 VideoLAN 
    5  * $Id: gtk2_graphics.cpp,v 1.13 2003/04/19 02:34:47 karibu Exp $ 
     5 * $Id: gtk2_graphics.cpp,v 1.14 2003/04/19 12:39:14 karibu Exp $ 
    66 * 
    77 * Authors: Cyril Deguet     <asmax@videolan.org> 
     
    5151    else 
    5252    { 
    53         Image = (GdkDrawable*) gdk_pixmap_new( NULL, w, h, 8 ); 
     53        // FIXME: 8 -> screen depth 
     54        Image = (GdkDrawable*) gdk_pixmap_new( NULL, w, h, 16 ); 
    5455        gdk_drawable_set_colormap( Image, gdk_colormap_get_system() ); 
    5556        Gc = gdk_gc_new( Image ); 
     
    7576void GTK2Graphics::DrawRect( int x, int y, int w, int h, int color ) 
    7677{ 
     78    gdk_rgb_gc_set_foreground( Gc, color ); 
    7779    gdk_draw_rectangle( Image, Gc, TRUE, x, y, w, h); 
    7880}