<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Hello,<br></div><div><br></div><div>Why not using the same commit message as your 3.0 patches?<br></div><div><br></div><div>Otherwise, LGTM<br></div><div><br></div><div>On Mon, Mar 1, 2021, at 13:28, KO Myung-Hun wrote:<br></div><blockquote type="cite" id="qt" style=""><div>Updated.<br></div><div><br></div><div>KO Myung-Hun wrote:<br></div><div>> ---<br></div><div>> modules/text_renderer/freetype/freetype.c | 42 +++++++++++++++++++-<br></div><div>> modules/text_renderer/freetype/freetype.h | 3 +-<br></div><div>> modules/text_renderer/freetype/text_layout.c | 7 ----<br></div><div>> 3 files changed, 41 insertions(+), 11 deletions(-)<br></div><div>> <br></div><div>> diff --git a/modules/text_renderer/freetype/freetype.c b/modules/text_renderer/freetype/freetype.c<br></div><div>> index 3303e46000..15c62e05a7 100644<br></div><div>> --- a/modules/text_renderer/freetype/freetype.c<br></div><div>> +++ b/modules/text_renderer/freetype/freetype.c<br></div><div>> @@ -815,6 +815,44 @@ static void FreeStylesArray( text_style_t **pp_styles, size_t i_styles )<br></div><div>> free( pp_styles );<br></div><div>> }<br></div><div>> <br></div><div>> +#ifdef __OS2__<br></div><div>> +# define ToUCS4( in, outsize ) ToUCS4(( in ), ( outsize ))<br></div><div>> +<br></div><div>> +static void *( ToUCS4 )( const char *in, size_t *outsize )<br></div><div>> +{<br></div><div>> + uint16_t *psz_ucs2;<br></div><div>> + size_t i_ucs4_bytes;<br></div><div>> + uni_char_t *psz_ucs4;<br></div><div>> + int i_len;<br></div><div>> +<br></div><div>> + psz_ucs2 = ToCharset( FREETYPE_TO_UCS, in, outsize );<br></div><div>> + if( !psz_ucs2 )<br></div><div>> + return NULL;<br></div><div>> +<br></div><div>> + i_ucs4_bytes = *outsize * 2;<br></div><div>> + /* Realloc including NULL-terminator */<br></div><div>> + psz_ucs4 = realloc( psz_ucs2, i_ucs4_bytes + sizeof( *psz_ucs4 ));<br></div><div>> + if( unlikely( !psz_ucs4 ) )<br></div><div>> + {<br></div><div>> + free( psz_ucs2 );<br></div><div>> +<br></div><div>> + return NULL;<br></div><div>> + }<br></div><div>> +<br></div><div>> + psz_ucs2 = ( uint16_t * )psz_ucs4;<br></div><div>> + i_len = i_ucs4_bytes / sizeof( *psz_ucs4 );<br></div><div>> + /* Copy including NULL-terminator */<br></div><div>> + for( int i = i_len; i >= 0; --i )<br></div><div>> + psz_ucs4[ i ] = psz_ucs2[ i ];<br></div><div>> +<br></div><div>> + *outsize = i_ucs4_bytes;<br></div><div>> +<br></div><div>> + return psz_ucs4;<br></div><div>> +}<br></div><div>> +#else<br></div><div>> +# define ToUCS4( in, outsize ) ToCharset( FREETYPE_TO_UCS, ( in ), ( outsize ))<br></div><div>> +#endif<br></div><div>> +<br></div><div>> static size_t AddTextAndStyles( filter_sys_t *p_sys,<br></div><div>> const char *psz_text, const char *psz_rt,<br></div><div>> const text_style_t *p_style,<br></div><div>> @@ -822,7 +860,7 @@ static size_t AddTextAndStyles( filter_sys_t *p_sys,<br></div><div>> {<br></div><div>> /* Convert chars to unicode */<br></div><div>> size_t i_bytes;<br></div><div>> - uni_char_t *p_ucs4 = ToCharset( FREETYPE_TO_UCS, psz_text, &i_bytes );<br></div><div>> + uni_char_t *p_ucs4 = ToUCS4( psz_text, &i_bytes );<br></div><div>> if( !p_ucs4 )<br></div><div>> return 0;<br></div><div>> <br></div><div>> @@ -878,7 +916,7 @@ static size_t AddTextAndStyles( filter_sys_t *p_sys,<br></div><div>> ruby_block_t *p_rubyblock = NULL;<br></div><div>> if( psz_rt )<br></div><div>> {<br></div><div>> - p_ucs4 = ToCharset( FREETYPE_TO_UCS, psz_rt, &i_bytes );<br></div><div>> + p_ucs4 = ToUCS4( psz_rt, &i_bytes );<br></div><div>> if( !p_ucs4 )<br></div><div>> return 0;<br></div><div>> p_rubyblock = malloc(sizeof(ruby_block_t));<br></div><div>> diff --git a/modules/text_renderer/freetype/freetype.h b/modules/text_renderer/freetype/freetype.h<br></div><div>> index ee69304ab9..d41acabc21 100644<br></div><div>> --- a/modules/text_renderer/freetype/freetype.h<br></div><div>> +++ b/modules/text_renderer/freetype/freetype.h<br></div><div>> @@ -56,11 +56,10 @@<br></div><div>> # define FT_MulFix(v, s) (((v)*(s))>>16)<br></div><div>> #endif<br></div><div>> <br></div><div>> +typedef uint32_t uni_char_t;<br></div><div>> #ifdef __OS2__<br></div><div>> -typedef uint16_t uni_char_t;<br></div><div>> # define FREETYPE_TO_UCS "UCS-2LE"<br></div><div>> #else<br></div><div>> -typedef uint32_t uni_char_t;<br></div><div>> # if defined(WORDS_BIGENDIAN)<br></div><div>> # define FREETYPE_TO_UCS "UCS-4BE"<br></div><div>> # else<br></div><div>> diff --git a/modules/text_renderer/freetype/text_layout.c b/modules/text_renderer/freetype/text_layout.c<br></div><div>> index baee972832..fe60784da9 100644<br></div><div>> --- a/modules/text_renderer/freetype/text_layout.c<br></div><div>> +++ b/modules/text_renderer/freetype/text_layout.c<br></div><div>> @@ -760,17 +760,10 @@ static int ShapeParagraphHarfBuzz( filter_t *p_filter,<br></div><div>> <br></div><div>> hb_buffer_set_direction( p_run->p_buffer, p_run->direction );<br></div><div>> hb_buffer_set_script( p_run->p_buffer, p_run->script );<br></div><div>> -#ifdef __OS2__<br></div><div>> - hb_buffer_add_utf16( p_run->p_buffer,<br></div><div>> - p_paragraph->p_code_points + p_run->i_start_offset,<br></div><div>> - p_run->i_end_offset - p_run->i_start_offset, 0,<br></div><div>> - p_run->i_end_offset - p_run->i_start_offset );<br></div><div>> -#else<br></div><div>> hb_buffer_add_utf32( p_run->p_buffer,<br></div><div>> p_paragraph->p_code_points + p_run->i_start_offset,<br></div><div>> p_run->i_end_offset - p_run->i_start_offset, 0,<br></div><div>> p_run->i_end_offset - p_run->i_start_offset );<br></div><div>> -#endif<br></div><div>> hb_shape( p_hb_font, p_run->p_buffer, 0, 0 );<br></div><div>> <br></div><div>> hb_font_destroy( p_hb_font );<br></div><div><br></div><div>-- <br></div><div>KO Myung-Hun<br></div><div><br></div><div>Using Mozilla SeaMonkey 2.7.2<br></div><div>Under OS/2 Warp 4 for Korean with FixPak #15<br></div><div>In VirtualBox v6.1.10 on Intel Core i7-3615QM 2.30GHz with 8GB RAM<br></div><div><br></div><div>Korean OS/2 User Community : <a href="http://www.os2.kr/">http://www.os2.kr/</a><br></div><div><br></div><div><br></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div><div><br></div><div><b>Attachments:</b><br></div><ul><li>v2-0001-freetype-fix-subtitle-text-does-not-show-correctl.patch<br></li></ul></blockquote><div><br></div></body></html>