Home | History | Annotate | Download | only in text
      1 /*
      2  * Copyright (C) 2007 Apple Computer, Inc.
      3  *
      4  * Portions are Copyright (C) 1998 Netscape Communications Corporation.
      5  *
      6  * This library is free software; you can redistribute it and/or
      7  * modify it under the terms of the GNU Lesser General Public
      8  * License as published by the Free Software Foundation; either
      9  * version 2.1 of the License, or (at your option) any later version.
     10  *
     11  * This library is distributed in the hope that it will be useful,
     12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14  * Lesser General Public License for more details.
     15  *
     16  * You should have received a copy of the GNU Lesser General Public
     17  * License along with this library; if not, write to the Free Software
     18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
     19  *
     20  * Alternatively, the contents of this file may be used under the terms
     21  * of either the Mozilla Public License Version 1.1, found at
     22  * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
     23  * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
     24  * (the "GPL"), in which case the provisions of the MPL or the GPL are
     25  * applicable instead of those above.  If you wish to allow use of your
     26  * version of this file only under the terms of one of those two
     27  * licenses (the MPL or the GPL) and not to allow others to use your
     28  * version of this file under the LGPL, indicate your decision by
     29  * deletingthe provisions above and replace them with the notice and
     30  * other provisions required by the MPL or the GPL, as the case may be.
     31  * If you do not delete the provisions above, a recipient may use your
     32  * version of this file under any of the LGPL, the MPL or the GPL.
     33  */
     34 
     35 #ifndef UnicodeRange_H
     36 #define UnicodeRange_H
     37 
     38 #if PLATFORM(HAIKU)
     39 #include "stdint.h"
     40 #endif
     41 
     42 #include <wtf/unicode/Unicode.h>
     43 
     44 namespace WebCore {
     45 
     46 // The following constants define unicode subranges
     47 // values below cRangeNum must be continuous so that we can map to
     48 // a lang group directly.
     49 // All ranges we care about should fit within 32 bits.
     50 
     51 // Frequently used range definitions
     52 const unsigned char   cRangeCyrillic =    0;
     53 const unsigned char   cRangeGreek    =    1;
     54 const unsigned char   cRangeTurkish  =    2;
     55 const unsigned char   cRangeHebrew   =    3;
     56 const unsigned char   cRangeArabic   =    4;
     57 const unsigned char   cRangeBaltic   =    5;
     58 const unsigned char   cRangeThai     =    6;
     59 const unsigned char   cRangeKorean   =    7;
     60 const unsigned char   cRangeJapanese =    8;
     61 const unsigned char   cRangeSChinese =    9;
     62 const unsigned char   cRangeTChinese =   10;
     63 const unsigned char   cRangeDevanagari = 11;
     64 const unsigned char   cRangeTamil    =   12;
     65 const unsigned char   cRangeArmenian =   13;
     66 const unsigned char   cRangeBengali  =   14;
     67 const unsigned char   cRangeCanadian =   15;
     68 const unsigned char   cRangeEthiopic =   16;
     69 const unsigned char   cRangeGeorgian =   17;
     70 const unsigned char   cRangeGujarati =   18;
     71 const unsigned char   cRangeGurmukhi =   19;
     72 const unsigned char   cRangeKhmer    =   20;
     73 const unsigned char   cRangeMalayalam =  21;
     74 
     75 const unsigned char   cRangeSpecificItemNum = 22;
     76 
     77 //range/rangeSet grow to this place 22-29
     78 
     79 const unsigned char   cRangeSetStart  =  30;    // range set definition starts from here
     80 const unsigned char   cRangeSetLatin  =  30;
     81 const unsigned char   cRangeSetCJK    =  31;
     82 const unsigned char   cRangeSetEnd    =  31;   // range set definition ends here
     83 
     84 // less frequently used range definition
     85 const unsigned char   cRangeSurrogate            = 32;
     86 const unsigned char   cRangePrivate              = 33;
     87 const unsigned char   cRangeMisc                 = 34;
     88 const unsigned char   cRangeUnassigned           = 35;
     89 const unsigned char   cRangeSyriac               = 36;
     90 const unsigned char   cRangeThaana               = 37;
     91 const unsigned char   cRangeOriya                = 38;
     92 const unsigned char   cRangeTelugu               = 39;
     93 const unsigned char   cRangeKannada              = 40;
     94 const unsigned char   cRangeSinhala              = 41;
     95 const unsigned char   cRangeLao                  = 42;
     96 const unsigned char   cRangeTibetan              = 43;
     97 const unsigned char   cRangeMyanmar              = 44;
     98 const unsigned char   cRangeCherokee             = 45;
     99 const unsigned char   cRangeOghamRunic           = 46;
    100 const unsigned char   cRangeMongolian            = 47;
    101 const unsigned char   cRangeMathOperators        = 48;
    102 const unsigned char   cRangeMiscTechnical        = 49;
    103 const unsigned char   cRangeControlOpticalEnclose = 50;
    104 const unsigned char   cRangeBoxBlockGeometrics   = 51;
    105 const unsigned char   cRangeMiscSymbols          = 52;
    106 const unsigned char   cRangeDingbats             = 53;
    107 const unsigned char   cRangeBraillePattern       = 54;
    108 const unsigned char   cRangeYi                   = 55;
    109 const unsigned char   cRangeCombiningDiacriticalMarks = 56;
    110 const unsigned char   cRangeSpecials             = 57;
    111 
    112 const unsigned char   cRangeTableBase   = 128;    //values over 127 are reserved for internal use only
    113 const unsigned char   cRangeTertiaryTable  = 145; // leave room for 16 subtable
    114                                             // indices (cRangeTableBase + 1 ..
    115                                             // cRangeTableBase + 16)
    116 
    117 
    118 
    119 unsigned int findCharUnicodeRange(UChar32 ch);
    120 const char* langGroupFromUnicodeRange(unsigned char unicodeRange);
    121 
    122 }
    123 
    124 #endif // UnicodeRange_H
    125