Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
nsUnicodeRenderingToolkit.cpp File Reference
#include "nsUnicodeRenderingToolkit.h"
#include "nsUnicodeFontMappingMac.h"
#include "nsUnicodeFallbackCache.h"
#include "nsDrawingSurfaceMac.h"
#include "nsTransform2D.h"
#include "nsFontMetricsMac.h"
#include "nsGraphicState.h"
#include "prprf.h"
#include "nsCarbonHelpers.h"
#include "nsISaveAsCharset.h"
#include "nsIComponentManager.h"
#include "nsUnicharUtils.h"
#include "nsMacUnicodeFontInfo.h"
#include "nsICharRepresentable.h"
#include <FixMath.h>

Go to the source code of this file.

Defines

#define STACK_TRESHOLD   1000
#define IS_FORMAT_CONTROL_CHARS(c)   ((0x2000==((c)&0xFFF0))||(0x2028==((c)&0xFFF8)))
#define IS_CONTEXTUAL_CHARS(c)   ((0x0600<=(c))&&((c)<0x1000))
#define IS_COMBINING_CHARS(c)   ((0x0300<=(c))&&((c)<0x0370))
#define QUESTION_FALLBACKSIZE   9
#define UPLUS_FALLBACKSIZE   9
#define IN_RANGE(c, l, h)   (((l) <= (c)) && ((c) <= (h)))
#define IN_STANDARD_MAC_ROMAN_FONT(c)
#define IN_SYMBOL_FONT(c)
#define SPECIAL_IN_SYMBOL_FONT(c)
#define BAD_TEXT_ENCODING   0xFFFFFFFF
#define IS_ZERO_WIDTH_CHAR(c)
#define IN_ARABIC_PRESENTATION_A(a)   ((0xfb50 <= (a)) && ((a) <= 0xfdff))
#define IN_ARABIC_PRESENTATION_B(a)   ((0xfe70 <= (a)) && ((a) <= 0xfeff))
#define IN_ARABIC_PRESENTATION_A_OR_B(a)   (IN_ARABIC_PRESENTATION_A(a) || IN_ARABIC_PRESENTATION_B(a))
#define IS_LATIN(c)   ( IN_RANGE(c, 0x0000, 0x024F) || IN_RANGE(c, 0x1e00, 0x1eff) )
#define IS_GREEK(c)   ( IN_RANGE(c, 0x0370, 0x03FF) || IN_RANGE(c, 0x1f00, 0x1fff) )
#define IS_CYRILLIC(c)   IN_RANGE(c, 0x0400, 0x04ff)
#define IS_SKIP_TEC_FALLBACK(c)   (IS_LATIN(c) || IS_GREEK(c) || IS_CYRILLIC(c))
#define CAN_DO_PRECOMPOSE_HANGUL(u, f)   ((0xAC00<=(u)) && ((u)<=0xD7FF) && ((f) != BAD_FONT_NUM))
#define SBase   0xAC00
#define LCount   19
#define VCount   21
#define TCount   28
#define NCount   (VCount * TCount)

Functions

static NS_DEFINE_CID (kSaveAsCharsetCID, NS_SAVEASCHARSET_CID)
static nsresult FormAorBIsolated (PRUnichar aChar, nsMacUnicodeFontInfo &aInfo, PRUnichar *aOutChar)
static void UnicodePrecomposedHangulTo4EUCKR (PRUnichar in, char *out)
static void CCodeToMacRoman (char aIn, char &aOut, short aWidth, short aHeight, short &oXadj, short &oYadj)

Variables

static PRUnichar gSymbolReplacement [] = {0xf8ee,0xf8f9,0xf8f0,0xf8fb,0x3008,0x3009}
static const char question [] = "<?>"
static const char *const g1E00Dec = "UdnudnYG yG Yd yd YH yH YT yT "

Define Documentation

#define BAD_TEXT_ENCODING   0xFFFFFFFF

Definition at line 130 of file nsUnicodeRenderingToolkit.cpp.

#define CAN_DO_PRECOMPOSE_HANGUL (   u,
  f 
)    ((0xAC00<=(u)) && ((u)<=0xD7FF) && ((f) != BAD_FONT_NUM))

Definition at line 817 of file nsUnicodeRenderingToolkit.cpp.

#define IN_ARABIC_PRESENTATION_A (   a)    ((0xfb50 <= (a)) && ((a) <= 0xfdff))

Definition at line 139 of file nsUnicodeRenderingToolkit.cpp.

Definition at line 141 of file nsUnicodeRenderingToolkit.cpp.

#define IN_ARABIC_PRESENTATION_B (   a)    ((0xfe70 <= (a)) && ((a) <= 0xfeff))

Definition at line 140 of file nsUnicodeRenderingToolkit.cpp.

#define IN_RANGE (   c,
  l,
 
)    (((l) <= (c)) && ((c) <= (h)))

Definition at line 74 of file nsUnicodeRenderingToolkit.cpp.

Value:
( \
  (((c) < 0x180) && (! (\
   (0x0110 == (c)) || \
   (0x012c == (c)) || \
   (0x012d == (c)) || \
   (0x0138 == (c)) || \
   (0x014a == (c)) || \
   (0x014b == (c)) || \
   (0x017f == (c))    \
   ))))

Definition at line 75 of file nsUnicodeRenderingToolkit.cpp.

Definition at line 85 of file nsUnicodeRenderingToolkit.cpp.

#define IS_COMBINING_CHARS (   c)    ((0x0300<=(c))&&((c)<0x0370))

Definition at line 70 of file nsUnicodeRenderingToolkit.cpp.

#define IS_CONTEXTUAL_CHARS (   c)    ((0x0600<=(c))&&((c)<0x1000))

Definition at line 69 of file nsUnicodeRenderingToolkit.cpp.

#define IS_CYRILLIC (   c)    IN_RANGE(c, 0x0400, 0x04ff)

Definition at line 153 of file nsUnicodeRenderingToolkit.cpp.

#define IS_FORMAT_CONTROL_CHARS (   c)    ((0x2000==((c)&0xFFF0))||(0x2028==((c)&0xFFF8)))

Definition at line 68 of file nsUnicodeRenderingToolkit.cpp.

#define IS_GREEK (   c)    ( IN_RANGE(c, 0x0370, 0x03FF) || IN_RANGE(c, 0x1f00, 0x1fff) )

Definition at line 152 of file nsUnicodeRenderingToolkit.cpp.

#define IS_LATIN (   c)    ( IN_RANGE(c, 0x0000, 0x024F) || IN_RANGE(c, 0x1e00, 0x1eff) )

Definition at line 151 of file nsUnicodeRenderingToolkit.cpp.

Definition at line 154 of file nsUnicodeRenderingToolkit.cpp.

Value:
( \
  IN_RANGE(c, 0x200b, 0x200f) || \
  IN_RANGE(c, 0x202a, 0x202e) \
  )

Definition at line 133 of file nsUnicodeRenderingToolkit.cpp.

#define LCount   19

Definition at line 819 of file nsUnicodeRenderingToolkit.cpp.

Definition at line 822 of file nsUnicodeRenderingToolkit.cpp.

Definition at line 72 of file nsUnicodeRenderingToolkit.cpp.

#define SBase   0xAC00

Definition at line 818 of file nsUnicodeRenderingToolkit.cpp.

Value:
( \
  IN_RANGE(c, 0x2308, 0x230b) || \
  (0x2329 == (c))   || \
  (0x232a == (c))    \
  )

Definition at line 125 of file nsUnicodeRenderingToolkit.cpp.

#define STACK_TRESHOLD   1000

Definition at line 57 of file nsUnicodeRenderingToolkit.cpp.

#define TCount   28

Definition at line 821 of file nsUnicodeRenderingToolkit.cpp.

Definition at line 73 of file nsUnicodeRenderingToolkit.cpp.

#define VCount   21

Definition at line 820 of file nsUnicodeRenderingToolkit.cpp.


Function Documentation

static void CCodeToMacRoman ( char  aIn,
char &  aOut,
short  aWidth,
short  aHeight,
short &  oXadj,
short &  oYadj 
) [static]

Definition at line 1000 of file nsUnicodeRenderingToolkit.cpp.

{
       aOut = ' ';
       oXadj = oYadj = 0;
       switch(aIn)
       {
              case 'r' : aOut = '\xfb'; oYadj = aHeight * 5 / 6; break ;// # r - ring below
              case 'R' : aOut = '\xfb';                          break ;// # R - Ring Above
              case 'd' : aOut = '\xfa'; oYadj = aHeight * 5 / 6; break ;// # d - dot below
              case 'D' : aOut = '\xfa';                          break ;// # D - Dot Above
              case 'l' : aOut = '_';                             break ;// # l - line below
              case 'L' : aOut = '\xf8';                          break ;// # L - Line Above
              case 'c' : aOut = '\xfc';                          break ;// # c - cedilla
              case 'A' : aOut = '\xab';                          break ;// # A - Acute
              case 'x' : aOut = '\xf6'; oYadj= aHeight * 5 / 6;  break ;// # x - circumflex below
              case 'X' : aOut = '\xf6';                          break ;// # X - Circumflex Above
              case 'G' : aOut = '`';                             break ;// # G - Grave above
              case 'T' : aOut = '\xf7';                          break ;// # T - Tilde above
              case 't' : aOut = '\xf7'; oYadj= aHeight * 5 / 6;  break ;// # t - tilde below
              case 'B' : aOut = '\xf9';                          break ;// # B - Breve Above
              case 'b' : aOut = '\xf9'; oYadj= aHeight * 5 / 6;  break ;// # b - breve below
              case 'U' : aOut = '\xac';                          break ;// # U - Diaeresis Above
              case 'u' : aOut = '\xac'; oYadj= aHeight * 5 / 6;  break ;// # u - diaeresis below
              case 'H' : aOut = ',';    oYadj= - aHeight * 5 / 6;  break ;// # H - Hook Above 
              case 'n' : aOut = ',';    oYadj= - aHeight * 5 / 6;  oXadj = aWidth /4; break ;// # N - Horn Above
              default: NS_ASSERTION(0, "unknown ccode");
                      break;       
       }
}

Here is the caller graph for this function:

static nsresult FormAorBIsolated ( PRUnichar  aChar,
nsMacUnicodeFontInfo aInfo,
PRUnichar aOutChar 
) [static]

Definition at line 361 of file nsUnicodeRenderingToolkit.cpp.

{
  static const PRUnichar arabicisolated[]=
  {
    // start of form a
    0xFB50, 0x0671,  0xFB52, 0x067B,  0xFB56, 0x067E,  0xFB5A, 0x0680,  0xFB5E, 0x067A,
    0xFB62, 0x067F,  0xFB66, 0x0679,  0xFB6A, 0x06A4,  0xFB6E, 0x06A6,  0xFB72, 0x0684,
    0xFB76, 0x0683,  0xFB7A, 0x0686,  0xFB7E, 0x0687,  0xFB82, 0x068D,  0xFB84, 0x068C,
    0xFB86, 0x068E,  0xFB88, 0x0688,  0xFB8A, 0x0698,  0xFB8C, 0x0691,  0xFB8E, 0x06A9,
    0xFB92, 0x06AF,  0xFB96, 0x06B3,  0xFB9A, 0x06B1,  0xFB9E, 0x06BA,  0xFBA0, 0x06BB,
    0xFBA4, 0x06C0,  0xFBA6, 0x06C1,  0xFBAA, 0x06BE,  0xFBAE, 0x06D2,  0xFBB0, 0x06D3,
    0xFBD3, 0x06AD,  0xFBD7, 0x06C7,  0xFBD9, 0x06C6,  0xFBDB, 0x06C8,  0xFBDD, 0x0677,
    0xFBDE, 0x06CB,  0xFBE0, 0x06C5,  0xFBE2, 0x06C9,  0xFBE4, 0x06D0,  0xFBFC, 0x06CC,

    // start of form b
    0xFE70, 0x064B,  0xFE72, 0x064C,  0xFE74, 0x064D,  0xFE76, 0x064E,  0xFE78, 0x064F,
    0xFE7A, 0x0650,  0xFE7C, 0x0651,  0xFE7E, 0x0652,  0xFE80, 0x0621,  0xFE81, 0x0622,
    0xFE83, 0x0623,  0xFE85, 0x0624,  0xFE87, 0x0625,  0xFE89, 0x0626,  0xFE8D, 0x0627,
    0xFE8F, 0x0628,  0xFE93, 0x0629,  0xFE95, 0x062A,  0xFE99, 0x062B,  0xFE9D, 0x062C,
    0xFEA1, 0x062D,  0xFEA5, 0x062E,  0xFEA9, 0x062F,  0xFEAB, 0x0630,  0xFEAD, 0x0631,
    0xFEAF, 0x0632,  0xFEB1, 0x0633,  0xFEB5, 0x0634,  0xFEB9, 0x0635,  0xFEBD, 0x0636,
    0xFEC1, 0x0637,  0xFEC5, 0x0638,  0xFEC9, 0x0639,  0xFECD, 0x063A,  0xFED1, 0x0641,
    0xFED5, 0x0642,  0xFED9, 0x0643,  0xFEDD, 0x0644,  0xFEE1, 0x0645,  0xFEE5, 0x0646,
    0xFEE9, 0x0647,  0xFEED, 0x0648,  0xFEEF, 0x0649,  0xFEF1, 0x064A,
    0x0000
  };
  const PRUnichar* p;
  for ( p= arabicisolated; *p; p += 2) {
    if (aChar == *p) {
      if (aInfo.HasGlyphFor(*(p+1))) {
        *aOutChar = *(p+1);
        return NS_OK;
      }
    }
  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kSaveAsCharsetCID  ,
NS_SAVEASCHARSET_CID   
) [static]
static void UnicodePrecomposedHangulTo4EUCKR ( PRUnichar  in,
char *  out 
) [static]

Definition at line 823 of file nsUnicodeRenderingToolkit.cpp.

{
        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;
        /* 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;
              // somehow Apple's Korean font show glaph on A4D4 :( so we use '[' + L + V + T + ']' intead of 
              // Filler + L + V + T to display
              // output '['
              *out++ = '['; 
              // output L
              *out++ = 0xA4;
              *out++ = lMap[LIndex] ;
              // output V
              *out++ = 0xA4;
              *out++  = (VIndex + 0xbf);
              // output T
              *out++ = 0xA4;
              *out++ = tMap[TIndex] ;
              // output ']'
              *out++ = ']'; 
}

Here is the caller graph for this function:


Variable Documentation

const char* const g1E00Dec = "UdnudnYG yG Yd yd YH yH YT yT " [static]

Definition at line 965 of file nsUnicodeRenderingToolkit.cpp.

PRUnichar gSymbolReplacement[] = {0xf8ee,0xf8f9,0xf8f0,0xf8fb,0x3008,0x3009} [static]

Definition at line 357 of file nsUnicodeRenderingToolkit.cpp.

const char question[] = "<?>" [static]

Definition at line 645 of file nsUnicodeRenderingToolkit.cpp.