MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0022149Open CASCADE[OCCT] OCCT:Visualizationpublic2010-12-14 16:292019-05-06 22:55
Reporterszv 
Assigned Tobugmaster 
PrioritynormalSeveritytrivial 
StatusclosedResolutionfixed 
PlatformOSAllOS Version
Product Version 
Target Version[OCCT] 6.5.2Fixed in Version[OCCT] 6.5.2 
Summary0022149: Strings with Japanese characters can not be displayed in 3D viewer
DescriptionIt is impossible to display 2-byte character strings (ex. in Japanese language)
in OCCT 3D viewer. For example, a call to Prs3d_Text::Draw with such a string
does not result in correct displaying (because internally it always converted to
ASCII).
TagsNo tags attached.
Test case numberchl 936 Z8
Attached Fileszip file icon patch.zip (84,466 bytes) 2010-12-22 15:18
zip file icon patch_20110629.zip (86,779 bytes) 2011-06-29 14:19
? file icon mona.ttf (2,828,124 bytes) 2011-07-06 11:41
zip file icon patch_20110706.zip (175,730 bytes) 2011-07-06 12:14
gz file icon chl_936_Z8.tar.gz (331 bytes) 2011-07-22 15:13

- Relationships
related to 0030696verifiedbugmaster Draw Harness, testgrid - specify encoding in HTML header 

-  Notes
(0017870)
kgv (developer)
2011-08-01 13:08
edited on: 2011-08-01 13:11

According previous discussion about 'Unicode problem' entirely we suggest that Unicode support in OCCT should be provided in another way by meaning of dedicated Utf8 string class as main storage / exchange encoding and perform necessary translations in-place where necessary (encoding-dependent WinAPI calls for example).

So I should generally reject this patch because it is in the wrong direction
(looking for ABV suggestions).

Patch involves unnecessary complication:
- new type 'unsigned short Techar' on GL level;
- wchar_t is 4 bytes UTF32 on Linux and is 2 bytes UTF16 on Windows that cause additional complications and mess up (Standard_ExtCharacter / Standard_ExtString are defined as short integer, Techar suggested to be unsigned short);

=== OpenGl_FontMgr.cxx
void OpenGl_FontMgr::render_text( const Standard_Integer id, const wchar_t* text,
                                  const Standard_Boolean is2d )
{
#ifdef TRACE
  cout << "TKOpenGl::render_text\n"
    << "\tfont id = " << id << endl
    << "\ttext = " << text << endl;
#endif
===
will cause corrupted TRACE output.

=== OpenGl_subrs.cxx, line 1634:
printf( "\t\tANNOTATION TEXT RELATIVE 3 %S\n",
===
I have no idea how it will work under Linux...
Is it tested on both platforms within Unicode text (not just for compilation)?

=== OpenGl_TextRender.cxx, OpenGl_TextRender::ExportText, 483-486
  //szv: workaround for gl2ps!
  const int len = wcslen(text);
  char *astr = new char[len+1];
  wcstombs(astr,text,len);
===
1) Multibyte string will require more bytes for Unicode symbols. You should allocate at least twice greater buffer.
2) It seems that this wcstombs() function will convert to current locale char set, not necessary UTF-8 (especially on Windows).
3) Result not checked and broken buffer may be printed before lucky NULL-termination symbol will occur.

=== OpenGl_graduatedtrihedron.cxx, 80-83
    Standard_ExtString iname = fromData->xname.ToExtString();
    toData->xname = new wchar_t[len+1];
    len = 0; while (toData->xname[len] = (wchar_t)(iname[len])) len++;
===
incorrect multi-byte UTF16 -> UTF32 conversion in case when wchar_t is 4-bytes long UTF32 (Linux).

Notice that code revision is still in progress...

(0017874)
szv (manager)
2011-08-01 17:19

Kirill,

I disagree with your statement:
"So I should generally reject this patch because it is in the wrong direction
(looking for ABV suggestions)."

This patch brings new functionality that was designed long before our discussion with ABV concerning support of multi-byte characters. Moreover, that discussion remained just a discussion, nothing yet is implemented.

So, naturally, when the good concept will be implemented, we shall need to correct this patch, as well as many other places in OCCT. But for now, this patch cases no problems but, on contrary, allows to reach the goal it was designed for.
(0017876)
abv (manager)
2011-08-02 08:08

Kirill, we cannot just block this patch because we think of better solution, rather let's:
a) check that it is reasonably safe (as far as I understood, couple of code pieces require correction for that)
b) consider improvement of interface if necessary to facilitate future porting (here I believe having dedicated type Techar can be useful to find all relevant places)
c) make sure test scripts created by QA team are adequate (in my view, the test commands given above might be too simple, as they test single Unicode character -- let's better take 10000-symbol string to provoke overflows)
(0017880)
kgv (developer)
2011-08-03 10:11

Recommended remarks:

>> ViewerTest_ViewerCommands.cxx, 1752
>>Quantity_NOC_RED/*xcolor*/,Quantity_NOC_GREEN/*ycolor*/,Quantity_NOC_BLUE1/*zcolor*/,font);
>> ViewerTest_ViewerCommands.cxx, 1682
>> di<<"Error: "<<argv[0]<<" - invalid number of arguments\n";
Please try to follow punctuation rules from English and do not compress listings without any space (OCR1062).

>> Graphic3d_CGraduatedTrihedron.hxx
>> /* Size of names of axes: 8, 10, 12, 14, ... */
>> Standard_Integer sizeOfNames;
Please prefer C++ style for comments rather than C-style (OCR1047).

>> OpenGl_text.cxx, 152, 161, 451
>> i = 0; while (str[i++]);
>> while (*ptr1++ = (Techar)(*ptr2++));
Please avoid assignment within conditional expression (warning C4706).
And prefer for() cycle constructions in that cases.

>> OpenGl_text.cxx, 154-156
>> wchar_t *wstr = new wchar_t[i];
>> if( !wstr )
>> return TFailure;
It seems to be from C-code.
This NULL check will not work because new should throw exception in case of low memory. But validating the input parameters will be a good idea.

>> OpenGl_text.cxx, 58
>>struct TEL_TEXT_DATA
>>{
>> TEL_POINT attach_pt;
>> Tint length;
>> const wchar_t *sdata;
Is there any good reason using muddy names like 'sdata'?
Following naming conception from C past of OpenGl package?
(0017898)
abv (manager)
2011-08-03 17:24

As agreed, the remarks related to code style and possible issues with conversion of types are too difficult to be addressed now, and the code will have to be revised anyway later when we implement better support of Unicode.

Thus the fix is ready for testing.

During testing, please ensure that:
a) it does not produce (new) compiler warnings
b) test case employs sufficiently long Unicode string
(0017979)
ycy (tester)
2011-08-12 11:36

Dear BugMaster,
SVN branch ( http://svn/svn/occt/branches/OCC22149 [^] ) was
testing, test results were compared with KAS:dev:products-651-opt

Regressions
chl 941 A3 B1 B2 B3 B5 B6
xstp 206 H4

See results in /dn45/occttests/results/KAS/dev/ycy-products-3_10082011/lin/
See reference results in
/dn45/occttests/results/KAS/dev/products-651-opt_01062011/lin
See test cases in /dn45/occttests/tests/ED
N.B. In order to launch testing case you can make use the following instructions
http://sbu.nnov.opencascade.com/maintenance/main_certification_te.html [^]
(0018018)
szv (manager)
2011-08-23 15:32

The source file OpenGl_TextRender.cxx is corrected upon results of first tests (there was a problem in export to various formats).
Please test the branch again.
(0018025)
mkv (tester)
2011-08-25 19:07

Dear BugMaster,
Workbench KAS:dev:mkv-products-4 has been created from SVN branch http://svn/svn/occt/branches/OCC22149 [^]
and compiled on Linux platform.

There are not regressions in mkv-products-4 regarding to KAS:dev:products-651-opt

See results in /dn45/occttests/results/KAS/dev/mkv-products-4_24082011/lin
See reference results in /dn45/occttests/results/KAS/dev/products-651-opt_01062011/lin
See test cases in /dn45/occttests/tests/ED
N.B. In order to launch testing case you can make use the following instructions
http://sbu.nnov.opencascade.com/maintenance/main_certification_te.htm [^]
(0018037)
bugmaster (administrator)
2011-08-30 12:44

Fix has been integrated to occt repository

Date: 2011-08-30 12:42:34 +0400 (Tue, 30 Aug 2011)
New Revision: 8915

Modified:
   trunk/src/Graphic3d/Graphic3d_CGraduatedTrihedron.cxx
   trunk/src/Graphic3d/Graphic3d_CGraduatedTrihedron.hxx
   trunk/src/Graphic3d/Graphic3d_GraphicDriver.cdl
   trunk/src/Graphic3d/Graphic3d_GraphicDriver_9.cxx
   trunk/src/Graphic3d/Graphic3d_Group_10.cxx
   trunk/src/InterfaceGraphic/InterfaceGraphic_Cextern.hxx
   trunk/src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx
   trunk/src/InterfaceGraphic/InterfaceGraphic_Visual3d.hxx
   trunk/src/InterfaceGraphic/InterfaceGraphic_telem.hxx
   trunk/src/InterfaceGraphic/InterfaceGraphic_tgl_all.hxx
   trunk/src/OpenGl/OpenGl_FontMgr.cxx
   trunk/src/OpenGl/OpenGl_FontMgr.hxx
   trunk/src/OpenGl/OpenGl_GraphicDriver.cdl
   trunk/src/OpenGl/OpenGl_GraphicDriver_710.cxx
   trunk/src/OpenGl/OpenGl_GraphicDriver_713.cxx
   trunk/src/OpenGl/OpenGl_GraphicDriver_9.cxx
   trunk/src/OpenGl/OpenGl_GraphicDriver_Layer.cxx
   trunk/src/OpenGl/OpenGl_GraphicDriver_print.cxx
   trunk/src/OpenGl/OpenGl_TextRender.cxx
   trunk/src/OpenGl/OpenGl_TextRender.hxx
   trunk/src/OpenGl/OpenGl_funcs.cxx
   trunk/src/OpenGl/OpenGl_graduatedtrihedron.cxx
   trunk/src/OpenGl/OpenGl_graduatedtrihedron.hxx
   trunk/src/OpenGl/OpenGl_subrs.cxx
   trunk/src/OpenGl/OpenGl_telem_inquire.hxx
   trunk/src/OpenGl/OpenGl_text.cxx
   trunk/src/OpenGl/OpenGl_tgl_funcs.hxx
   trunk/src/OpenGl/OpenGl_togl_begin_layer_mode.cxx
   trunk/src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx
   trunk/src/OpenGl/OpenGl_togl_text.cxx
   trunk/src/OpenGl/OpenGl_triedron.cxx
   trunk/src/V3d/V3d_View.cdl
   trunk/src/V3d/V3d_View_4.cxx
   trunk/src/ViewerTest/ViewerTest_ObjectCommands.cxx
   trunk/src/ViewerTest/ViewerTest_ViewerCommands.cxx
   trunk/src/Visual3d/Visual3d_View.cdl
   trunk/src/Visual3d/Visual3d_View.cxx

- Related Changesets
occt: master 13a22457
Timestamp: 2011-08-30 08:42:34
Author: szv
Committer: bugmaster
Details ] Diff ]
0022149: Strings with Japanese characters can not be displayed in 3D viewer
mod - src/Graphic3d/Graphic3d_CGraduatedTrihedron.cxx Diff ] File ]
mod - src/Graphic3d/Graphic3d_CGraduatedTrihedron.hxx Diff ] File ]
mod - src/Graphic3d/Graphic3d_GraphicDriver.cdl Diff ] File ]
mod - src/Graphic3d/Graphic3d_GraphicDriver_9.cxx Diff ] File ]
mod - src/Graphic3d/Graphic3d_Group_10.cxx Diff ] File ]
mod - src/InterfaceGraphic/InterfaceGraphic_Cextern.hxx Diff ] File ]
mod - src/InterfaceGraphic/InterfaceGraphic_Graphic3d.hxx Diff ] File ]
mod - src/InterfaceGraphic/InterfaceGraphic_telem.hxx Diff ] File ]
mod - src/InterfaceGraphic/InterfaceGraphic_tgl_all.hxx Diff ] File ]
mod - src/InterfaceGraphic/InterfaceGraphic_Visual3d.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_FontMgr.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_FontMgr.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_funcs.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_graduatedtrihedron.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_graduatedtrihedron.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_GraphicDriver.cdl Diff ] File ]
mod - src/OpenGl/OpenGl_GraphicDriver_710.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_GraphicDriver_713.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_GraphicDriver_9.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_GraphicDriver_Layer.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_GraphicDriver_print.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_subrs.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_telem_inquire.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_text.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_TextRender.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_TextRender.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_tgl_funcs.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_togl_begin_layer_mode.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_togl_text.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_triedron.cxx Diff ] File ]
mod - src/V3d/V3d_View.cdl Diff ] File ]
mod - src/V3d/V3d_View_4.cxx Diff ] File ]
mod - src/ViewerTest/ViewerTest_ObjectCommands.cxx Diff ] File ]
mod - src/ViewerTest/ViewerTest_ViewerCommands.cxx Diff ] File ]
mod - src/Visual3d/Visual3d_View.cdl Diff ] File ]
mod - src/Visual3d/Visual3d_View.cxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2010-12-14 16:32 abv CC => pdn, nkv
2010-12-22 17:54 bugmaster Assigned To bugmaster => szv
2010-12-22 17:54 bugmaster Status new => assigned
2010-12-22 18:06 szv Status assigned => resolved
2011-06-29 16:20 szv CC => mkv
2011-06-29 17:43 bugmaster Status resolved => assigned
2011-07-06 14:15 szv Status assigned => resolved
2011-07-22 17:13 mkv Status resolved => tested
2011-07-26 20:24 bugmaster Assigned To szv => kgv
2011-07-26 20:24 bugmaster Status tested => assigned
2011-08-01 13:08 kgv Note Added: 0017870
2011-08-01 13:10 kgv Note Edited: 0017870 View Revisions
2011-08-01 13:11 kgv Note Edited: 0017870 View Revisions
2011-08-01 17:19 szv Note Added: 0017874
2011-08-02 08:08 abv Note Added: 0017876
2011-08-02 11:24 bugmaster Category OCCT:VIZ => OCCT:Visualization
2011-08-03 10:11 kgv Note Added: 0017880
2011-08-03 12:18 bugmaster Fixed in Version EMPTY =>
2011-08-03 12:18 bugmaster Target Version => 6.5.2
2011-08-03 12:18 bugmaster Description Updated View Revisions
2011-08-03 14:41 miv Test case number => chl 936 Z8
2011-08-03 17:24 abv Note Added: 0017898
2011-08-03 17:24 abv Status assigned => reviewed
2011-08-12 11:36 ycy Note Added: 0017979
2011-08-23 15:32 szv Note Added: 0018018
2011-08-25 19:07 mkv Note Added: 0018025
2011-08-25 19:08 mkv Status reviewed => tested
2011-08-30 12:44 bugmaster Note Added: 0018037
2011-08-30 12:44 bugmaster Status tested => verified
2011-08-30 12:44 bugmaster Resolution open => fixed
2012-03-29 17:26 bugmaster Changeset attached => occt master 13a22457
2019-05-06 22:55 kgv Relationship added related to 0030696


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker