diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2009-10-04 20:20:24 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2009-10-04 20:20:24 (GMT) |
commit | 1042ef3a191bd0f399f1a2a20fe259c14fe6faf9 (patch) | |
tree | 36e6fdf77248708eaee0f1180b2ea526d1323c18 /src/latexgen.cpp | |
parent | ab2543160a96dae45f256daaeca7e093f65db6ad (diff) | |
download | Doxygen-1042ef3a191bd0f399f1a2a20fe259c14fe6faf9.zip Doxygen-1042ef3a191bd0f399f1a2a20fe259c14fe6faf9.tar.gz Doxygen-1042ef3a191bd0f399f1a2a20fe259c14fe6faf9.tar.bz2 |
Release-1.6.1-20091004
Diffstat (limited to 'src/latexgen.cpp')
-rw-r--r-- | src/latexgen.cpp | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 794ef9f..f3f9438 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -1580,38 +1580,18 @@ void LatexGenerator::docify(const char *str) void LatexGenerator::codify(const char *str) { - static bool isJapanese = theTranslator->idLanguage()=="japanese" || - theTranslator->idLanguage()=="japanese-en"; - if (str) { const char *p=str; char c; - char cs[2]; - cs[1]='\0'; + char cs[5]; int spacesToNextTabStop; static int tabSize = Config_getInt("TAB_SIZE"); while (*p) { - static bool MultiByte = FALSE; + //static bool MultiByte = FALSE; c=*p++; - if( isJapanese ) - { - if ( MultiByte ) - { - t << (char)c; - MultiByte = FALSE; - continue; - } - if ((uchar)c>=0x80) // char in range [0x80..0xff] - { - t << (char)c; - MultiByte = TRUE; - continue; - } - } - switch(c) { case 0x0c: break; // remove ^L @@ -1621,14 +1601,34 @@ void LatexGenerator::codify(const char *str) col+=spacesToNextTabStop; break; case '\n': t << '\n'; col=0; break; - default: if (m_prettyCode) + default: cs[0]=c; + cs[1]=0; + int bytes=1; + if (c<0) // multibyte utf-8 character + { + bytes++; // 1xxx.xxxx: >=2 byte character + cs[1]=*p; + cs[2]=0; + if (((uchar)c&0xE0)==0xE0) + { + bytes++; // 111x.xxxx: >=3 byte character + cs[2]=*(p+1); + cs[3]=0; + } + if (((uchar)c&0xF0)==0xF0) + { + bytes++; // 1111.xxxx: 4 byte character + cs[2]=*(p+2); + cs[4]=0; + } + } + if (m_prettyCode) { - cs[0]=c; filterLatexString(t,cs,insideTabbing,TRUE); } else { - t << c; + t << cs; } if (col>=80) { @@ -1637,8 +1637,9 @@ void LatexGenerator::codify(const char *str) } else { - col++; + col++; } + p+=(bytes-1); // skip to next character break; } } |