From e7b8e7ab2944ce435c867e9bafa94e4f7df5a3d5 Mon Sep 17 00:00:00 2001 From: Konstantin Isakov Date: Mon, 27 Apr 2009 22:48:31 +0000 Subject: [PATCH] *! Add support for hidden transcriptions (fixes rendering problems with Babylon English-Hebrew dictionary). --- src/bgl_babylon.cc | 18 ++++++++++++++++++ src/bgl_babylon.hh | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/bgl_babylon.cc b/src/bgl_babylon.cc index 7a031bf5..7adc7d41 100644 --- a/src/bgl_babylon.cc +++ b/src/bgl_babylon.cc @@ -421,6 +421,24 @@ bgl_entry Babylon::readEntry( ResourceHandler * resourceHandler ) pos += length + 4; a += length + 3; } + else if ( (unsigned char)block.data[pos] >= 0x40 && + len - a >= 2 && + (unsigned char)block.data[pos + 1 ] == 0x1B ) + { + // Hidden transcription (a transcription which is usually the same + // as the headword and shouldn't probably be visible). + unsigned length = (unsigned char)block.data[ pos ] - 0x3F; + + if ( length > len - a - 2 ) + { + fprintf( stderr, "Hidden transcription is too large %s\n", headword.c_str() ); + pos += len - a; + break; + } + + pos += length + 2; + a += length + 1; + } else if ( (unsigned char)block.data[pos] == 0x1E ) { // Resource reference begin marker diff --git a/src/bgl_babylon.hh b/src/bgl_babylon.hh index 6628c5b0..692bd700 100644 --- a/src/bgl_babylon.hh +++ b/src/bgl_babylon.hh @@ -190,7 +190,7 @@ public: enum { - ParserVersion = 3 + ParserVersion = 4 }; private: