summaryrefslogtreecommitdiffstats
path: root/libass/ass_render.c
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@blackbox>2011-07-14 00:01:11 +0200
committerGrigori Goronzy <greg@blackbox>2011-07-15 14:59:07 +0200
commitb1f12a86374015305347ce83cad96f2eb35b0212 (patch)
treeeff4f4cd842ea291a887e41ec59af82f59c0859c /libass/ass_render.c
parent93c1573cca573024a93db82a712d724a79e8a6e6 (diff)
downloadlibass-b1f12a86374015305347ce83cad96f2eb35b0212.tar.bz2
libass-b1f12a86374015305347ce83cad96f2eb35b0212.tar.xz
Use the "font encoding" property as a base direction hint
ASS specifies a "font encoding", both in the styles as well as with the \fe override tag. This font encoding is very Windows-specific and libass doesn't use it for charmap matching or anything like that. However, it can be useful for hinting the base direction of text. Make Hebrew and Arabic encodings switch to RTL base direction, other languages to LTR and use neutral base direction for the autodetect setting.
Diffstat (limited to 'libass/ass_render.c')
-rw-r--r--libass/ass_render.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index 68d747d..3d23e29 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -898,6 +898,7 @@ void reset_render_context(ASS_Renderer *render_priv)
render_priv->state.frz = M_PI * render_priv->state.style->Angle / 180.;
render_priv->state.fax = render_priv->state.fay = 0.;
render_priv->state.wrap_style = render_priv->track->WrapStyle;
+ render_priv->state.font_encoding = render_priv->state.style->Encoding;
}
/**
@@ -1835,6 +1836,8 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
}
// Find shape runs and shape text
+ ass_shaper_set_base_direction(render_priv->shaper,
+ resolve_base_direction(render_priv->state.font_encoding));
ass_shaper_find_runs(render_priv->shaper, render_priv, glyphs,
text_info->length);
ass_shaper_shape(render_priv->shaper, text_info);