Back to index

lightning-sunbird  0.9+nobinonly
Classes | Typedefs | Functions | Variables
nsUnicodeFontMappingMac.cpp File Reference
#include <Script.h>
#include "nsDeviceContextMac.h"
#include "plhash.h"
#include "nsCRT.h"
#include "nsUnicodeFontMappingMac.h"
#include "nsUnicodeFontMappingCache.h"
#include "nsUnicodeMappingUtil.h"
#include "nsIUnicodeEncoder.h"
#include "nsCompressedCharMap.h"
#include "nsMacUnicodeFontInfo.h"
#include <UnicodeConverter.h>
#include "ignorable.x-ccmap"

Go to the source code of this file.

Classes

class  nsUnicodeFontMappingEntry
struct  MyFontEnumData

Typedefs

typedef nsUnicodeBlock(* getUnicodeBlock )(PRUnichar aChar)

Functions

 DEFINE_X_CCMAP (gIgnorableCCMapExt,)
static UnicodeToTextInfo GetConverterByScript (ScriptCode sc)
static void FillVarBlockToScript (PRInt8 script, PRInt8 *aMap)
static nsUnicodeBlock GetBlockU0XXX (PRUnichar aChar)
static nsUnicodeBlock GetBlockU1XXX (PRUnichar aChar)
static nsUnicodeBlock GetBlockU2XXX (PRUnichar aChar)
static nsUnicodeBlock GetBlockU3XXX (PRUnichar aChar)
static nsUnicodeBlock GetBlockCJKIdeographs (PRUnichar aChar)
static nsUnicodeBlock GetBlockHangul (PRUnichar aChar)
static nsUnicodeBlock GetBlockUAXXX (PRUnichar aChar)
static nsUnicodeBlock GetBlockUDXXX (PRUnichar aChar)
static nsUnicodeBlock GetBlockUEXXX (PRUnichar aChar)
static nsUnicodeBlock GetBlockUFXXX (PRUnichar aChar)

Variables

static UnicodeToTextInfo gConverters [32]
const PRUnichar kA = PRUnichar('A')
const PRUnichar kZ = PRUnichar('Z')
const PRUnichar ka = PRUnichar('a')
const PRUnichar kz = PRUnichar('z')
const PRUnichar kComma = PRUnichar(',')
const PRUnichar kUnderline = PRUnichar('_')
const PRUnichar kSpace = PRUnichar(' ')
const PRUnichar kNullCh = PRUnichar('\0')
static nsUnicodeBlock gU0xxxMap [32]
static getUnicodeBlock gAllGetBlock [16]

Typedef Documentation

Definition at line 680 of file nsUnicodeFontMappingMac.cpp.


Function Documentation

DEFINE_X_CCMAP ( gIgnorableCCMapExt  )
static void FillVarBlockToScript ( PRInt8  script,
PRInt8 *  aMap 
) [static]
static nsUnicodeBlock GetBlockCJKIdeographs ( PRUnichar  aChar) [static]

Definition at line 624 of file nsUnicodeFontMappingMac.cpp.

{
  return  kCJKIdeographs;
}
static nsUnicodeBlock GetBlockHangul ( PRUnichar  aChar) [static]

Definition at line 630 of file nsUnicodeFontMappingMac.cpp.

{
  return  kHangul;
}
static nsUnicodeBlock GetBlockU0XXX ( PRUnichar  aChar) [static]

Definition at line 574 of file nsUnicodeFontMappingMac.cpp.

{
 nsUnicodeBlock res = gU0xxxMap[ (aChar >> 7) & 0x1F];
 if(res == kOthers) {
   if((0x0200 <= aChar) && ( aChar <= 0x024F ))           res =  kLatin;
   else if((0x0370 <= aChar) && ( aChar <= 0x037F ))      res =  kGreek;
   else if((0x0580 <= aChar) && ( aChar <= 0x058F ))      res =  kArmenian;
   else if((0x0590 <= aChar) && ( aChar <= 0x05ff ))      res =  kHebrew;
 } 
 return res;
}
static nsUnicodeBlock GetBlockU1XXX ( PRUnichar  aChar) [static]

Definition at line 587 of file nsUnicodeFontMappingMac.cpp.

{
  switch( aChar & 0x0F00 )
  {
     case 0x0000: return kGeorgian;
     case 0x0100: return kHangul;
     case 0x0e00: return kLatin;
     case 0x0f00: return kGreek;
     default:   
     {
       if ((0x0200 <= aChar) && ( aChar <= 0x037c)) return kEthiopic;
       if ((0x0400 <= aChar) && ( aChar <= 0x0676)) return kCanadian;
       if ((0x0780 <= aChar) && ( aChar <= 0x07ff)) return kKhmer;
       return kOthers;
     }
  }
}
static nsUnicodeBlock GetBlockU2XXX ( PRUnichar  aChar) [static]

Definition at line 606 of file nsUnicodeFontMappingMac.cpp.

{
  return kOthers;
}
static nsUnicodeBlock GetBlockU3XXX ( PRUnichar  aChar) [static]

Definition at line 612 of file nsUnicodeFontMappingMac.cpp.

{
  if(aChar < 0x3040)        return kCJKMisc;
  else if(aChar < 0x3100)   return kHiraganaKatakana; 
  else if(aChar < 0x3130)   return kBopomofo; 
  else if(aChar < 0x3190)   return kHangul; 
  else if(aChar >= 0x3400)  return kCJKIdeographs; // Unicode 3.0
  else                      return kCJKMisc;
}
static nsUnicodeBlock GetBlockUAXXX ( PRUnichar  aChar) [static]

Definition at line 636 of file nsUnicodeFontMappingMac.cpp.

{
  if(aChar < 0xAC00) return  kOthers;
  else               return  kHangul;
}
static nsUnicodeBlock GetBlockUDXXX ( PRUnichar  aChar) [static]

Definition at line 643 of file nsUnicodeFontMappingMac.cpp.

{
  if(aChar < 0xD800) return  kHangul;
  else               return  kOthers;
}
static nsUnicodeBlock GetBlockUEXXX ( PRUnichar  aChar) [static]

Definition at line 650 of file nsUnicodeFontMappingMac.cpp.

{
  return  kOthers;
}
static nsUnicodeBlock GetBlockUFXXX ( PRUnichar  aChar) [static]

Definition at line 656 of file nsUnicodeFontMappingMac.cpp.

{
  // U+FFxx is used more frequently in the U+Fxxxx block
  if(aChar >= 0xff00) 
  {
    if(aChar < 0xff60)           return kCJKMisc;
    else if(aChar < 0xffA0)      return kHiraganaKatakana;
    else if(aChar < 0xffe0)      return kHangul;
    else                         return kOthers;    
  }

  // The rest is rarely used, we don't care the performance below.
  if((0xf780 <= aChar) && (aChar <= 0xf7ff)) return kUserDefinedEncoding;
  else if(aChar < 0xf900)        return kOthers;
  else if(aChar < 0xfb00)        return kCJKIdeographs;
  else if(aChar < 0xfb10)        return kLatin;
  else if(aChar < 0xfb18)        return kArmenian;
  else if(aChar < 0xfb50)        return kHebrew;
  else if(aChar < 0xfe20)        return kArabic;
  else if(aChar < 0xfe70)        return kOthers;
  else                           return kArabic;
}
static UnicodeToTextInfo GetConverterByScript ( ScriptCode  sc) [static]

Definition at line 65 of file nsUnicodeFontMappingMac.cpp.

{
  // because the Mac QuickDraw BIDI support are quite different from other platform
  // we try not to use them and use the XP BIDI feature
  // those text will be drawn by ATSUI intead one character at a time
  if ((sc == smArabic) || (sc == smHebrew))
     return nsnull;
  NS_PRECONDITION(sc < 32, "illegal script id");
  if(sc >= 32)
    return nsnull;
  if (gConverters[sc] != nsnull) {
    return gConverters[sc];
  }
  OSStatus err = noErr;
    
  //
  TextEncoding scriptEncoding;
  err = ::UpgradeScriptInfoToTextEncoding(sc, kTextLanguageDontCare, kTextRegionDontCare, nsnull, &scriptEncoding);
  if ( noErr == err ) 
         err = ::CreateUnicodeToTextInfoByEncoding(scriptEncoding, &gConverters[sc] );

  if (noErr != err) 
    gConverters[sc] = nsnull;
  return gConverters[sc];
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

UnicodeToTextInfo gConverters[32] [static]
nsUnicodeBlock gU0xxxMap[32] [static]

Definition at line 334 of file nsUnicodeFontMappingMac.cpp.

Definition at line 336 of file nsUnicodeFontMappingMac.cpp.

Definition at line 338 of file nsUnicodeFontMappingMac.cpp.

Definition at line 341 of file nsUnicodeFontMappingMac.cpp.

Definition at line 340 of file nsUnicodeFontMappingMac.cpp.

Definition at line 339 of file nsUnicodeFontMappingMac.cpp.

Definition at line 335 of file nsUnicodeFontMappingMac.cpp.

Definition at line 337 of file nsUnicodeFontMappingMac.cpp.