if( !translate )
translate = new TitleTranslate(this, cpus);
- if( text_x+mask_w > 0 && text_x < title_w ) {
+ int tx = text_x - text_x1 + mask_x1;
+ if( tx < title_w && tx+mask_w > 0 ) {
translate->xlat_mask = text_mask;
translate->run_packages();
if( config.stroke_width >= SMALL && (config.style & BC_FONT_OUTLINE) ) {
output.tag.set_property("LOOP_PLAYBACK", config.loop_playback);
output.append_tag();
output.append_newline();
- char text[BCTEXTLEN];
+ char text[2*sizeof(config.wtext)];
int text_len = BC_Resources::encode(
BC_Resources::wide_encoding, DEFAULT_ENCODING,
(char*)config.wtext, config.wlen*sizeof(wchar_t),
text, sizeof(text));
+ int len = output.length(), avail = MESSAGESIZE-16 - len;
+ if( text_len >= avail ) { // back off last utf8 char
+ text_len = avail;
+ while( text_len > 0 && (text[text_len-1] & 0xc0) == 0x80 )
+ text[--text_len] = 0;
+ if( text_len > 0 )
+ text[--text_len] = 0;
+ }
output.append_text(text, text_len);
output.tag.set_title("/TITLE");
output.append_tag();