]> granicus.if.org Git - libass/commitdiff
Letter spacing is a per-cluster property
authorGrigori Goronzy <greg@blackbox>
Sun, 2 Oct 2011 22:41:53 +0000 (00:41 +0200)
committerGrigori Goronzy <greg@blackbox>
Sun, 2 Oct 2011 22:41:53 +0000 (00:41 +0200)
Layout refactoring broke letter spacing and always used the last valid
spacing specified for the whole line, which is of course wrong.
Letter-spacing is an inline property and can be different for each glyph
cluster. Add that property to GlyphInfo and use it to fix this
regression.

libass/ass_render.c
libass/ass_render.h

index b2bc1946e70033584fe8f1c299e85067ab3c0455..599989b4d6882c30fcd7fa3f734d58cd724bfe37 100644 (file)
@@ -1770,6 +1770,7 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
         glyphs[text_info->length].scale_y = render_priv->state.scale_y;
         glyphs[text_info->length].border_x= render_priv->state.border_x;
         glyphs[text_info->length].border_y = render_priv->state.border_y;
+        glyphs[text_info->length].hspacing = render_priv->state.hspacing;
         glyphs[text_info->length].bold = render_priv->state.bold;
         glyphs[text_info->length].italic = render_priv->state.italic;
         glyphs[text_info->length].flags = render_priv->state.flags;
@@ -1827,7 +1828,7 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
         }
 
         // add horizontal letter spacing
-        info->cluster_advance.x += double_to_d6(render_priv->state.hspacing *
+        info->cluster_advance.x += double_to_d6(info->hspacing *
                 render_priv->font_scale * info->scale_x);
 
         // add displacement for vertical shearing
index d3c1bbbfc35cbb7ce18e5dcb1e9d6a6c056745bc..c290c4d26dc795b4aa32a6719a1073959b730b9d 100644 (file)
@@ -134,6 +134,7 @@ typedef struct glyph_info {
     double fax, fay;            // text shearing
     double scale_x, scale_y;
     double border_x, border_y;
+    double hspacing;
     unsigned italic;
     unsigned bold;
     int flags;