mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
bug 214743 : remove Hangul Jamo fallback in KSC5601GL encoder and 'generator'. Also remove the corresponding 'scanner' in uscan.c that's not used by any decoder (r=smontagu,sr=blizzard)
This commit is contained in:
parent
25bb2b740e
commit
a66b40d805
@ -202,15 +202,6 @@ PRIVATE PRBool uCnGAlways8BytesDecomposedHangul(
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCnGAlways6BytesGLDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uCheckAndGenJohabHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
@ -239,18 +230,6 @@ PRIVATE PRBool uCheckAndGen4BytesGB18030(
|
||||
PRUint32* outlen
|
||||
);
|
||||
|
||||
|
||||
PRIVATE PRBool uGenDecomposedHangulCommon(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen,
|
||||
PRUint8 mask,
|
||||
PRUint16 nbyte
|
||||
);
|
||||
|
||||
PRIVATE PRBool uGenAlways2Byte(
|
||||
PRUint16 in,
|
||||
unsigned char* out
|
||||
@ -296,7 +275,6 @@ PRIVATE const uGeneratorFunc m_generator[uNumOfCharsetType] =
|
||||
uCheckAndGen2ByteGRPrefix8EA7,
|
||||
uCheckAndGenAlways1ByteShiftGL,
|
||||
uCnGAlways8BytesDecomposedHangul,
|
||||
uCnGAlways6BytesGLDecomposedHangul,
|
||||
uCheckAndGenJohabHangul,
|
||||
uCheckAndGenJohabSymbol,
|
||||
uCheckAndGen4BytesGB18030,
|
||||
@ -770,58 +748,6 @@ PRIVATE PRBool uCheckAndGenAlways1ByteShiftGL(
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uGenDecomposedHangulCommon(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen,
|
||||
PRUint8 mask,
|
||||
PRUint16 nbyte
|
||||
)
|
||||
{
|
||||
if(outbuflen < 8)
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
static const PRUint8 lMap[LCount] = {
|
||||
0xa1, 0xa2, 0xa4, 0xa7, 0xa8, 0xa9, 0xb1, 0xb2, 0xb3, 0xb5,
|
||||
0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe
|
||||
};
|
||||
|
||||
static const PRUint8 tMap[TCount] = {
|
||||
0xd4, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa9, 0xaa,
|
||||
0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb4, 0xb5,
|
||||
0xb6, 0xb7, 0xb8, 0xba, 0xbb, 0xbc, 0xbd, 0xbe
|
||||
};
|
||||
PRUint16 SIndex, LIndex, VIndex, TIndex;
|
||||
PRUint16 offset;
|
||||
/* the following line are copy from Unicode 2.0 page 3-13 */
|
||||
/* item 1 of Hangul Syllabel Decomposition */
|
||||
SIndex = in - SBase;
|
||||
|
||||
/* the following lines are copy from Unicode 2.0 page 3-14 */
|
||||
/* item 2 of Hangul Syllabel Decomposition w/ modification */
|
||||
LIndex = SIndex / NCount;
|
||||
VIndex = (SIndex % NCount) / TCount;
|
||||
TIndex = SIndex % TCount;
|
||||
|
||||
*outlen = nbyte;
|
||||
offset = nbyte == 6 ? 0 : 2;
|
||||
out[0] = out[2] = out[4] = 0xa4 & mask;
|
||||
out[1+offset] = lMap[LIndex] & mask;
|
||||
out[3+offset] = (VIndex + 0xbf) & mask;
|
||||
out[5+offset] = tMap[TIndex] & mask;
|
||||
if ( nbyte == 8 )
|
||||
{
|
||||
out[6] = 0xa4 & mask;
|
||||
out[1] = 0xd4 & mask;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
PRIVATE PRBool uCnGAlways8BytesDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
@ -831,24 +757,41 @@ PRIVATE PRBool uCnGAlways8BytesDecomposedHangul(
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
return uGenDecomposedHangulCommon(shift,state,in,out,outbuflen,outlen,0xff,8);
|
||||
}
|
||||
/*
|
||||
For rendering of Hangul in X11 with fonts with glyphs for only
|
||||
2350 syllables, drop the first 2bytes anchoring the representation
|
||||
of Hangul syllables with 8byte sequence.
|
||||
*/
|
||||
PRIVATE PRBool uCnGAlways6BytesGLDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
PRUint16 in,
|
||||
unsigned char* out,
|
||||
PRUint32 outbuflen,
|
||||
PRUint32* outlen
|
||||
)
|
||||
{
|
||||
return uGenDecomposedHangulCommon(shift,state,in,out,outbuflen,outlen,0x7f,6);
|
||||
static const PRUint8 lMap[LCount] = {
|
||||
0xa1, 0xa2, 0xa4, 0xa7, 0xa8, 0xa9, 0xb1, 0xb2, 0xb3, 0xb5,
|
||||
0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe
|
||||
};
|
||||
|
||||
static const PRUint8 tMap[TCount] = {
|
||||
0xd4, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa9, 0xaa,
|
||||
0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb4, 0xb5,
|
||||
0xb6, 0xb7, 0xb8, 0xba, 0xbb, 0xbc, 0xbd, 0xbe
|
||||
};
|
||||
|
||||
PRUint16 SIndex, LIndex, VIndex, TIndex;
|
||||
|
||||
if(outbuflen < 8)
|
||||
return PR_FALSE;
|
||||
|
||||
/* the following line are copy from Unicode 2.0 page 3-13 */
|
||||
/* item 1 of Hangul Syllabel Decomposition */
|
||||
SIndex = in - SBase;
|
||||
|
||||
/* the following lines are copy from Unicode 2.0 page 3-14 */
|
||||
/* item 2 of Hangul Syllabel Decomposition w/ modification */
|
||||
LIndex = SIndex / NCount;
|
||||
VIndex = (SIndex % NCount) / TCount;
|
||||
TIndex = SIndex % TCount;
|
||||
|
||||
*outlen = 8;
|
||||
out[0] = out[2] = out[4] = out[6] = 0xa4;
|
||||
out[3] = lMap[LIndex] ;
|
||||
out[5] = (VIndex + 0xbf);
|
||||
out[7] = tMap[TIndex];
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRIVATE PRBool uCheckAndGenJohabHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
|
@ -205,24 +205,6 @@ PRIVATE PRBool uCnSAlways8BytesDecomposedHangul(
|
||||
PRUint32 inbuflen,
|
||||
PRUint32* inscanlen
|
||||
);
|
||||
PRIVATE PRBool uCnSAlways8BytesGLDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
unsigned char *in,
|
||||
PRUint16 *out,
|
||||
PRUint32 inbuflen,
|
||||
PRUint32* inscanlen
|
||||
);
|
||||
|
||||
PRIVATE PRBool uScanDecomposedHangulCommon(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
unsigned char *in,
|
||||
PRUint16 *out,
|
||||
PRUint32 inbuflen,
|
||||
PRUint32* inscanlen,
|
||||
PRUint8 mask
|
||||
);
|
||||
PRIVATE PRBool uCheckAndScanJohabHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
@ -294,7 +276,6 @@ PRIVATE const uScannerFunc m_scanner[uNumOfCharsetType] =
|
||||
uCheckAndScan2ByteGRPrefix8EA7,
|
||||
uCheckAndScanAlways1ByteShiftGL,
|
||||
uCnSAlways8BytesDecomposedHangul,
|
||||
uCnSAlways8BytesGLDecomposedHangul,
|
||||
uCheckAndScanJohabHangul,
|
||||
uCheckAndScanJohabSymbol,
|
||||
uCheckAndScan4BytesGB18030,
|
||||
@ -783,25 +764,25 @@ PRIVATE PRBool uCheckAndScanAlways1ByteShiftGL(
|
||||
#define VCount 21
|
||||
#define TCount 28
|
||||
#define NCount (VCount * TCount)
|
||||
PRIVATE PRBool uScanDecomposedHangulCommon(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
unsigned char *in,
|
||||
PRUint16 *out,
|
||||
PRUint32 inbuflen,
|
||||
PRUint32* inscanlen,
|
||||
PRUint8 mask
|
||||
)
|
||||
|
||||
PRIVATE PRBool uCnSAlways8BytesDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
unsigned char *in,
|
||||
PRUint16 *out,
|
||||
PRUint32 inbuflen,
|
||||
PRUint32* inscanlen
|
||||
)
|
||||
{
|
||||
|
||||
PRUint16 LIndex, VIndex, TIndex;
|
||||
/* no 8 bytes, not in a4 range, or the first 2 byte are not a4d4 */
|
||||
if((inbuflen < 8) || ((mask & 0xa4) != in[0]) || ((mask& 0xd4) != in[1]) ||
|
||||
((mask&0xa4) != in[2] ) || ((mask&0xa4) != in[4]) || ((mask&0xa4) != in[6]))
|
||||
if((inbuflen < 8) || (0xa4 != in[0]) || (0xd4 != in[1]) ||
|
||||
(0xa4 != in[2] ) || (0xa4 != in[4]) || (0xa4 != in[6]))
|
||||
return PR_FALSE;
|
||||
|
||||
/* Compute LIndex */
|
||||
if((in[3] < (mask&0xa1)) && (in[3] > (mask&0xbe))) { /* illegal leading consonant */
|
||||
if((in[3] < 0xa1) && (in[3] > 0xbe)) { /* illegal leading consonant */
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
@ -816,25 +797,25 @@ PRIVATE PRBool uScanDecomposedHangulCommon(
|
||||
12, 13, 14, 15, 16, 17, 18
|
||||
};
|
||||
|
||||
LIndex = lMap[in[3] - (0xa1 & mask)];
|
||||
LIndex = lMap[in[3] - 0xa1];
|
||||
if(0xff == (0xff & LIndex))
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/* Compute VIndex */
|
||||
if((in[5] < (mask&0xbf)) && (in[5] > (mask&0xd3))) { /* illegal medial vowel */
|
||||
if((in[5] < 0xbf) && (in[5] > 0xd3)) { /* illegal medial vowel */
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
VIndex = in[5] - (mask&0xbf);
|
||||
VIndex = in[5] - 0xbf;
|
||||
}
|
||||
|
||||
/* Compute TIndex */
|
||||
if((mask&0xd4) == in[7])
|
||||
if(0xd4 == in[7])
|
||||
{
|
||||
TIndex = 0;
|
||||
}
|
||||
else if((in[7] < (mask&0xa1)) && (in[7] > (mask&0xbe))) {/* illegal trailling consonant */
|
||||
else if((in[7] < 0xa1) && (in[7] > 0xbe)) {/* illegal trailling consonant */
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
@ -848,7 +829,7 @@ PRIVATE PRBool uScanDecomposedHangulCommon(
|
||||
/* B8 B9 BA BB BC BD BE */
|
||||
22,0xff, 23, 24, 25, 26, 27
|
||||
};
|
||||
TIndex = tMap[in[7] - (mask&0xa1)];
|
||||
TIndex = tMap[in[7] - 0xa1];
|
||||
if(0xff == (0xff & TIndex))
|
||||
return PR_FALSE;
|
||||
}
|
||||
@ -862,31 +843,7 @@ PRIVATE PRBool uScanDecomposedHangulCommon(
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCnSAlways8BytesDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
unsigned char *in,
|
||||
PRUint16 *out,
|
||||
PRUint32 inbuflen,
|
||||
PRUint32* inscanlen
|
||||
)
|
||||
{
|
||||
return uScanDecomposedHangulCommon(shift,state,in,out,inbuflen,inscanlen,0xff);
|
||||
}
|
||||
/*=================================================================================
|
||||
|
||||
=================================================================================*/
|
||||
PRIVATE PRBool uCnSAlways8BytesGLDecomposedHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
unsigned char *in,
|
||||
PRUint16 *out,
|
||||
PRUint32 inbuflen,
|
||||
PRUint32* inscanlen
|
||||
)
|
||||
{
|
||||
return uScanDecomposedHangulCommon(shift,state,in,out,inbuflen,inscanlen,0x7f);
|
||||
}
|
||||
PRIVATE PRBool uCheckAndScanJohabHangul(
|
||||
uShiftTable *shift,
|
||||
PRInt32* state,
|
||||
|
Loading…
Reference in New Issue
Block a user