[vlc-devel] [RFC PATCH] freetype: using Pango for text layout
Bernie Purcell
berniepurcell at gmail.com
Thu Jan 22 00:00:13 CET 2015
This looks suspiciously like an endian-conversion issue. I assume you're
running on a Little-Endian system, like most PCs. If this code was run
on Big-Endian it would possibly disrupt what was already in the format
pango wanted. This is an assumption only - I don't actually know what
pango really wants.
I know you probably don't have a system running Big-Endian lying around
the place to check on, so it's a bit hard to know for sure, but if I'm
right some code like this might be better as it should only have an
effect on the architecture that needs it.
eg.
#include <endian.h>
...
for (int i=0; i< i_len; i++)
{
psz_text[i] = htobe32(psz_text[i]);
}
bitmap
On 21/01/15 12:26, Salah-Eddin Shaban wrote:
> + /*
> + * Convert to UTF-8 for Pango. psz_text is not recognized as
> + * UCS-4 unless the byte order is reversed.
> + */
> + for( int i = 0; i < i_len; ++i )
> + {
> + guchar *p = ( guchar * ) psz_text + i * sizeof( *psz_text );
> + guchar ch0 = *( p ); guchar ch1 = *( p + 1 );
> + guchar ch2 = *( p + 2 ); guchar ch3 = *( p + 3 );
> +
> + *( p + 0 ) = ch3; *( p + 1 ) = ch2;
> + *( p + 2 ) = ch1; *( p + 3 ) = ch0;
> + }
More information about the vlc-devel
mailing list