summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@blackbox>2011-07-10 02:25:24 +0200
committerGrigori Goronzy <greg@blackbox>2011-07-10 02:25:24 +0200
commite1b63bc3abfac4d1e994cbe46a4d3f820062b880 (patch)
tree7033e350fda80f46ff6b290eefe4383ea79af654
parent131b23f717d0d775d4730d1d8ffd5195344f71a8 (diff)
downloadlibass-e1b63bc3abfac4d1e994cbe46a4d3f820062b880.tar.bz2
libass-e1b63bc3abfac4d1e994cbe46a4d3f820062b880.tar.xz
Hook up FriBidi's simple Arabic shaper
Use FriBidi's shaper not only for mirroring, but also for simplified Arabic shaping.
-rw-r--r--libass/ass_shaper.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c
index 5631be2..6efc177 100644
--- a/libass/ass_shaper.c
+++ b/libass/ass_shaper.c
@@ -42,6 +42,7 @@ void ass_shaper_shape(TextInfo *text_info, FriBidiCharType *ctypes,
int i, last_break;
FriBidiParType dir;
FriBidiChar *event_text = calloc(sizeof(*event_text), text_info->length);
+ FriBidiJoiningType *joins = calloc(sizeof(*joins), text_info->length);
GlyphInfo *glyphs = text_info->glyphs;
// Get bidi character types and embedding levels
@@ -68,25 +69,27 @@ void ass_shaper_shape(TextInfo *text_info, FriBidiCharType *ctypes,
printf("\n");
#endif
- // Call FriBidi's glyph mirroring shaper.
- // This shaper implements rule L4 of the bidi algorithm
- fribidi_shape_mirroring(emblevels, text_info->length, event_text);
- for (i = 0; i < text_info->length; i++) {
- glyphs[i].symbol = event_text[i];
- }
+ // Use FriBidi's shaper for mirroring and simple Arabic shaping
+ fribidi_get_joining_types(event_text, text_info->length, joins);
+ fribidi_join_arabic(ctypes, text_info->length, emblevels, joins);
+ fribidi_shape(FRIBIDI_FLAGS_DEFAULT | FRIBIDI_FLAGS_ARABIC, emblevels,
+ text_info->length, joins, event_text);
// XXX: insert HarfBuzz shaper here
- // Skip direction override characters
- // NOTE: Behdad said HarfBuzz is supposed to remove these, but this hasn't
- // been implemented yet
+ // Update glyphs
for (i = 0; i < text_info->length; i++) {
+ glyphs[i].symbol = event_text[i];
+ // Skip direction override characters
+ // NOTE: Behdad said HarfBuzz is supposed to remove these, but this hasn't
+ // been implemented yet
if (glyphs[i].symbol <= 0x202F && glyphs[i].symbol >= 0x202a) {
glyphs[i].symbol = 0;
glyphs[i].skip++;
}
}
+ free(joins);
free(event_text);
}