From 076de1c617c9c8aec6da2af732a0e29e58a1f315 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sun, 8 Dec 2013 16:16:24 +0000 Subject: [PATCH] Improved window printing by using a vectorial font for the window title. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10023 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 1853459f6..c14f604db 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3445,18 +3445,26 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset) int bx, by, bt, bpp; get_window_frame_sizes(bx, by, bt); Fl_Display_Device::display_device()->set_current(); // send win to front and make it current + const char *title = win->label(); + win->label(""); // temporarily set a void window title win->show(); fl_gc = NULL; Fl::check(); win->make_current(); - // capture the window title bar + // capture the window title bar with no title unsigned char *bitmap = Fl_X::bitmap_from_window_rect(win, 0, -bt, win->w(), bt, &bpp); + win->label(title); // put back the window title // and print it this->set_current(); // back to the Fl_Paged_Device Fl_RGB_Image *rgb = new Fl_RGB_Image(bitmap, win->w(), bt, bpp); rgb->draw(x_offset, y_offset); delete rgb; delete[] bitmap; + if (title) { // print the window title + fl_font(FL_HELVETICA, 14); + fl_color(FL_BLACK); + fl_draw(title, x_offset+win->w()/2-fl_width(title)/2, y_offset+bt/2+4); + } this->print_widget(win, x_offset, y_offset + bt); // print the window inner part }