GNOME Bugzilla – Bug 541360
Pango miscalculates width of italic text
Last modified: 2008-07-03 14:00:49 UTC
Please describe the problem: In the following example (Ada code, but that should translate easily to C), there are two labels, aligned to the right. On is normal font ("sans"), and gets fully displays. The second one ("sans italic") is missing a few pixels on the right, and the "0" is partially cut off. There doesn't seem to be a way to attach an image to a bug report, unfortunately. It has also been a long time since I last used the C version of gtk+, so I am submitting my (short) code in Ada. It shouldn't take long to translate, I assume. Sorry for the extra trouble. Steps to reproduce: 1. Translate (if needed) the following code and compile it 2. Launch the application and observe 3. Actual results: Expected results: Does this happen every time? Yes Other information: Code follows: with Gtk.Window; use Gtk.Window; with Gtk.Box; use Gtk.Box; with Gtk.Enums; use Gtk.Enums; with Gtk.Main; use Gtk.Main; with Gtk.Label; use Gtk.Label; with Gtk.Widget; use Gtk.Widget; with Pango.Font; use Pango.Font; procedure Main is Win : Gtk_Window; Box : Gtk_Box; Label : Gtk_Label; Font : Pango_Font_Description; begin Gtk.Main.Init; Gtk_New (Win, Window_Toplevel); Gtk_New_Vbox (Box); Add (Win, Box); Gtk_New (Label, "Italic font 0"); Font := From_String ("sans italic"); Modify_Font (Label, Font); Set_Alignment (Label, 1.0, 0.5); Set_Padding (Label, 2, 0); Set_Justify (Label, Justify_Right); Pack_Start (Box, Label); Gtk_New (Label, "Normal font 0"); Font := From_String ("sans"); Modify_Font (Label, Font); Set_Alignment (Label, 1.0, 0.5); Set_Justify (Label, Justify_Right); Pack_Start (Box, Label); Show_All (Win); Gtk.Main.Main; end Main;
Created attachment 113898 [details] View of the problem
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of 383558 ***