Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Enumerations | Functions | Variables
nsUnicodeToJamoTTF.cpp File Reference
#include "nsUCvKODll.h"
#include "nsUnicodeToJamoTTF.h"
#include "prmem.h"
#include "nsXPIDLString.h"
#include "prtypes.h"
#include "nscore.h"
#include "nsISupportsUtils.h"
#include "nsCOMPtr.h"
#include "nsIUnicodeDecoder.h"
#include "nsServiceManagerUtils.h"
#include "nsICharsetConverterManager.h"
#include "nsICharRepresentable.h"
#include <string.h>
#include "jamoclusters.h"

Go to the source code of this file.

Classes

struct  JamoNormMap

Defines

#define LBASE   0x1100
#define VBASE   0x1161
#define TBASE   0x11A7
#define TSTART   0x11A8
#define SBASE   0xAC00
#define LCOUNT   19
#define VCOUNT   21
#define TCOUNT   28
#define SCOUNT   (LCOUNT * VCOUNT * TCOUNT)
#define SEND   (SBASE + SCOUNT - 1)
#define LFILL   0x115F
#define VFILL   0x1160
#define IS_LC(wc)   (LBASE <= (wc) && (wc) < VFILL)
#define IS_VO(wc)   (VFILL <= (wc) && (wc) < TSTART)
#define IS_TC(wc)   (TSTART <= (wc) && (wc) <= 0x11FF)
#define IS_JAMO(wc)   (IS_LC(wc) || IS_VO(wc) || IS_TC(wc))
#define IS_SYL_LC(wc)   (LBASE <= (wc) && (wc) < LBASE + LCOUNT)
#define IS_SYL_VO(wc)   (VBASE <= (wc) && (wc) < VBASE + VCOUNT)
#define IS_SYL_TC(wc)   (TBASE < (wc) && (wc) <= TBASE + TCOUNT)
#define IS_SYL(wc)   (SBASE <= (wc) && (wc) <= SEND)
#define IS_SYL_WO_TC(wc)   (((wc) - SBASE) % TCOUNT == 0)
#define IS_SYL_WITH_TC(wc)   (((wc) - SBASE) % TCOUNT)
#define SYL_FROM_LVT(l, v, t)
#define HTONE1   0x302E
#define HTONE2   0x302F
#define IS_TONE(wc)   ((wc) == HTONE1 || (wc) == HTONE2)
#define LC_TMPPOS   0xF000
#define VO_TMPPOS   0xF100
#define TC_TMPPOS   0xF200
#define LC_OFFSET   (LC_TMPPOS-LBASE)
#define VO_OFFSET   (VO_TMPPOS-VFILL)
#define TC_OFFSET   (TC_TMPPOS-TSTART)
#define IS_LC_EXT(wc)   ( ((wc) & 0xFF00) == LC_TMPPOS )
#define IS_VO_EXT(wc)   ( ((wc) & 0xFF00) == VO_TMPPOS )
#define IS_TC_EXT(wc)   ( ((wc) & 0xFF00) == TC_TMPPOS )
#define UP_LBASE   0xE000
#define UP_VBASE   0xE300
#define UP_TBASE   0xE404
#define CHAR_CLASS(ch)
#define ROWLEN   94
#define IS_GR94(x)   (0xA0 < (x) && (x) < 0xFF)

Enumerations

enum  KoCharClass {
  KO_CHAR_CLASS_LC, KO_CHAR_CLASS_VO, KO_CHAR_CLASS_TC, KO_CHAR_CLASS_SYL1,
  KO_CHAR_CLASS_SYL2, KO_CHAR_CLASS_TONE, KO_CHAR_CLASS_NOHANGUL, KO_CHAR_CLASS_NUM
}

Functions

static void FillInfoRange (PRUint32 *aInfo, PRUint32 aStart, PRUint32 aEnd)
static nsresult JamoNormalize (const PRUnichar *aInSeq, PRUnichar **aOutSeq, PRInt32 *aLength)
static void JamosToExtJamos (PRUnichar *aInSeq, PRInt32 *aLength)
static const JamoNormMapJamoClusterSearch (JamoNormMap aKey, const JamoNormMap *aClusters, PRInt16 aClustersSize)
static nsresult FillInfoEUCKR (PRUint32 *aInfo, PRUint16 aHigh1, PRUint16 aHigh2)
static PRInt32 JamoNormMapComp (const JamoNormMap &p1, const JamoNormMap &p2)
static PRInt16 JamoSrchReplace (const JamoNormMap *aCluster, PRUint16 aSize, PRUnichar *aIn, PRInt32 *aLength, PRUint16 aOffset)
static nsresult GetDecoder (nsIUnicodeDecoder **aDecoder)
static nsresult ScanDecomposeSyllable (PRUnichar *aIn, PRInt32 *aLength, const PRInt32 aMaxLen)

Variables

static nsCOMPtr
< nsIUnicodeDecoder
gDecoder = 0
static const PRBool gIsBoundary [KO_CHAR_CLASS_NUM][KO_CHAR_CLASS_NUM]
static const PRUint8 gUnParkLcGlyphMap [130]
 Copied from mslvt.otp by Jin-Hwan Cho chofc.nosp@m.hof@.nosp@m.ktug..nosp@m.or.k.nosp@m.r.
static const PRUint8 gUnParkVoGlyphMap [95]
 Mapping from vowel code points to glyph indices in UnPark/Oxxx font.
static const PRUint8 gUnParkTcGlyphMap [141]
 Mapping from TC code points to glyph indices in UnPark/Oxxx font.
static const PRUint8 gUnParkVo2LcMap [95]
static const PRUint8 gUnParkVo2LcMap2 [95]
static const PRUint8 gUnParkVo2TcMap [95]

Class Documentation

struct JamoNormMap

Definition at line 64 of file nsUnicodeToJamoTTF.cpp.

Class Members
PRUint8 liga
PRUint8 seq

Define Documentation

Value:
(IS_LC(ch) ? KO_CHAR_CLASS_LC   :  \
   IS_VO(ch) ? KO_CHAR_CLASS_VO   :  \
   IS_TC(ch) ? KO_CHAR_CLASS_TC   :  \
   IS_SYL(ch) ?                      \
    (IS_SYL_WITH_TC(ch) ? KO_CHAR_CLASS_SYL2 : KO_CHAR_CLASS_SYL1) : \
   IS_TONE(ch) ? KO_CHAR_CLASS_TONE : \
   KO_CHAR_CLASS_NOHANGUL)

Definition at line 202 of file nsUnicodeToJamoTTF.cpp.

#define HTONE1   0x302E

Definition at line 112 of file nsUnicodeToJamoTTF.cpp.

#define HTONE2   0x302F

Definition at line 113 of file nsUnicodeToJamoTTF.cpp.

#define IS_GR94 (   x)    (0xA0 < (x) && (x) < 0xFF)

Definition at line 706 of file nsUnicodeToJamoTTF.cpp.

#define IS_JAMO (   wc)    (IS_LC(wc) || IS_VO(wc) || IS_TC(wc))

Definition at line 94 of file nsUnicodeToJamoTTF.cpp.

#define IS_LC (   wc)    (LBASE <= (wc) && (wc) < VFILL)

Definition at line 91 of file nsUnicodeToJamoTTF.cpp.

#define IS_LC_EXT (   wc)    ( ((wc) & 0xFF00) == LC_TMPPOS )

Definition at line 127 of file nsUnicodeToJamoTTF.cpp.

#define IS_SYL (   wc)    (SBASE <= (wc) && (wc) <= SEND)

Definition at line 102 of file nsUnicodeToJamoTTF.cpp.

#define IS_SYL_LC (   wc)    (LBASE <= (wc) && (wc) < LBASE + LCOUNT)

Definition at line 97 of file nsUnicodeToJamoTTF.cpp.

#define IS_SYL_TC (   wc)    (TBASE < (wc) && (wc) <= TBASE + TCOUNT)

Definition at line 99 of file nsUnicodeToJamoTTF.cpp.

#define IS_SYL_VO (   wc)    (VBASE <= (wc) && (wc) < VBASE + VCOUNT)

Definition at line 98 of file nsUnicodeToJamoTTF.cpp.

#define IS_SYL_WITH_TC (   wc)    (((wc) - SBASE) % TCOUNT)

Definition at line 104 of file nsUnicodeToJamoTTF.cpp.

#define IS_SYL_WO_TC (   wc)    (((wc) - SBASE) % TCOUNT == 0)

Definition at line 103 of file nsUnicodeToJamoTTF.cpp.

#define IS_TC (   wc)    (TSTART <= (wc) && (wc) <= 0x11FF)

Definition at line 93 of file nsUnicodeToJamoTTF.cpp.

#define IS_TC_EXT (   wc)    ( ((wc) & 0xFF00) == TC_TMPPOS )

Definition at line 129 of file nsUnicodeToJamoTTF.cpp.

#define IS_TONE (   wc)    ((wc) == HTONE1 || (wc) == HTONE2)

Definition at line 115 of file nsUnicodeToJamoTTF.cpp.

#define IS_VO (   wc)    (VFILL <= (wc) && (wc) < TSTART)

Definition at line 92 of file nsUnicodeToJamoTTF.cpp.

#define IS_VO_EXT (   wc)    ( ((wc) & 0xFF00) == VO_TMPPOS )

Definition at line 128 of file nsUnicodeToJamoTTF.cpp.

#define LBASE   0x1100

Definition at line 75 of file nsUnicodeToJamoTTF.cpp.

Definition at line 122 of file nsUnicodeToJamoTTF.cpp.

#define LC_TMPPOS   0xF000

Definition at line 119 of file nsUnicodeToJamoTTF.cpp.

#define LCOUNT   19

Definition at line 81 of file nsUnicodeToJamoTTF.cpp.

#define LFILL   0x115F

Definition at line 88 of file nsUnicodeToJamoTTF.cpp.

#define ROWLEN   94

Definition at line 705 of file nsUnicodeToJamoTTF.cpp.

#define SBASE   0xAC00

Definition at line 79 of file nsUnicodeToJamoTTF.cpp.

Definition at line 84 of file nsUnicodeToJamoTTF.cpp.

#define SEND   (SBASE + SCOUNT - 1)

Definition at line 85 of file nsUnicodeToJamoTTF.cpp.

#define SYL_FROM_LVT (   l,
  v,
  t 
)
Value:
(SBASE + \
                             (((l) - LBASE) * VCOUNT + (v) - VBASE) * TCOUNT + \
                             (t) - TBASE)

Definition at line 107 of file nsUnicodeToJamoTTF.cpp.

#define TBASE   0x11A7

Definition at line 77 of file nsUnicodeToJamoTTF.cpp.

Definition at line 124 of file nsUnicodeToJamoTTF.cpp.

#define TC_TMPPOS   0xF200

Definition at line 121 of file nsUnicodeToJamoTTF.cpp.

#define TCOUNT   28

Definition at line 83 of file nsUnicodeToJamoTTF.cpp.

#define TSTART   0x11A8

Definition at line 78 of file nsUnicodeToJamoTTF.cpp.

#define UP_LBASE   0xE000

Definition at line 132 of file nsUnicodeToJamoTTF.cpp.

#define UP_TBASE   0xE404

Definition at line 134 of file nsUnicodeToJamoTTF.cpp.

#define UP_VBASE   0xE300

Definition at line 133 of file nsUnicodeToJamoTTF.cpp.

#define VBASE   0x1161

Definition at line 76 of file nsUnicodeToJamoTTF.cpp.

#define VCOUNT   21

Definition at line 82 of file nsUnicodeToJamoTTF.cpp.

#define VFILL   0x1160

Definition at line 89 of file nsUnicodeToJamoTTF.cpp.

Definition at line 123 of file nsUnicodeToJamoTTF.cpp.

#define VO_TMPPOS   0xF100

Definition at line 120 of file nsUnicodeToJamoTTF.cpp.


Enumeration Type Documentation

Enumerator:
KO_CHAR_CLASS_LC 
KO_CHAR_CLASS_VO 
KO_CHAR_CLASS_TC 
KO_CHAR_CLASS_SYL1 
KO_CHAR_CLASS_SYL2 
KO_CHAR_CLASS_TONE 
KO_CHAR_CLASS_NOHANGUL 
KO_CHAR_CLASS_NUM 

Definition at line 191 of file nsUnicodeToJamoTTF.cpp.

                 {
  KO_CHAR_CLASS_LC,
  KO_CHAR_CLASS_VO,  
  KO_CHAR_CLASS_TC,  
  KO_CHAR_CLASS_SYL1,   // modern precomposed syllable w/o TC (LV type syl.)
  KO_CHAR_CLASS_SYL2,   // modern precomposed syllable with TC (LVT type syl.)
  KO_CHAR_CLASS_TONE,   // Tone marks 
  KO_CHAR_CLASS_NOHANGUL, // Non-Hangul characters.
  KO_CHAR_CLASS_NUM
} ;

Function Documentation

nsresult FillInfoEUCKR ( PRUint32 aInfo,
PRUint16  aHigh1,
PRUint16  aHigh2 
) [static]

Definition at line 712 of file nsUnicodeToJamoTTF.cpp.

{
  char row[ROWLEN * 2];
  PRUnichar dest[ROWLEN];
  nsresult rv = NS_OK;

  NS_ENSURE_TRUE(aInfo, NS_ERROR_NULL_POINTER);
  NS_ENSURE_TRUE(IS_GR94(aHigh1) && IS_GR94(aHigh2), NS_ERROR_INVALID_ARG);

  nsCOMPtr<nsIUnicodeDecoder> decoder;
  rv = GetDecoder(getter_AddRefs(decoder));
  NS_ENSURE_SUCCESS(rv,rv);

  for (PRUint16 i = aHigh1 ; i <= aHigh2; i++)
  {
    PRUint16 j;
    // handle a row of 94 char. at a time.
    for (j = 0 ; j < ROWLEN; j++)
    {
      row[j * 2] = char(i);
      row[j * 2 + 1] = char(j + 0xa1);
    }
    PRInt32 srcLen = ROWLEN * 2;
    PRInt32 destLen = ROWLEN;
    rv = decoder->Convert(row, &srcLen, dest, &destLen);
    NS_ENSURE_SUCCESS(rv, rv);

    // set representability according to the conversion result.
    for (j = 0 ; j < ROWLEN; j++)
      if (dest[j] != 0xFFFD)
        SET_REPRESENTABLE(aInfo, dest[j]);
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FillInfoRange ( PRUint32 aInfo,
PRUint32  aStart,
PRUint32  aEnd 
) [inline, static]

Definition at line 689 of file nsUnicodeToJamoTTF.cpp.

{

  PRUint32 b = aStart >> 5; 
  PRUint32 e = aEnd >> 5;

  if (aStart & 0x1f)
    aInfo[b++] |= ~ (0xFFFFFFFFL >> (32 - ((aStart) & 0x1f)));

  for( ; b < e ; b++)
    aInfo[b] |= 0xFFFFFFFFL;

  aInfo[e] |= (0xFFFFFFFFL >> (31 - ((aEnd) & 0x1f)));
}

Here is the caller graph for this function:

nsresult GetDecoder ( nsIUnicodeDecoder **  aDecoder) [static]

Definition at line 748 of file nsUnicodeToJamoTTF.cpp.

{
  nsresult rv; 

  if (gDecoder) {
    *aDecoder = gDecoder.get();
    NS_ADDREF(*aDecoder);
    return NS_OK;
  }

  nsCOMPtr<nsICharsetConverterManager> charsetConverterManager;
  charsetConverterManager = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv,rv);
  rv = charsetConverterManager->GetUnicodeDecoderRaw("EUC-KR", getter_AddRefs(gDecoder));
  NS_ENSURE_SUCCESS(rv,rv);

  *aDecoder = gDecoder.get();
  NS_ADDREF(*aDecoder);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const JamoNormMap * JamoClusterSearch ( JamoNormMap  aKey,
const JamoNormMap aClusters,
PRInt16  aClustersSize 
) [static]

Definition at line 781 of file nsUnicodeToJamoTTF.cpp.

{

  if (aClustersSize <= 0 || !aClusters)
  {
    NS_WARNING("aClustersSize <= 0 || !aClusters");
    return nsnull;
  }

  if (aClustersSize < 9) 
  {
    PRInt16 i;
    for (i = 0; i < aClustersSize; i++)
      if (JamoNormMapComp (aKey, aClusters[i]) == 0) 
        return aClusters + i; 
    return nsnull;
  }
   
  PRUint16 l = 0, u = aClustersSize - 1;
  PRUint16 h = (l + u) / 2;

  if (JamoNormMapComp (aKey, aClusters[h]) < 0) 
    return JamoClusterSearch(aKey, &(aClusters[l]), h - l);   
  else if (JamoNormMapComp (aKey, aClusters[h]) > 0) 
    return JamoClusterSearch(aKey, &(aClusters[h + 1]), u - h);   
  else
    return aClusters + h;

}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult JamoNormalize ( const PRUnichar aInSeq,
PRUnichar **  aOutSeq,
PRInt32 aLength 
) [static]

Definition at line 922 of file nsUnicodeToJamoTTF.cpp.

{
  if (!aInSeq || !aOutSeq || *aLength <= 0)
    return NS_ERROR_INVALID_ARG;

  // 4 more slots : 2 for Lf and Vf, 2 for decomposing a modern precomposed 
  // syllable into a Jamo sequence of LVT?. 
  *aOutSeq = new PRUnichar[*aLength + 4]; 
  if (!*aOutSeq)
    return NS_ERROR_OUT_OF_MEMORY;
  memcpy(*aOutSeq, aInSeq, *aLength * sizeof(PRUnichar));

  nsresult rv = ScanDecomposeSyllable(*aOutSeq, aLength, *aLength + 4);
  NS_ENSURE_SUCCESS(rv, rv);

  // LV or LVT : no need to search for and replace jamo sequences 
  if ((*aLength == 2 && IS_LC((*aOutSeq)[0]) && IS_VO((*aOutSeq)[1])) || 
      (*aLength == 3 && IS_LC((*aOutSeq)[0]) && IS_VO((*aOutSeq)[1]) && 
      IS_TC((*aOutSeq)[2])))
    return NS_OK;

  // remove Lf in LfL sequence that may occur in an interim cluster during
  // a simple Xkb-based input. 
  if ((*aOutSeq)[0] == LFILL && *aLength > 1 && IS_LC((*aOutSeq)[1]))
  {
    memmove (*aOutSeq, *aOutSeq + 1, (*aLength - 1) * sizeof(PRUnichar)); 
    (*aLength)--;
  }

  if (*aLength > 1)
  {
    JamoSrchReplace (gJamoClustersGroup1,
        sizeof(gJamoClustersGroup1) / sizeof(gJamoClustersGroup1[0]), 
        *aOutSeq, aLength, LBASE);
    JamoSrchReplace (gJamoClustersGroup234,
        sizeof(gJamoClustersGroup234) / sizeof(gJamoClustersGroup234[0]), 
        *aOutSeq, aLength, LBASE);
  }

  // prepend a leading V with Lf 
  if (IS_VO((*aOutSeq)[0])) 
  {
     memmove(*aOutSeq + 1, *aOutSeq, *aLength * sizeof(PRUnichar));
    (*aOutSeq)[0] = LFILL;
    (*aLength)++;
  }
  /* prepend a leading T with LfVf */
  else if (IS_TC((*aOutSeq)[0])) 
  {
    memmove (*aOutSeq + 2, *aOutSeq, *aLength * sizeof(PRUnichar));
    (*aOutSeq)[0] = LFILL;
    (*aOutSeq)[1] = VFILL;
    *aLength += 2;
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 JamoNormMapComp ( const JamoNormMap p1,
const JamoNormMap p2 
) [static]

Definition at line 771 of file nsUnicodeToJamoTTF.cpp.

{
  if (p1.seq[0] != p2.seq[0]) 
    return p1.seq[0] - p2.seq[0];
  if (p1.seq[1] != p2.seq[1]) 
    return p1.seq[1] - p2.seq[1];
  return p1.seq[2] - p2.seq[2];
}

Here is the caller graph for this function:

PRInt16 JamoSrchReplace ( const JamoNormMap aCluster,
PRUint16  aSize,
PRUnichar aIn,
PRInt32 aLength,
PRUint16  aOffset 
) [static]

Definition at line 822 of file nsUnicodeToJamoTTF.cpp.

{
  PRInt32 origLen = *aLength; 

  // non-zero third element => clusternLen = 3. otherwise, it's 2.
  PRUint16 clusterLen = aClusters[0].seq[2] ? 3 : 2; 

  PRInt32 start = 0, end;

  // identify the substring of aIn with values in [aOffset, aOffset + 0x100).
  while (start < origLen && (aIn[start] & 0xff00) != aOffset)
    ++start;
  for (end=start; end < origLen && (aIn[end] & 0xff00) == aOffset; ++end);

  // now process the substring aIn[start] .. aIn[end] 
  // we don't need a separate range check here because the one in 
  // for-loop is sufficient.
  for (PRInt32 i = start; i <= end - clusterLen; i++)
  {
    const JamoNormMap *match;
    JamoNormMap key;

    // cluster array is made up of PRUint8's to save memory
    // and we have to subtract aOffset from the input before looking it up.
    key.seq[0] = aIn[i] - aOffset;
    key.seq[1] = aIn[i + 1] - aOffset;
    key.seq[2] = clusterLen == 3 ? (aIn[i + 2] - aOffset) : 0;

    match = JamoClusterSearch (key, aClusters, aClustersSize);

    if (match) 
    {
      aIn[i] = match->liga + aOffset; // add back aOffset. 

      // move up the 'tail'
      for (PRInt32 j = i + clusterLen ; j < *aLength; j++)
        aIn[j - clusterLen + 1] = aIn[j];

      end -= (clusterLen - 1);
      *aLength -= (clusterLen - 1);
    }
  }

  return *aLength - origLen;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void JamosToExtJamos ( PRUnichar aInSeq,
PRInt32 aLength 
) [static]

Definition at line 990 of file nsUnicodeToJamoTTF.cpp.

{
  // translate jamo code points to temporary code points in PUA
  for (PRInt32 i = 0; i < *aLength; i++)
  {
    if (IS_LC(aInSeq[i]))
      aInSeq[i] += LC_OFFSET;
    else if (IS_VO(aInSeq[i]))
      aInSeq[i] += VO_OFFSET;
    else if (IS_TC(aInSeq[i]))
      aInSeq[i] += TC_OFFSET;
  }

  // LV or LVT : no need to search for and replace jamo sequences 
  if ((*aLength == 2 && IS_LC_EXT(aInSeq[0]) && IS_VO_EXT(aInSeq[1])) || 
      (*aLength == 3 && IS_LC_EXT(aInSeq[0]) && IS_VO_EXT(aInSeq[1]) && 
       IS_TC_EXT(aInSeq[2])))
    return;

  // replace a sequence of Jamos with the corresponding precomposed 
  // Jamo cluster in PUA 
    
  JamoSrchReplace (gExtLcClustersGroup1, 
      sizeof (gExtLcClustersGroup1) / sizeof (gExtLcClustersGroup1[0]), 
      aInSeq, aLength, LC_TMPPOS); 
  JamoSrchReplace (gExtLcClustersGroup2,
       sizeof (gExtLcClustersGroup2) / sizeof (gExtLcClustersGroup2[0]), 
       aInSeq, aLength, LC_TMPPOS);
  JamoSrchReplace (gExtVoClustersGroup1,
       sizeof (gExtVoClustersGroup1) / sizeof (gExtVoClustersGroup1[0]), 
       aInSeq, aLength, VO_TMPPOS);
  JamoSrchReplace (gExtVoClustersGroup2, 
       sizeof (gExtVoClustersGroup2) / sizeof (gExtVoClustersGroup2[0]), 
       aInSeq, aLength, VO_TMPPOS);
  JamoSrchReplace (gExtTcClustersGroup1, 
       sizeof (gExtTcClustersGroup1) / sizeof (gExtTcClustersGroup1[0]), 
       aInSeq, aLength, TC_TMPPOS);
  JamoSrchReplace (gExtTcClustersGroup2, 
       sizeof (gExtTcClustersGroup2) / sizeof (gExtTcClustersGroup2[0]), 
       aInSeq, aLength, TC_TMPPOS);
    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult ScanDecomposeSyllable ( PRUnichar aIn,
PRInt32 aLength,
const PRInt32  aMaxLen 
) [static]

Definition at line 871 of file nsUnicodeToJamoTTF.cpp.

{
  nsresult rv = NS_OK;

  if (!aIn || *aLength < 1 || maxLength < *aLength + 2)
    return NS_ERROR_INVALID_ARG;

  PRInt32 i = 0;
  while (i < *aLength && !IS_SYL(aIn[i]))
    i++;

  // Convert a precomposed syllable to an LV or LVT sequence.
  if (i < *aLength && IS_SYL(aIn[i]))
  {
    PRUint16 j = IS_SYL_WITH_TC(aIn[i]) ? 1 : 0; 
    aIn[i] -= SBASE;
    memmove(aIn + i + 2 + j, aIn + i + 1, *aLength - i - 1);
    if (j)
      aIn[i + 2] = aIn[i] % TCOUNT + TBASE;
    aIn[i + 1] = (aIn[i] / TCOUNT) % VCOUNT + VBASE;
    aIn[i] = aIn[i] / (TCOUNT * VCOUNT) + LBASE;
    *aLength += 1 + j;
  }

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 137 of file nsUnicodeToJamoTTF.cpp.

Initial value:
 
{
  { 0, 0, 1, 0, 0, 0, 1 }, 
  { 1, 0, 0, 1, 1, 0, 1 }, 
  { 1, 1, 0, 1, 1, 0, 1 }, 
  { 1, 0, 0, 1, 1, 0, 1 }, 
  { 1, 1, 0, 1, 1, 0, 1 }, 
  { 1, 1, 1, 1, 1, 0, 1 }, 
  { 1, 1, 1, 1, 1, 0, 1 }  
}

Definition at line 213 of file nsUnicodeToJamoTTF.cpp.

Initial value:
 {
  1,  2,  4, 12, 14, 20, 36, 42, 46, 62, 70, 85,100,102,108,113,
114,116,120,  5,  6,  7,  8, 13, 23, 26, 34, 35, 39, 41, 43, 44,
 45, 47, 48, 49, 50, 51, 52, 54, 55, 57, 58, 60, 61, 63, 64, 65,
 66, 67, 68, 69, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
 84, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 99,101,104,105,
106,107,109,110,111,112,117,119,122,123,  0,  0,  0,  0,  0,  0,
  3,  9, 10, 11, 15, 16, 17, 18, 19, 21, 22, 24, 25, 27, 28, 29,
 30, 31, 32, 33, 37, 38, 40, 53, 56, 59, 71, 88, 98,103,115,118,
121, 124
}

Copied from mslvt.otp by Jin-Hwan Cho chofc.nosp@m.hof@.nosp@m.ktug..nosp@m.or.k.nosp@m.r.

Extended by Jungshik Shin jshin.nosp@m.@mai.nosp@m.laps..nosp@m.org to support additional Jamo clusters not encoded in U+1100 Jamo block as precomposed Jamo clsuters. Corrected by Won-Kyu Park wkpar.nosp@m.k@ch.nosp@m.em.sk.nosp@m.ku.a.nosp@m.c.kr. See http://www.ktug.or.kr for its use in Lambda and swindow/SFontTTF.cpp at http://www.yudit.org for its use in Yudit. A patch with the same set of tables was submitted for inclusion in Pango (http://www.pango.org). Mapping from LC code points to glyph indices in UnPark fonts. UnPark fonts have the same glyph arrangement as Ogulim font, but they have them in BMP PUA (beginning at U+E000) to be proper Unicode fonts unlike Ogulim font with Jamo glyphs in CJK ideograph code points. Glyph indices for 90 LCs encoded in U+1100 block are followed by 6 reserved code points and glyph indices for 34 additional consonant clusters (not assigned code points of their own) for which separate glyphs exist in UnPark fonts. The first element is for Kiyeok and UP_LBASE is set to Lfill glyph(0xe000) so that the first element is '1' to map it to glyph for Kiyeok at 0xe006. (there are six glyphs for each LC in UnPark fonts.)

Definition at line 410 of file nsUnicodeToJamoTTF.cpp.

Initial value:
 {
   0,  1,  5, 10, 17, 20, 21, 32, 33, 42, 46, 52, 57, 58, 59, 63,
  78, 84, 91, 98,109,123,127,128,129,130,135,  3,  6, 11, 13, 15,
  16, 19, 22, 25, 35, 37, 38, 39, 40, 43, 44, 48, 50, 51, 53, 54,
  56, 60, 64, 67, 69, 71, 72, 73, 75, 76, 77, 80, 88, 89, 90, 92,
  93, 94, 96,106,110,111,114,115,117,119,120,131,134,136,137,138,
 139,140,  2,  4,  7,  8,  9, 12, 14, 18, 23, 24, 26, 27, 28, 29,
  30, 31, 34, 36, 41, 45, 47, 49, 55, 61, 62, 65, 66, 68, 70, 74,
  79, 81, 82, 83, 85, 86, 87, 95, 97, 99,100,101,102,103,104,105,
 107,108,112,113,116,118,121,122,124,125,126,132,133
}

Mapping from TC code points to glyph indices in UnPark/Oxxx font.

glyphs for 59 additional trailing consonant clusters (not given separate code points in U+1100 blocks) are available in O*ttf fonts. Total count: 141 = 82 (in U+1100 block) + 59 (extra.) The first element is Kiyeok and UP_TBASE is set to 0x5204 (Kiyeok).

Definition at line 444 of file nsUnicodeToJamoTTF.cpp.

Initial value:
 {
  0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 2, 2, 1,
  1, 1, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1,
  1, 1, 1, 2, 1, 2, 2, 1, 0, 0, 1, 1, 1, 0, 2, 1,
  2, 1, 2, 1, 1, 0, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1,
  2, 1, 1, 1, 2, 1, 0, 0, 0, 1, 1, 1, 0, 2, 2
}

Definition at line 465 of file nsUnicodeToJamoTTF.cpp.

Initial value:
 {
  3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 4, 4, 5, 5, 4,
  4, 4, 5, 5, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  4, 4, 5, 5, 4, 4, 4, 5, 4, 4, 4, 4, 4, 5, 4, 4,
  4, 4, 4, 5, 4, 5, 5, 4, 3, 3, 4, 4, 4, 3, 5, 4,
  5, 4, 5, 4, 4, 3, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4,
  5, 4, 4, 4, 5, 4, 3, 3, 3, 4, 4, 4, 3, 5, 5
}

Definition at line 476 of file nsUnicodeToJamoTTF.cpp.

Initial value:
 {
  3, 0, 2, 0, 2, 1, 2, 1, 2, 3, 0, 2, 1, 3, 3, 1,
  2, 1, 3, 3, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
  2, 2, 3, 3, 0, 2, 1, 3, 1, 0, 2, 1, 2, 3, 0, 1,
  2, 1, 2, 3, 1, 3, 3, 1, 2, 2, 1, 1, 1, 1, 3, 1,
  3, 1, 3, 0, 1, 0, 0, 0, 2, 3, 0, 2, 1, 1, 2, 2,
  3, 0, 0, 0, 3, 0, 2, 2, 2, 1, 0, 1, 2, 1, 1
}

Definition at line 489 of file nsUnicodeToJamoTTF.cpp.

Initial value:
 {
   0,  1,  5,  6, 10, 11, 15, 16, 20, 21, 22, 23, 33, 34, 43, 46, 
  48, 52, 54, 64, 71, 73,  2,  3,  7,  8, 12, 13, 14, 18, 19, 26, 
  27, 29, 30, 32, 37, 38, 40, 41, 42, 44, 45, 47, 50, 51, 55, 57, 
  58, 59, 60, 62, 63, 69, 70, 72, 74, 75, 80, 83, 85, 87, 88, 90, 
  92, 93, 94,  4,  9, 17, 24, 25, 28, 31, 35, 36, 39, 49, 53, 56, 
  61, 65, 66, 67, 68, 76, 77, 78, 79, 81, 82, 84, 86, 89, 91
}

Mapping from vowel code points to glyph indices in UnPark/Oxxx font.

Glyphs for 28 additional vowel clusters (not given separate code points in U+1100 block) are available in O*ttf fonts. Total count: 95 = 1(Vfill) + 66 (in U+1100 block) + 28 (extra.)

Definition at line 428 of file nsUnicodeToJamoTTF.cpp.