summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2014-01-08 01:28:49 +0200
committerOleg Oshmyan <chortos@inbox.lv>2014-01-08 03:24:36 +0200
commit50c53a1330e61d14808630b9d054b9aaaa9b0031 (patch)
tree3af6214aa9430ea3bd8c793cf7532e445f82ad1b
parenta37e3b3eb43f360693ee278bf2991f829b496b25 (diff)
downloadlibass-50c53a1330e61d14808630b9d054b9aaaa9b0031.tar.bz2
libass-50c53a1330e61d14808630b9d054b9aaaa9b0031.tar.xz
shaper: disable ligatures for non-zero \fsp
-rw-r--r--libass/ass_shaper.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c
index d5a970e..4d4104e 100644
--- a/libass/ass_shaper.c
+++ b/libass/ass_shaper.c
@@ -31,9 +31,11 @@
enum {
VERT = 0,
VKNA,
- KERN
+ KERN,
+ LIGA,
+ CLIG
};
-#define NUM_FEATURES 3
+#define NUM_FEATURES 5
#endif
struct ass_shaper {
@@ -145,6 +147,10 @@ static void init_features(ASS_Shaper *shaper)
shaper->features[VKNA].end = INT_MAX;
shaper->features[KERN].tag = HB_TAG('k', 'e', 'r', 'n');
shaper->features[KERN].end = INT_MAX;
+ shaper->features[LIGA].tag = HB_TAG('l', 'i', 'g', 'a');
+ shaper->features[LIGA].end = INT_MAX;
+ shaper->features[CLIG].tag = HB_TAG('c', 'l', 'i', 'g');
+ shaper->features[CLIG].end = INT_MAX;
}
/**
@@ -152,11 +158,17 @@ static void init_features(ASS_Shaper *shaper)
*/
static void set_run_features(ASS_Shaper *shaper, GlyphInfo *info)
{
- // enable vertical substitutions for @font runs
- if (info->font->desc.vertical)
- shaper->features[VERT].value = shaper->features[VKNA].value = 1;
- else
- shaper->features[VERT].value = shaper->features[VKNA].value = 0;
+ // enable vertical substitutions for @font runs
+ if (info->font->desc.vertical)
+ shaper->features[VERT].value = shaper->features[VKNA].value = 1;
+ else
+ shaper->features[VERT].value = shaper->features[VKNA].value = 0;
+
+ // disable ligatures if horizontal spacing is non-standard
+ if (info->hspacing)
+ shaper->features[LIGA].value = shaper->features[CLIG].value = 0;
+ else
+ shaper->features[LIGA].value = shaper->features[CLIG].value = 1;
}
/**
@@ -719,6 +731,7 @@ void ass_shaper_find_runs(ASS_Shaper *shaper, ASS_Renderer *render_priv,
last->font_size != info->font_size ||
last->scale_x != info->scale_x ||
last->scale_y != info->scale_y ||
+ last->hspacing != info->hspacing ||
last->face_index != info->face_index ||
last->script != info->script))
shape_run++;