libass: 0.16

This commit is contained in:
Owen Rafferty 2022-05-12 10:51:32 -05:00
parent d3075f70d1
commit ce0d101b7d
No known key found for this signature in database
GPG Key ID: A68B10E2554DEBCB
3 changed files with 91 additions and 46 deletions

View File

@ -1,2 +1,2 @@
1be2df9c4485a57d78bb18c0a8ed157bc87a5a8dd48c661961c625cb112832fd
aefcf764a0564d1f866b973d11992342c224d726687b8f410cb89275164f94d8
5dbde9e22339119cf8eed59eea6c623a0746ef5a90b689e68a090109078e3c08
0474ad3149b886d2b1d6fc7598b94b3491b2c13d7160c7eb332fb4decc7e036f

View File

@ -1,8 +1,8 @@
diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c
index c4a157f..771c857 100644
index 6cb2ebf..7197e53 100644
--- a/libass/ass_shaper.c
+++ b/libass/ass_shaper.c
@@ -81,8 +81,7 @@ struct ass_shaper_font_data {
@@ -90,8 +90,7 @@ struct ass_shaper_font_data {
*/
void ass_shaper_info(ASS_Library *lib)
{
@ -12,9 +12,9 @@ index c4a157f..771c857 100644
" HarfBuzz-ng %s (COMPLEX)", hb_version_string()
);
}
@@ -686,8 +685,7 @@ static bool shape_harfbuzz(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len)
hb_buffer_add_utf32(buf, shaper->event_text + offset, i - offset + 1,
0, i - offset + 1);
@@ -730,8 +729,7 @@ static bool shape_harfbuzz(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len)
lead_context, i - offset + 1);
}
- props.direction = FRIBIDI_LEVEL_IS_RTL(level) ?
- HB_DIRECTION_RTL : HB_DIRECTION_LTR;
@ -22,10 +22,15 @@ index c4a157f..771c857 100644
props.script = glyphs[offset].script;
props.language = hb_shaper_get_run_language(shaper, props.script);
hb_buffer_set_segment_properties(buf, &props);
@@ -759,27 +757,6 @@ void ass_shaper_determine_script(ASS_Shaper *shaper, GlyphInfo *glyphs,
* Arabic shaping.
* \param len number of clusters
*/
@@ -799,35 +797,6 @@ void ass_shaper_determine_script(ASS_Shaper *shaper, GlyphInfo *glyphs,
}
}
-/**
- * \brief Shape event text with FriBidi. Does mirroring and simple
- * Arabic shaping.
- * \param len number of clusters
- */
-static void shape_fribidi(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len)
-{
- int i;
@ -42,43 +47,72 @@ index c4a157f..771c857 100644
- GlyphInfo *info = glyphs + i;
- FT_Face face = info->font->faces[info->face_index];
- info->symbol = shaper->event_text[i];
- info->glyph_index = FT_Get_Char_Index(face, ass_font_index_magic(face, shaper->event_text[i]));
- info->glyph_index = ass_font_index_magic(face, shaper->event_text[i]);
- if (info->glyph_index)
- info->glyph_index = FT_Get_Char_Index(face, info->glyph_index);
- }
-
- free(joins);
-}
-
/**
* \brief Toggle kerning for HarfBuzz shaping.
@@ -911,51 +888,18 @@ void ass_shaper_set_bidi_brackets(ASS_Shaper *shaper, bool match_brackets)
* \param shaper shaper instance
@@ -920,7 +889,7 @@ void ass_shaper_set_base_direction(ASS_Shaper *shaper, FriBidiParType dir)
shaper->base_direction = dir;
if (shaper->whole_text_layout != WHOLE_TEXT_LAYOUT_EXPLICIT)
- shaper->whole_text_layout = dir == FRIBIDI_PAR_ON ?
+ shaper->whole_text_layout = dir == 0 ?
WHOLE_TEXT_LAYOUT_IMPLICIT : WHOLE_TEXT_LAYOUT_OFF;
}
@@ -960,7 +929,7 @@ void ass_shaper_set_whole_text_layout(ASS_Shaper *shaper, bool enable)
{
shaper->whole_text_layout = enable ?
WHOLE_TEXT_LAYOUT_EXPLICIT :
- shaper->base_direction == FRIBIDI_PAR_ON ?
+ shaper->base_direction == 0 ?
WHOLE_TEXT_LAYOUT_IMPLICIT : WHOLE_TEXT_LAYOUT_OFF;
}
@@ -971,8 +940,7 @@ void ass_shaper_set_whole_text_layout(ASS_Shaper *shaper, bool enable)
*/
bool ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info)
{
- int i, ret, last_break;
- FriBidiParType dir;
- FriBidiParType dir, *pdir;
+ int i;
GlyphInfo *glyphs = text_info->glyphs;
if (!check_allocations(shaper, text_info->length))
return false;
// Get bidi character types and embedding levels
- last_break = 0;
for (i = 0; i < text_info->length; i++) {
int n_pars = 1;
@@ -986,52 +954,7 @@ bool ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info)
for (i = 0; i < text_info->length; i++)
shaper->event_text[i] = glyphs[i].symbol;
- fribidi_get_bidi_types(shaper->event_text,
- text_info->length, shaper->ctypes);
-
-#ifdef USE_FRIBIDI_EX_API
- if (shaper->bidi_brackets) {
- fribidi_get_bracket_types(shaper->event_text,
- text_info->length, shaper->ctypes, shaper->btypes);
- }
-#endif
-
- // Get bidi embedding levels
- last_break = 0;
- pdir = shaper->pbase_dir;
- for (i = 0; i < text_info->length; i++) {
- // embedding levels should be calculated paragraph by paragraph
- if (glyphs[i].symbol == '\n' || i == text_info->length - 1) {
- if (glyphs[i].symbol == '\n' || i == text_info->length - 1 ||
- (!shaper->whole_text_layout &&
- (glyphs[i + 1].starts_new_run || glyphs[i].hspacing))) {
- dir = shaper->base_direction;
- fribidi_get_bidi_types(shaper->event_text + last_break,
- i - last_break + 1, shaper->ctypes + last_break);
-#ifdef USE_FRIBIDI_EX_API
- FriBidiBracketType *btypes = NULL;
- if (shaper->bidi_brackets) {
- if (shaper->bidi_brackets)
- btypes = shaper->btypes + last_break;
- fribidi_get_bracket_types(shaper->event_text + last_break,
- i - last_break + 1, shaper->ctypes + last_break,
- btypes);
- }
- ret = fribidi_get_par_embedding_levels_ex(
- shaper->ctypes + last_break, btypes,
- i - last_break + 1, &dir, shaper->emblevels + last_break);
@ -89,9 +123,11 @@ index c4a157f..771c857 100644
- if (ret == 0)
- return false;
- last_break = i + 1;
- if (shaper->whole_text_layout)
- *pdir++ = dir;
- }
}
- }
-
- switch (shaper->shaping_level) {
- case ASS_SHAPING_SIMPLE:
- shape_fribidi(shaper, glyphs, text_info->length);
@ -104,7 +140,7 @@ index c4a157f..771c857 100644
}
/**
@@ -967,7 +911,7 @@ ASS_Shaper *ass_shaper_new(void)
@@ -1043,7 +966,7 @@ ASS_Shaper *ass_shaper_new(void)
if (!shaper)
return NULL;
@ -113,7 +149,7 @@ index c4a157f..771c857 100644
if (!init_features(shaper))
goto error;
@@ -1010,25 +954,12 @@ void ass_shaper_cleanup(ASS_Shaper *shaper, TextInfo *text_info)
@@ -1086,34 +1009,12 @@ void ass_shaper_cleanup(ASS_Shaper *shaper, TextInfo *text_info)
*/
FriBidiStrIndex *ass_shaper_reorder(ASS_Shaper *shaper, TextInfo *text_info)
{
@ -124,23 +160,32 @@ index c4a157f..771c857 100644
for (i = 0; i < text_info->length; i++)
shaper->cmap[i] = i;
- // Create reorder map line-by-line
- for (i = 0; i < text_info->n_lines; i++) {
- LineInfo *line = text_info->lines + i;
- FriBidiParType dir = FRIBIDI_PAR_ON;
-
- // Create reorder map line-by-line or run-by-run
- int last_break = 0;
- FriBidiParType *pdir = shaper->whole_text_layout ?
- shaper->pbase_dir : &shaper->base_direction;
- GlyphInfo *glyphs = text_info->glyphs;
- for (i = 0; i < text_info->length; i++) {
- if (i == text_info->length - 1 || glyphs[i + 1].linebreak ||
- (!shaper->whole_text_layout &&
- (glyphs[i + 1].starts_new_run || glyphs[i].hspacing))) {
- ret = fribidi_reorder_line(0,
- shaper->ctypes + line->offset, line->len, 0, dir,
- shaper->emblevels + line->offset, NULL,
- shaper->cmap + line->offset);
- shaper->ctypes, i - last_break + 1, last_break, *pdir,
- shaper->emblevels, NULL,
- shaper->cmap);
- if (ret == 0)
- return NULL;
-
- last_break = i + 1;
- if (shaper->whole_text_layout)
- pdir++;
- }
- }
-
return shaper->cmap;
}
@@ -1046,10 +977,5 @@ FriBidiStrIndex *ass_shaper_get_reorder_map(ASS_Shaper *shaper)
@@ -1131,10 +1032,5 @@ FriBidiStrIndex *ass_shaper_get_reorder_map(ASS_Shaper *shaper)
*/
FriBidiParType resolve_base_direction(int enc)
{
@ -153,7 +198,7 @@ index c4a157f..771c857 100644
+ return 0;
}
diff --git a/libass/ass_shaper.h b/libass/ass_shaper.h
index 70bec9a..c0ff055 100644
index 66bfed0..5f31db8 100644
--- a/libass/ass_shaper.h
+++ b/libass/ass_shaper.h
@@ -21,13 +21,14 @@

View File

@ -1 +1 @@
0.15.2 1
0.16.0 1