- /* Make an empty bitmap as wide as target and at
- least tall enough for this subtitle.
- */
-
- int largest = 0;
- BOOST_FOREACH (dcp::SubtitleString const & i, subtitles) {
- largest = max (largest, i.size());
- }
- /* Basic guess on height... */
- int height = largest * target.height / (11 * 72);
- /* ...scaled... */
- height *= yscale;
- /* ...and add a bit more for luck */
- height += target.height / 11;
-
- shared_ptr<Image> image = create_image (target.width, height);
- Cairo::RefPtr<Cairo::Surface> surface = create_surface (image);
- Cairo::RefPtr<Cairo::Context> context = Cairo::Context::create (surface);
- string const font_name = setup_font (first, fonts);
- Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (context);
-
- layout->set_alignment (Pango::ALIGN_LEFT);
+ float const border_width = dcp::BORDER ? (first.outline_width * target.width / 2048.0) : 0;
+ size.width += 2 * ceil (border_width);
+ size.height += 2 * ceil (border_width);