void ass_set_frame_size(ass_renderer_t *priv, int w, int h);
void ass_set_margins(ass_renderer_t *priv, int t, int b, int l, int r);
void ass_set_use_margins(ass_renderer_t *priv, int use);
-void ass_set_aspect_ratio(ass_renderer_t *priv, double ar);
+void ass_set_aspect_ratio(ass_renderer_t *priv, double ar, double par);
void ass_set_font_scale(ass_renderer_t *priv, double font_scale);
void ass_set_hinting(ass_renderer_t *priv, ass_hinting_t ht);
void ass_set_line_spacing(ass_renderer_t *priv, double line_spacing);
int use_margins; // 0 - place all subtitles inside original frame
// 1 - use margins for placing toptitles and subtitles
double aspect; // frame aspect ratio, d_width / d_height.
+ double pixel_ratio; // pixel ratio of the source image
ass_hinting_t hinting;
char *default_font;
priv->settings.use_margins = use;
}
-void ass_set_aspect_ratio(ass_renderer_t *priv, double ar)
+void ass_set_aspect_ratio(ass_renderer_t *priv, double ar, double par)
{
- if (priv->settings.aspect != ar) {
+ if (priv->settings.aspect != ar || priv->settings.pixel_ratio != par) {
priv->settings.aspect = ar;
+ priv->settings.pixel_ratio = par;
ass_reconfigure(priv);
}
}
else
render_priv->border_scale = 1.;
- render_priv->font_scale_x = 1.;
+ // PAR correction
+ render_priv->font_scale_x = render_priv->settings.aspect /
+ render_priv->settings.pixel_ratio;
render_priv->prev_images_root = render_priv->images_root;
render_priv->images_root = 0;