Bug 4612

Summary: Text not being drawn if first character entirely out of surface
Product: cairo Reporter: tor
Component: win32 backendAssignee: Owen Taylor <otaylor>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: high CC: tml
Version: 1.0.0   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: metric.gmBlackBox[XY] are unsigned, leading to much fun during comparison

Description tor 2005-09-27 15:00:58 UTC
With the win32 backend, if a string is drawn using the toy font api
(cairo_show_text) with the first character entirely off the surface (ex: current
point negative x with an identity matrix), the entire string disappears.
Comment 1 tor 2005-09-27 15:28:56 UTC
Created attachment 3414 [details] [review]
metric.gmBlackBox[XY] are unsigned, leading to much fun during comparison
Comment 2 Carl Worth 2005-09-27 16:15:34 UTC
I've got no reason to mistrust this fix.

Commit away!
Comment 3 Carl Worth 2005-09-28 10:50:14 UTC
2005-09-28  T Rowley  <tim.rowley@gmail.com>

       * ROADMAP: Note that Bug #4612 (Text not being drawn if first
       character entirely out of surface) is now fixed.

       * src/cairo-win32-font.c (_cairo_win32_scaled_font_glyph_bbox):
       Add cast so that sign conversion doesn't alter comparison.
Comment 4 Tor Lillqvist 2005-10-15 16:13:29 UTC
Tim, did you mean that the bug occurs *only* when using the toy font API, or
that it occurs *even* when using the toy font API? Anyway, this bug bites also
in real GTK+/pango programs. In fact, the fix got rid of irritating display
glitches that could be reproduced even in a very trivial sample program. Thanks
very much for fixing this!

I got the below mail message with sample program. Luckily I didn't waste time
looking for other causes of the problem, but just checked whether cairo 1.0.2
would help... I had noticed the problem myself in Evolution, but thought that it
was caused by some much more complex scenario involving GtkPlug/Socket etc.

The message I got:

Below is a some code that produces a GTK Window, adds a GTK Label to it 
and shows both. The problem I'm having is that IF I drag a window on 
part of the Label, often, the text won't get redrawn correctly. This 
means I often get a Label that shows 'B' and nothing else. For some odd 
reason, the B always gets drawn no matter what. I would appreciate your 
take on this.

#include <gtk/gtk.h>

static void before_main_destroy(GtkWidget *widget, gpointer data);

int main(int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *label;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "This is a window !");
  gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
  g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK 
		    (before_main_destroy), NULL);

  label = gtk_label_new ("Brrr");
  gtk_container_add (GTK_CONTAINER (window), label);
  gtk_widget_show (label);

  gtk_widget_show(window);
  gdk_window_set_decorations (GDK_WINDOW(window->window), GDK_DECOR_TITLE |
GDK_DECOR_MENU);
 
  gtk_main ();
  
  return 0;
}

static void before_main_destroy(GtkWidget *widget, gpointer data)
{
  gtk_main_quit ();
}

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.