- for (list<dcp::SubtitleString>::const_iterator i = subtitles.begin(); i != subtitles.end(); ++i) {
- string f = i->font ();
- if (f.empty ()) {
- f = "Arial";
- }
- Pango::FontDescription font (f);
- font.set_absolute_size (i->size_in_pixels (target.height) * PANGO_SCALE);
- if (i->italic ()) {
- font.set_style (Pango::STYLE_ITALIC);
- }
- layout->set_font_description (font);
- layout->set_text (i->text ());
-
- /* Compute fade factor */
- /* XXX */
- float fade_factor = 1;
-#if 0
- dcp::Time now (time * 1000 / (4 * TIME_HZ));
- dcp::Time end_fade_up = i->in() + i->fade_up_time ();
- dcp::Time start_fade_down = i->out() - i->fade_down_time ();
- if (now < end_fade_up) {
- fade_factor = (now - i->in()) / i->fade_up_time();
- } else if (now > start_fade_down) {
- fade_factor = 1.0 - ((now - start_fade_down) / i->fade_down_time ());
- }
-#endif
-
- layout->update_from_cairo_context (context);
-
- /* Work out position */
-
- int const x = 0;
- int const y = calculate_position (i->v_align (), i->v_position (), target.height, (layout->get_baseline() / PANGO_SCALE) + top.get ());
-
- if (i->effect() == dcp::SHADOW) {
- /* Drop-shadow effect */
- dcp::Color const ec = i->effect_color ();
- context->set_source_rgba (float(ec.r) / 255, float(ec.g) / 255, float(ec.b) / 255, fade_factor);
- context->move_to (x + 4, y + 4);
- layout->add_to_cairo_context (context);
- context->fill ();
- }