]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/pango_x.cpp
Don't call base class version unnecessarily in wxLogWindow::DoLogTextAtLevel().
[wxWidgets.git] / src / x11 / pango_x.cpp
index e3e12e3dec2937f00d08ac018aef71b902b4b77e..8836e142c175c043ccd5128d64f084346c946338 100644 (file)
@@ -1,7 +1,8 @@
 /**
- * This file gets included from dcclient.cpp and implements 
- * the X11 interface to Pango. 
+ * This file gets included from dcclient.cpp and implements
+ * the X11 interface to Pango.
  * Copyright (C) Owen Taylor and Robert Roebling.
+ * Licence: The wxWindows licence
  */
 
 /* Declaration */
@@ -14,31 +15,31 @@ x11_draw_glyphs( Drawable       drawable,
                         int            y,
                         PangoGlyphString *glyphs,
                  wxColour       &colour );
-                 
-void 
+
+void
 x11_draw_layout_line_with_colors( Drawable         drawable,
                                   GC               gc,
-                                  int              x, 
+                                  int              x,
                                   int              y,
                                   PangoLayoutLine  *line,
                                   wxColour       &colour );
-                                  
-void 
+
+void
 x11_draw_layout_with_colors( Drawable      drawable,
                              GC            gc,
-                             int           x, 
+                             int           x,
                              int           y,
                              PangoLayout  *layout,
                              wxColour     &colour );
-                             
-void 
+
+void
 x11_draw_layout( Drawable     drawable,
                  GC           gc,
-                 int          x, 
+                 int          x,
                  int          y,
                  PangoLayout *layout,
                  wxColour    &colour);
-                 
+
 void
 x11_pango_get_item_properties( PangoItem      *item,
                                PangoUnderline *uline,
@@ -63,6 +64,7 @@ x11_draw_glyphs( Drawable            drawable,
                         PangoGlyphString   *glyphs,
                  wxColour           &colour )
 {
+#ifdef HAVE_PANGO_XFT
     if (PANGO_XFT_IS_FONT (font))
     {
         Display* xdisplay = wxGlobalDisplay();
@@ -79,19 +81,20 @@ x11_draw_glyphs( Drawable            drawable,
         color.color.blue = colour.Blue() << 8;
         color.color.alpha = 65000;
         pango_xft_render( draw, &color, font, glyphs, x, y );
-        
+
         XftDrawDestroy( draw );
     }
     else
+#endif
     {
         pango_x_render( wxGlobalDisplay(), drawable, gc, font, glyphs, x, y );
     }
 }
 
-void 
+void
 x11_draw_layout_line_with_colors( Drawable         drawable,
                                   GC               gc,
-                                  int              x, 
+                                  int              x,
                                   int              y,
                                   PangoLayoutLine *line,
                                   wxColour        &colour )
@@ -104,9 +107,9 @@ x11_draw_layout_line_with_colors( Drawable         drawable,
     gint rise = 0;
 
     context = pango_layout_get_context (line->layout);
-  
+
     pango_layout_line_get_extents (line,NULL, &overall_rect);
-  
+
     GSList *tmp_list = line->runs;
     while (tmp_list)
     {
@@ -115,16 +118,16 @@ x11_draw_layout_line_with_colors( Drawable         drawable,
         PangoColor fg_color, bg_color;
         gboolean strike, fg_set, bg_set, shape_set;
         gint risen_y;
-      
+
         tmp_list = tmp_list->next;
-      
-        x11_pango_get_item_properties (run->item, &uline, 
-            &strike, &rise,  &fg_color, &fg_set, &bg_color, &bg_set, 
+
+        x11_pango_get_item_properties (run->item, &uline,
+            &strike, &rise,  &fg_color, &fg_set, &bg_color, &bg_set,
             &shape_set, &ink_rect, &logical_rect);
 
         /* we subtract the rise because X coordinates are upside down */
         risen_y = y - rise / PANGO_SCALE;
-      
+
         if (!shape_set)
         {
             if (uline == PANGO_UNDERLINE_NONE)
@@ -145,12 +148,12 @@ x11_draw_layout_line_with_colors( Drawable         drawable,
         {
             int gx = x + x_off / PANGO_SCALE;
             int gy = risen_y;
-          
+
             x11_draw_glyphs( drawable, gc, run->item->analysis.font, gx, gy, run->glyphs, colour );
         }
-      
+
         if (uline ==  PANGO_UNDERLINE_SINGLE)
-        {  
+        {
             XDrawLine( wxGlobalDisplay(), drawable, gc,
                          x + (x_off + ink_rect.x) / PANGO_SCALE - 1,
                           risen_y + 1,
@@ -162,40 +165,40 @@ x11_draw_layout_line_with_colors( Drawable         drawable,
     }
 }
 
-void 
+void
 x11_draw_layout_with_colors( Drawable      drawable,
                              GC            gc,
-                             int           x, 
+                             int           x,
                              int           y,
                              PangoLayout  *layout,
                              wxColour       &colour )
 {
     PangoLayoutIter *iter = pango_layout_get_iter (layout);
-  
+
     do
     {
         PangoLayoutLine *line = pango_layout_iter_get_line (iter);
-      
+
         PangoRectangle logical_rect;
         pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
-        
+
         int baseline = pango_layout_iter_get_baseline (iter);
-      
+
         x11_draw_layout_line_with_colors( drawable, gc,
                                           x + logical_rect.x / PANGO_SCALE,
                                           y + baseline / PANGO_SCALE,
                                           line,
                                           colour );
-                                          
+
     } while (pango_layout_iter_next_line (iter));
 
     pango_layout_iter_free (iter);
 }
 
-void 
+void
 x11_draw_layout( Drawable     drawable,
                  GC           gc,
-                 int          x, 
+                 int          x,
                  int          y,
                  PangoLayout *layout,
                  wxColour    &colour)
@@ -222,10 +225,10 @@ x11_pango_get_item_properties( PangoItem      *item,
 
   if (strikethrough)
       *strikethrough = FALSE;
-  
+
   if (fg_set)
     *fg_set = FALSE;
-  
+
   if (bg_set)
     *bg_set = FALSE;
 
@@ -250,21 +253,21 @@ x11_pango_get_item_properties( PangoItem      *item,
            if (strikethrough)
                *strikethrough = ((PangoAttrInt *)attr)->value;
            break;
-           
+       
        case PANGO_ATTR_FOREGROUND:
          if (fg_color)
            *fg_color = ((PangoAttrColor *)attr)->color;
          if (fg_set)
            *fg_set = TRUE;
-         
+       
          break;
-         
+       
        case PANGO_ATTR_BACKGROUND:
          if (bg_color)
            *bg_color = ((PangoAttrColor *)attr)->color;
          if (bg_set)
            *bg_set = TRUE;
-         
+       
          break;
 
        case PANGO_ATTR_SHAPE:
@@ -280,7 +283,7 @@ x11_pango_get_item_properties( PangoItem      *item,
           if (rise)
             *rise = ((PangoAttrInt *)attr)->value;
           break;
-          
+
        default:
          break;
        }