[Libreoffice-commits] core.git: i18nutil/source sc/qa

2018-02-02 Thread Winfried Donkers
 i18nutil/source/utility/widthfolding.cxx |   45 ---
 i18nutil/source/utility/widthfolding_data.h  |   23 +++--
 sc/qa/unit/data/functions/text/fods/jis.fods |   24 +-
 3 files changed, 28 insertions(+), 64 deletions(-)

New commits:
commit 6c79c9053e3090df09fc2c0a24f1fec26ac8bf02
Author: Winfried Donkers 
Date:   Thu Feb 1 15:39:56 2018 +0100

Clean up of dirty hack.

Follow up of tdf#103550. The conversion from half to full width characters 
and vice versa happens per character according to a table. There is no need to 
have a separate table with exceptions to the general rule.

Change-Id: Id611d1d6074cb2489fb0254d8ba9a83d7c26065f
Reviewed-on: https://gerrit.libreoffice.org/49102
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/i18nutil/source/utility/widthfolding.cxx 
b/i18nutil/source/utility/widthfolding.cxx
index a7e8dd05c285..8db7524235e2 100644
--- a/i18nutil/source/utility/widthfolding.cxx
+++ b/i18nutil/source/utility/widthfolding.cxx
@@ -214,27 +214,6 @@ oneToOneMapping& widthfolding::getfull2halfTableForASC()
 static oneToOneMappingWithFlag table(full2half, sizeof(full2half), 
FULL2HALF_ASC_FUNCTION);
 table.makeIndex();
 
-// bluedwarf: dirty hack!
-// There is an exception. Additional conversion is required following:
-//  0xFFE5 (FULLWIDTH YEN SIGN)  --> 0x005C (REVERSE SOLIDUS)
-//
-//  See the following page for detail:
-// http://wiki.openoffice.org/wiki/Calc/Features/JIS_and_ASC_functions
-for( int i = 0; i < int(SAL_N_ELEMENTS(full2halfASCException)); i++ )
-{
-const int high = (full2halfASCException[i].first >> 8) & 0xFF;
-const int low  = (full2halfASCException[i].first)  & 0xFF;
-
-if( !table.mpIndex[high] )
-{
-table.mpIndex[high] = new UnicodePairWithFlag*[256];
-
-for( int j = 0; j < 256; j++ )
-table.mpIndex[high][j] = nullptr;
-}
-table.mpIndex[high][low] = [i];
-}
-
 return table;
 }
 
@@ -243,30 +222,6 @@ oneToOneMapping& widthfolding::gethalf2fullTableForJIS()
 static oneToOneMappingWithFlag table(half2full, sizeof(half2full), 
HALF2FULL_JIS_FUNCTION);
 table.makeIndex();
 
-// bluedwarf: dirty hack!
-//  There are some exceptions. Additional conversion are required 
following:
-//  0x0022 (QUOTATION MARK)  --> 0x201D (RIGHT DOUBLE QUOTATION MARK)
-//  0x0027 (APOSTROPHE)  --> 0x2019 (RIGHT SINGLE QUOTATION MARK)
-//  0x005C (REVERSE SOLIDUS) --> 0xFFE5 (FULLWIDTH YEN SIGN)
-//  0x0060 (GRAVE ACCENT)--> 0x2018 (LEFT SINGLE QUOTATION MARK)
-//
-//  See the following page for detail:
-// http://wiki.openoffice.org/wiki/Calc/Features/JIS_and_ASC_functions
-for( int i = 0; i < int(SAL_N_ELEMENTS(half2fullJISException)); i++ )
-{
-const int high = (half2fullJISException[i].first >> 8) & 0xFF;
-const int low  = (half2fullJISException[i].first)  & 0xFF;
-
-if( !table.mpIndex[high] )
-{
-table.mpIndex[high] = new UnicodePairWithFlag*[256];
-
-for( int j = 0; j < 256; j++ )
-table.mpIndex[high][j] = nullptr;
-}
-table.mpIndex[high][low] = [i];
-}
-
 return table;
 }
 
diff --git a/i18nutil/source/utility/widthfolding_data.h 
b/i18nutil/source/utility/widthfolding_data.h
index 999ca82734b1..b1c0e2c00c57 100644
--- a/i18nutil/source/utility/widthfolding_data.h
+++ b/i18nutil/source/utility/widthfolding_data.h
@@ -481,17 +481,11 @@ UnicodePairWithFlag full2half[] = {
 { 0xFFE3, 0x00AF, FULL2HALF_NORMAL },  // FULLWIDTH MACRON --> MACRON
 { 0xFFE4, 0x00A6, FULL2HALF_NORMAL },  // FULLWIDTH BROKEN BAR --> BROKEN 
BAR
 { 0xFFE5, 0x00A5, FULL2HALF_NORMAL },  // FULLWIDTH YEN SIGN --> YEN SIGN
+{ 0xFFE5, 0x005C, FULL2HALF_ASC_FUNCTION },  // FULLWIDTH YEN SIGN --> 
REVERSE SOLIDUS, exceptional conversion
 { 0xFFE6, 0x20A9, FULL2HALF_NORMAL },  // FULLWIDTH WON SIGN --> WON SIGN
 };
 
 /*
- Exceptional conversion table for ASC function
-*/
-UnicodePairWithFlag full2halfASCException[] = {
-{ 0xFFE5, 0x005C, FULL2HALF_ASC_FUNCTION }  // FULLWIDTH YEN SIGN --> 
REVERSE SOLIDUS
- };
-
-/*
   Unicode Normalization Forms
   http://www.unicode.org/unicode/reports/tr15/index.html
   http://www.w3.org/International/charlint/
@@ -708,11 +702,13 @@ UnicodePairWithFlag half2full[] = {
 { 0x0020, 0x3000, HALF2FULL_NORMAL },  // SPACE --> IDEOGRAPHIC SPACE
 { 0x0021, 0xFF01, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // 
EXCLAMATION MARK --> FULLWIDTH EXCLAMATION MARK
 { 0x0022, 0xFF02, HALF2FULL_NORMAL },  // QUOTATION MARK --> FULLWIDTH 
QUOTATION MARK
+{ 0x0022, 0x201D, HALF2FULL_JIS_FUNCTION }, // QUOTATION MARK --> RIGHT 
DOUBLE QUOTATION MARK, exceptional conversion
 { 0x0023, 0xFF03, 

[Libreoffice-commits] core.git: i18nutil/source sc/qa

2018-01-26 Thread Winfried Donkers
 i18nutil/source/utility/widthfolding_data.h  |1 +
 sc/qa/unit/data/functions/text/fods/jis.fods |   15 +--
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 484d0ea842da586a4cf51b6d11683b04f234474c
Author: Winfried Donkers 
Date:   Wed Jan 24 17:21:19 2018 +0100

tdf#103550 fix issue with HYPHEN-MINUS in Calc function JIS.

Change-Id: Ie1e25ea7a0d6f23dfe21f53ed47430be6b357984
Reviewed-on: https://gerrit.libreoffice.org/48523
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/i18nutil/source/utility/widthfolding_data.h 
b/i18nutil/source/utility/widthfolding_data.h
index b2bdd369c6cf..999ca82734b1 100644
--- a/i18nutil/source/utility/widthfolding_data.h
+++ b/i18nutil/source/utility/widthfolding_data.h
@@ -718,6 +718,7 @@ UnicodePairWithFlag half2full[] = {
 { 0x002A, 0xFF0A, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // 
ASTERISK --> FULLWIDTH ASTERISK
 { 0x002B, 0xFF0B, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // PLUS 
SIGN --> FULLWIDTH PLUS SIGN
 { 0x002C, 0xFF0C, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // COMMA 
--> FULLWIDTH COMMA
+{ 0x002D, 0xFF0D, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // MINUS 
HYPHEN --> FULLWIDTH MINUS HYPHEN
 { 0x002E, 0xFF0E, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // FULL 
STOP --> FULLWIDTH FULL STOP
 { 0x002F, 0xFF0F, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // SOLIDUS 
--> FULLWIDTH SOLIDUS
 { 0x0030, 0xFF10, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // DIGIT 
ZERO --> FULLWIDTH DIGIT ZERO
diff --git a/sc/qa/unit/data/functions/text/fods/jis.fods 
b/sc/qa/unit/data/functions/text/fods/jis.fods
index 50584f6b8820..2c55690735fb 100644
--- a/sc/qa/unit/data/functions/text/fods/jis.fods
+++ b/sc/qa/unit/data/functions/text/fods/jis.fods
@@ -1057,19 +1057,22 @@
  
 
 
- 
-  0123456789
+ 
+  !”#$%&’()*+,-./
  
  
-  0123456789
+  !”#$%&’()*+,-./
  
  
   TRUE
  
- 
+ 
   =JIS(I2)
  
- 
+ 
+  Tdf103550, AOO#78727
+ 
+ 
  
   !#$%()*+,-./
  
@@ -1802,4 +1805,4 @@

   
  
-
\ No newline at end of file
+
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits