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,