mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
bug 180266 : hard-code precompiled CCMaps to speed up start-up.
r=shanjian, sr=alecf,rbs
This commit is contained in:
parent
939bb1e75c
commit
aac4dd7004
@ -67,7 +67,7 @@ extern PRUint16* CreateEmptyCCMap();
|
||||
extern PRUint16* MapToCCMap(PRUint32* aMap);
|
||||
extern PRUint16* MapperToCCMap(nsICharRepresentable *aMapper);
|
||||
extern void FreeCCMap(PRUint16* &aMap);
|
||||
extern PRBool NextNonEmptyCCMapPage(PRUint16 *, PRUint32 *);
|
||||
extern PRBool NextNonEmptyCCMapPage(const PRUint16 *, PRUint32 *);
|
||||
extern PRBool IsSameCCMap(PRUint16* ccmap1, PRUint16* ccmap2);
|
||||
#ifdef DEBUG
|
||||
void printCCMap(PRUint16* aCCMap);
|
||||
|
@ -627,42 +627,14 @@ atomToName(nsIAtom* aAtom)
|
||||
|
||||
static PRUint16* gUserDefinedCCMap = nsnull;
|
||||
static PRUint16* gEmptyCCMap = nsnull;
|
||||
static PRUint16* gDoubleByteSpecialCharsCCMap = nsnull;
|
||||
|
||||
//
|
||||
// smart quotes (and other special chars) in Asian (double byte)
|
||||
// fonts are too large to use is western fonts.
|
||||
// Here we define those characters.
|
||||
//
|
||||
static const PRUnichar gDoubleByteSpecialChars[] = {
|
||||
0x0152, /* LATIN CAPITAL LIGATURE OE */
|
||||
0x0153, /* LATIN SMALL LIGATURE OE */
|
||||
0x0160, /* LATIN CAPITAL LETTER S WITH CARON */
|
||||
0x0161, /* LATIN SMALL LETTER S WITH CARON */
|
||||
0x0178, /* LATIN CAPITAL LETTER Y WITH DIAERESIS */
|
||||
0x017D, /* LATIN CAPITAL LETTER Z WITH CARON */
|
||||
0x017E, /* LATIN SMALL LETTER Z WITH CARON */
|
||||
0x0192, /* LATIN SMALL LETTER F WITH HOOK */
|
||||
0x02C6, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
|
||||
0x02DC, /* SMALL TILDE */
|
||||
0x2013, /* EN DASH */
|
||||
0x2014, /* EM DASH */
|
||||
0x2018, /* LEFT SINGLE QUOTATION MARK */
|
||||
0x2019, /* RIGHT SINGLE QUOTATION MARK */
|
||||
0x201A, /* SINGLE LOW-9 QUOTATION MARK */
|
||||
0x201C, /* LEFT DOUBLE QUOTATION MARK */
|
||||
0x201D, /* RIGHT DOUBLE QUOTATION MARK */
|
||||
0x201E, /* DOUBLE LOW-9 QUOTATION MARK */
|
||||
0x2020, /* DAGGER */
|
||||
0x2021, /* DOUBLE DAGGER */
|
||||
0x2022, /* BULLET */
|
||||
0x2026, /* HORIZONTAL ELLIPSIS */
|
||||
0x2030, /* PER MILLE SIGN */
|
||||
0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
|
||||
0x203A, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
|
||||
0x20AC, /* EURO SIGN */
|
||||
0x2122, /* TRADE MARK SIGN */
|
||||
0
|
||||
static const PRUint16 gDoubleByteSpecialCharsCCMap[] = {
|
||||
#include "dbyte_special_chars.ccmap"
|
||||
};
|
||||
|
||||
|
||||
@ -849,7 +821,6 @@ FreeGlobals(void)
|
||||
}
|
||||
FreeCCMap(gUserDefinedCCMap);
|
||||
FreeCCMap(gEmptyCCMap);
|
||||
FreeCCMap(gDoubleByteSpecialCharsCCMap);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -893,15 +864,6 @@ InitGlobals(nsIDeviceContext *aDevice)
|
||||
if (NS_SUCCEEDED(rv))
|
||||
gAllowDoubleByteSpecialChars = val;
|
||||
|
||||
// setup the double byte font special chars glyph map
|
||||
nsCompressedCharMap specialchars_ccmapObj;
|
||||
for (int i=0; gDoubleByteSpecialChars[i]; i++) {
|
||||
specialchars_ccmapObj.SetChar(gDoubleByteSpecialChars[i]);
|
||||
}
|
||||
gDoubleByteSpecialCharsCCMap = specialchars_ccmapObj.NewCCMap();
|
||||
if (!gDoubleByteSpecialCharsCCMap)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRInt32 scale_minimum = 0;
|
||||
rv = gPref->GetIntPref("font.scale.outline.min", &scale_minimum);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
@ -2253,8 +2215,15 @@ SetUpFontCharSetInfo(nsFontCharSetInfo* aSelf)
|
||||
if ((aSelf->Convert == DoubleByteConvert)
|
||||
&& (!gAllowDoubleByteSpecialChars)) {
|
||||
PRUint16* ccmap = aSelf->mCCMap;
|
||||
for (int i=0; gDoubleByteSpecialChars[i]; i++) {
|
||||
CCMAP_UNSET_CHAR(ccmap, gDoubleByteSpecialChars[i]);
|
||||
PRUint32 page = CCMAP_BEGIN_AT_START_OF_MAP;
|
||||
const PRUint16* specialmap = gDoubleByteSpecialCharsCCMap;
|
||||
while (NextNonEmptyCCMapPage(specialmap, &page)) {
|
||||
PRUint32 pagechar = page;
|
||||
for (int i=0; i < CCMAP_BITS_PER_PAGE; i++) {
|
||||
if (CCMAP_HAS_CHAR(specialmap, pagechar))
|
||||
CCMAP_UNSET_CHAR(ccmap, pagechar);
|
||||
pagechar++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_TRUE;
|
||||
|
@ -111,13 +111,13 @@ MapperToCCMap(nsICharRepresentable *aMapper)
|
||||
}
|
||||
|
||||
PRBool
|
||||
NextNonEmptyCCMapPage(PRUint16* aCCMap, PRUint32 *aPageStart)
|
||||
NextNonEmptyCCMapPage(const PRUint16* aCCMap, PRUint32 *aPageStart)
|
||||
{
|
||||
int i, j, l;
|
||||
int planeend = 0;
|
||||
int planestart = 0;
|
||||
unsigned int k;
|
||||
PRUint16* ccmap;
|
||||
const PRUint16* ccmap;
|
||||
PRUint32 pagestart = *aPageStart;
|
||||
|
||||
if(CCMAP_FLAG(aCCMap) & CCMAP_SURROGATE_FLAG) {
|
||||
@ -154,20 +154,20 @@ NextNonEmptyCCMapPage(PRUint16* aCCMap, PRUint32 *aPageStart)
|
||||
}
|
||||
|
||||
// walk thru the upper pointers
|
||||
PRUint16 *upper = &ccmap[0];
|
||||
const PRUint16 *upper = &ccmap[0];
|
||||
for (i=upper_index; i<CCMAP_NUM_UPPER_POINTERS; i++, mid_index=0) {
|
||||
if (upper[i] == CCMAP_EMPTY_MID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// walk the mid array
|
||||
PRUint16 *mid = &ccmap[upper[i]];
|
||||
const PRUint16 *mid = &ccmap[upper[i]];
|
||||
for (j=mid_index; j<CCMAP_NUM_MID_POINTERS; j++) {
|
||||
if (mid[j] == CCMAP_EMPTY_PAGE)
|
||||
continue;
|
||||
|
||||
// walk the page
|
||||
ALU_TYPE *page = (ALU_TYPE*)&ccmap[mid[j]];
|
||||
const ALU_TYPE *page = (ALU_TYPE*)&ccmap[mid[j]];
|
||||
for (k=0; k<CCMAP_NUM_ALUS_PER_PAGE; k++) {
|
||||
if (page[k] != 0) {
|
||||
PRUint32 base = (i*CCMAP_NUM_UCHARS_PER_MID) + (j*CCMAP_NUM_UCHARS_PER_PAGE);
|
||||
|
@ -67,7 +67,7 @@ extern PRUint16* CreateEmptyCCMap();
|
||||
extern PRUint16* MapToCCMap(PRUint32* aMap);
|
||||
extern PRUint16* MapperToCCMap(nsICharRepresentable *aMapper);
|
||||
extern void FreeCCMap(PRUint16* &aMap);
|
||||
extern PRBool NextNonEmptyCCMapPage(PRUint16 *, PRUint32 *);
|
||||
extern PRBool NextNonEmptyCCMapPage(const PRUint16 *, PRUint32 *);
|
||||
extern PRBool IsSameCCMap(PRUint16* ccmap1, PRUint16* ccmap2);
|
||||
#ifdef DEBUG
|
||||
void printCCMap(PRUint16* aCCMap);
|
||||
|
204
gfx/src/windows/blank_glyph.ccmap
Executable file
204
gfx/src/windows/blank_glyph.ccmap
Executable file
@ -0,0 +1,204 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* Contributor(s): Jungshik Shin <jshin@mailaps.org> (Original developer)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*========================================================
|
||||
This file contains a precompiled CCMap for a class of Unicode
|
||||
characters (blank_glyph) to be identified quickly by Mozilla.
|
||||
It was generated by ccmapbin.pl which you can find under
|
||||
mozilla/intl/unicharutil/tools.
|
||||
|
||||
Enumerated below are characters included in the precompiled CCMap
|
||||
which is human-readable but not so human-friendly. If you
|
||||
needs to modify the list of characters belonging to "blank_glyph",
|
||||
you have to make a new file (with the name of your choice)
|
||||
listing characters (one character per line) you want to put
|
||||
into "blank_glyph" in the format
|
||||
|
||||
0xuuuu // comment
|
||||
|
||||
In addition, the input file can have the following optional lines that
|
||||
read
|
||||
|
||||
CLASS::blank_glyph
|
||||
DESCRIPTION:: description of a character class
|
||||
FILE:: mozilla source file to include output files
|
||||
|
||||
|
||||
Then, run the following in the current directory.
|
||||
|
||||
perl ccmapbin.pl input_file [blank_glyph]
|
||||
|
||||
which will generate blank_glyph.ccmap.
|
||||
|
||||
(see bug 180266 and bug 167136)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
CLASS:: blank_glyph
|
||||
|
||||
0X3000 : IDEOGRAPHIC SPACE
|
||||
0X3164 : HANGUL COMPATIBILITY JAMO FILLER
|
||||
0X00A0 : NO-BREAK SPACE
|
||||
0X0020 : SPACE
|
||||
0X115F : HANGUL LEADING CONSONANT FILLER
|
||||
0X1160 : HANGUL VOWEL FILLER
|
||||
0XFEFF : BYTE ORDER MARK^L
|
||||
0XFFA0 : HALFWIDTH HANGUL FILLER
|
||||
0XFFF9 : INTERLINEAR ANNOTATION ANCHOR
|
||||
0XFFFA : INTERLINEAR ANNOTATION SEPERATOR
|
||||
0XFFFB : INTERLINEAR ANNOTATION TERMINATOR
|
||||
0X2000 : EN QUAD
|
||||
0X2001 : EM QUAD
|
||||
0X2002 : EN SPACE
|
||||
0X2003 : EM SPACE
|
||||
0X2004 : THREE-PER-EM SPACE
|
||||
0X2005 : FOUR-PER-EM SPACE
|
||||
0X2006 : SIX-PER-EM SPACE
|
||||
0X2007 : FIGURE SPACE
|
||||
0X2008 : PUNCTUATION SPACE
|
||||
0X2009 : THIN SPACE
|
||||
0X200A : HAIR SPACE
|
||||
0X200B : ZERO WIDTH SPACE
|
||||
0X200C : ZERO WIDTH NON-JOINER
|
||||
0X200D : ZERO WIDTH JOINER
|
||||
0X200E : LEFT-TO-RIGHT MARK
|
||||
0X200F : RIGHT-TO-LEFT MARK
|
||||
0X202A : LEFT-TO-RIGHT EMBEDDING
|
||||
0X202B : RIGHT-TO-LEFT EMBEDDING
|
||||
0X202C : POP DIRECTIONAL FORMATTING
|
||||
0X202D : LEFT-TO-RIGHT OVERRIDE
|
||||
0X202E : RIGHT-TO-LEFT OVERRIDE
|
||||
0X202F : NARROW NO-BREAK SPACE
|
||||
*/
|
||||
|
||||
#if (defined(IS_LITTLE_ENDIAN) || ALU_SIZE == 16)
|
||||
// Precompiled CCMap for Big Endian(16bit)/Little Endian(16/32/64bit)
|
||||
/* 0000 */ 0x0030,0x0050,0x0070,0x0090,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x00C0,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0040,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0020,0x0060,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0060 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x8000,0x0001,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0070 */ 0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0080 */ 0xFFFF,0x0000,0xFC00,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0090 */ 0x00A0,0x00B0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00a0 */ 0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00b0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0010,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00c0 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x00D0,0x00E0,
|
||||
/* 00d0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x8000,
|
||||
/* 00e0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,0x0E00,
|
||||
#elif (ALU_SIZE == 32)
|
||||
// Precompiled CCMap for Big Endian(32bit)
|
||||
/* 0000 */ 0x0030,0x0050,0x0070,0x0090,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x00C0,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0040,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x0000,0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0020,0x0060,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0060 */ 0x0000,0x0000,0x0000,0x0000,0x8000,0x0000,0x0000,0x0001,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0070 */ 0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0080 */ 0x0000,0xFFFF,0x0000,0xFC00,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0090 */ 0x00A0,0x00B0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00a0 */ 0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00b0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0010,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00c0 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x00D0,0x00E0,
|
||||
/* 00d0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x8000,0x0000,
|
||||
/* 00e0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0001,0x0000,0x0000,0x0E00,0x0000,
|
||||
#elif (ALU_SIZE == 64)
|
||||
// Precompiled CCMap for Big Endian(64bit)
|
||||
/* 0000 */ 0x0030,0x0050,0x0070,0x0090,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x00C0,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0040,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0020,0x0060,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0060 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,0x8000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0070 */ 0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0080 */ 0x0000,0xFC00,0x0000,0xFFFF,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0090 */ 0x00A0,0x00B0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00a0 */ 0x0000,0x0000,0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00b0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0010,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00c0 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x00D0,0x00E0,
|
||||
/* 00d0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x8000,0x0000,0x0000,0x0000,
|
||||
/* 00e0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0001,0x0000,0x0000,0x0E00,0x0000,0x0000,0x0000,
|
||||
#else
|
||||
#error "We don't support this architecture."
|
||||
#endif
|
||||
|
@ -1347,7 +1347,17 @@ PLHashAllocOps fontmap_HashAllocOps = {
|
||||
fontmap_AllocEntry, fontmap_FreeEntry
|
||||
};
|
||||
|
||||
#define SHOULD_BE_SPACE_CHAR(ch) ((ch)==0x0020 || (ch)==0x00A0 || ((ch)>=0x2000 && ((ch)<=0x200B || (ch)==0x3000)))
|
||||
// See bug 167136. Characters included in the list (see one of included
|
||||
// files for the list) is the union of the set included in
|
||||
// SHOULD_BE_SPACE macro replaced by this list and the set compiled by
|
||||
// Keith Packard to use in fonts.conf of fontconfig package.
|
||||
// Some of this may not have to be here because they're filtered out before
|
||||
// reaching here. Needs further investigation.
|
||||
static const PRUint16 gCharsWithBlankGlyphCCMap[] = {
|
||||
#include "blank_glyph.ccmap"
|
||||
};
|
||||
|
||||
#define SHOULD_BE_SPACE_CHAR(ch) (CCMAP_HAS_CHAR(gCharsWithBlankGlyphCCMap,ch))
|
||||
|
||||
enum {
|
||||
eTTPlatformIDUnicode = 0,
|
||||
|
161
gfx/src/x11shared/dbyte_special_chars.ccmap
Executable file
161
gfx/src/x11shared/dbyte_special_chars.ccmap
Executable file
@ -0,0 +1,161 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* Contributor(s): Jungshik Shin <jshin@mailaps.org> (Original developer)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*========================================================
|
||||
This file contains a precompiled CCMap for a class of Unicode
|
||||
characters (dbyte_special_chars) to be identified quickly by Mozilla.
|
||||
It was generated by ccmapbin.pl which you can find under
|
||||
mozilla/intl/unicharutil/tools.
|
||||
|
||||
Enumerated below are characters included in the precompiled CCMap
|
||||
which is human-readable but not so human-friendly. If you
|
||||
needs to modify the list of characters belonging to "dbyte_special_chars",
|
||||
you have to make a new file (with the name of your choice)
|
||||
listing characters (one character per line) you want to put
|
||||
into "dbyte_special_chars" in the format
|
||||
|
||||
0xuuuu // comment
|
||||
|
||||
In addition, the input file can have the following optional lines that
|
||||
read
|
||||
|
||||
CLASS::dbyte_special_chars
|
||||
DESCRIPTION:: description of a character class
|
||||
FILE:: mozilla source file to include output files
|
||||
|
||||
|
||||
Then, run the following in the current directory.
|
||||
|
||||
perl ccmapbin.pl input_file [dbyte_special_chars]
|
||||
|
||||
which will generate dbyte_special_chars.ccmap.
|
||||
|
||||
(see bug 180266 and bug 167136)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
0X0152 : LATIN CAPITAL LIGATURE OE
|
||||
0X0153 : LATIN SMALL LIGATURE OE
|
||||
0X0160 : LATIN CAPITAL LETTER S WITH CARON
|
||||
0X0161 : LATIN SMALL LETTER S WITH CARON
|
||||
0X0178 : LATIN CAPITAL LETTER Y WITH DIAERESIS
|
||||
0X017D : LATIN CAPITAL LETTER Z WITH CARON
|
||||
0X017E : LATIN SMALL LETTER Z WITH CARON
|
||||
0X0192 : LATIN SMALL LETTER F WITH HOOK
|
||||
0X02C6 : MODIFIER LETTER CIRCUMFLEX ACCENT
|
||||
0X02DC : SMALL TILDE
|
||||
0X2013 : EN DASH
|
||||
0X2014 : EM DASH
|
||||
0X2018 : LEFT SINGLE QUOTATION MARK
|
||||
0X2019 : RIGHT SINGLE QUOTATION MARK
|
||||
0X201A : SINGLE LOW-9 QUOTATION MARK
|
||||
0X201C : LEFT DOUBLE QUOTATION MARK
|
||||
0X201D : RIGHT DOUBLE QUOTATION MARK
|
||||
0X201E : DOUBLE LOW-9 QUOTATION MARK
|
||||
0X2020 : DAGGER
|
||||
0X2021 : DOUBLE DAGGER
|
||||
0X2022 : BULLET
|
||||
0X2026 : HORIZONTAL ELLIPSIS
|
||||
0X2030 : PER MILLE SIGN
|
||||
0X2039 : SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
||||
0X203A : SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
||||
0X20AC : EURO SIGN
|
||||
0X2122 : TRADE MARK SIGN
|
||||
*/
|
||||
|
||||
#if (defined(IS_LITTLE_ENDIAN) || ALU_SIZE == 16)
|
||||
// Precompiled CCMap for Big Endian(16bit)/Little Endian(16/32/64bit)
|
||||
/* 0000 */ 0x0030,0x0010,0x0060,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0020,0x0040,0x0050,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x000C,0x0003,0x6100,
|
||||
0x0000,0x0004,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0040,0x1000,0x0000,0x0000,
|
||||
/* 0060 */ 0x0070,0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0070 */ 0x0000,0x7718,0x0047,0x0601,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x1000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0080 */ 0x0000,0x0000,0x0004,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
#elif (ALU_SIZE == 32)
|
||||
// Precompiled CCMap for Big Endian(32bit)
|
||||
/* 0000 */ 0x0030,0x0010,0x0060,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0020,0x0040,0x0050,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x0000,0x0000,0x0000,0x000C,0x0000,0x6100,0x0003,
|
||||
0x0004,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x1000,0x0040,0x0000,0x0000,
|
||||
/* 0060 */ 0x0070,0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0070 */ 0x7718,0x0000,0x0601,0x0047,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x1000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0080 */ 0x0000,0x0000,0x0000,0x0004,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
#elif (ALU_SIZE == 64)
|
||||
// Precompiled CCMap for Big Endian(64bit)
|
||||
/* 0000 */ 0x0030,0x0010,0x0060,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0020,0x0040,0x0050,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x0000,0x0000,0x0000,0x6100,0x0003,0x000C,0x0000,
|
||||
0x0000,0x0000,0x0004,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1000,0x0040,
|
||||
/* 0060 */ 0x0070,0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0070 */ 0x0601,0x0047,0x7718,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x1000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0080 */ 0x0000,0x0004,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
#else
|
||||
#error "We don't support this architecture."
|
||||
#endif
|
||||
|
@ -861,40 +861,12 @@ atomToName(nsIAtom* aAtom)
|
||||
//
|
||||
// smart quotes (and other special chars) in Asian (double byte)
|
||||
// fonts are too large to use is western fonts.
|
||||
// Here we define those characters.
|
||||
// To update the list, see one of files included below. (bug 180266)
|
||||
//
|
||||
static const PRUnichar gDoubleByteSpecialChars[] = {
|
||||
0x0152, /* LATIN CAPITAL LIGATURE OE */
|
||||
0x0153, /* LATIN SMALL LIGATURE OE */
|
||||
0x0160, /* LATIN CAPITAL LETTER S WITH CARON */
|
||||
0x0161, /* LATIN SMALL LETTER S WITH CARON */
|
||||
0x0178, /* LATIN CAPITAL LETTER Y WITH DIAERESIS */
|
||||
0x017D, /* LATIN CAPITAL LETTER Z WITH CARON */
|
||||
0x017E, /* LATIN SMALL LETTER Z WITH CARON */
|
||||
0x0192, /* LATIN SMALL LETTER F WITH HOOK */
|
||||
0x02C6, /* MODIFIER LETTER CIRCUMFLEX ACCENT */
|
||||
0x02DC, /* SMALL TILDE */
|
||||
0x2013, /* EN DASH */
|
||||
0x2014, /* EM DASH */
|
||||
0x2018, /* LEFT SINGLE QUOTATION MARK */
|
||||
0x2019, /* RIGHT SINGLE QUOTATION MARK */
|
||||
0x201A, /* SINGLE LOW-9 QUOTATION MARK */
|
||||
0x201C, /* LEFT DOUBLE QUOTATION MARK */
|
||||
0x201D, /* RIGHT DOUBLE QUOTATION MARK */
|
||||
0x201E, /* DOUBLE LOW-9 QUOTATION MARK */
|
||||
0x2020, /* DAGGER */
|
||||
0x2021, /* DOUBLE DAGGER */
|
||||
0x2022, /* BULLET */
|
||||
0x2026, /* HORIZONTAL ELLIPSIS */
|
||||
0x2030, /* PER MILLE SIGN */
|
||||
0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
|
||||
0x203A, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
|
||||
0x20AC, /* EURO SIGN */
|
||||
0x2122, /* TRADE MARK SIGN */
|
||||
0
|
||||
static const PRUint16 gDoubleByteSpecialCharsCCMap[] = {
|
||||
#include "dbyte_special_chars.ccmap"
|
||||
};
|
||||
|
||||
|
||||
|
||||
static PRBool
|
||||
FreeCharSetMap(nsHashKey* aKey, void* aData, void* aClosure)
|
||||
{
|
||||
@ -1034,7 +1006,7 @@ nsFontMetricsXlibContext::~nsFontMetricsXlibContext()
|
||||
}
|
||||
FreeCCMap(mUserDefinedCCMap);
|
||||
FreeCCMap(mEmptyCCMap);
|
||||
FreeCCMap(mDoubleByteSpecialCharsCCMap);
|
||||
PR_Free(mDoubleByteSpecialCharsCCMap);
|
||||
|
||||
/* Free memory allocated by |CopyFontCharSetMapXlib()| */
|
||||
if (mCharSetMap) {
|
||||
@ -1187,14 +1159,11 @@ nsFontMetricsXlibContext::Init(nsIDeviceContext *aDevice, PRBool aPrintermode)
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mAllowDoubleByteSpecialChars = val;
|
||||
|
||||
// setup the double byte font special chars glyph map
|
||||
nsCompressedCharMap specialchars_ccmapObj;
|
||||
for (int i=0; gDoubleByteSpecialChars[i]; i++) {
|
||||
specialchars_ccmapObj.SetChar(gDoubleByteSpecialChars[i]);
|
||||
}
|
||||
mDoubleByteSpecialCharsCCMap = specialchars_ccmapObj.NewCCMap();
|
||||
PRUint32 dbmapSize = sizeof(gDoubleByteSpecialCharsCCMap);
|
||||
mDoubleByteSpecialCharsCCMap = (PRUint16*)PR_Malloc(dbmapSize);
|
||||
if (!mDoubleByteSpecialCharsCCMap)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
memcpy(mDoubleByteSpecialCharsCCMap, gDoubleByteSpecialCharsCCMap, dbmapSize);
|
||||
|
||||
PRInt32 scale_minimum = 0;
|
||||
rv = mPref->GetIntPref("font.scale.outline.min", &scale_minimum);
|
||||
@ -2602,8 +2571,15 @@ SetUpFontCharSetInfo(nsFontMetricsXlibContext *aFmctx, nsFontCharSetInfoXlib* aS
|
||||
if ((aSelf->Convert == DoubleByteConvert)
|
||||
&& (!aFmctx->mAllowDoubleByteSpecialChars)) {
|
||||
PRUint16* ccmap = aSelf->mCCMap;
|
||||
for (int i=0; gDoubleByteSpecialChars[i]; i++) {
|
||||
CCMAP_UNSET_CHAR(ccmap, gDoubleByteSpecialChars[i]);
|
||||
PRUint32 page = CCMAP_BEGIN_AT_START_OF_MAP;
|
||||
const PRUint16* specialmap = aFmctx->mDoubleByteSpecialCharsCCMap;
|
||||
while (NextNonEmptyCCMapPage(specialmap, &page)) {
|
||||
PRUint32 pagechar = page;
|
||||
for (int i=0; i < CCMAP_BITS_PER_PAGE; i++) {
|
||||
if (CCMAP_HAS_CHAR(specialmap, pagechar))
|
||||
CCMAP_UNSET_CHAR(ccmap, pagechar);
|
||||
pagechar++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_TRUE;
|
||||
|
@ -111,13 +111,13 @@ MapperToCCMap(nsICharRepresentable *aMapper)
|
||||
}
|
||||
|
||||
PRBool
|
||||
NextNonEmptyCCMapPage(PRUint16* aCCMap, PRUint32 *aPageStart)
|
||||
NextNonEmptyCCMapPage(const PRUint16* aCCMap, PRUint32 *aPageStart)
|
||||
{
|
||||
int i, j, l;
|
||||
int planeend = 0;
|
||||
int planestart = 0;
|
||||
unsigned int k;
|
||||
PRUint16* ccmap;
|
||||
const PRUint16* ccmap;
|
||||
PRUint32 pagestart = *aPageStart;
|
||||
|
||||
if(CCMAP_FLAG(aCCMap) & CCMAP_SURROGATE_FLAG) {
|
||||
@ -154,20 +154,20 @@ NextNonEmptyCCMapPage(PRUint16* aCCMap, PRUint32 *aPageStart)
|
||||
}
|
||||
|
||||
// walk thru the upper pointers
|
||||
PRUint16 *upper = &ccmap[0];
|
||||
const PRUint16 *upper = &ccmap[0];
|
||||
for (i=upper_index; i<CCMAP_NUM_UPPER_POINTERS; i++, mid_index=0) {
|
||||
if (upper[i] == CCMAP_EMPTY_MID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// walk the mid array
|
||||
PRUint16 *mid = &ccmap[upper[i]];
|
||||
const PRUint16 *mid = &ccmap[upper[i]];
|
||||
for (j=mid_index; j<CCMAP_NUM_MID_POINTERS; j++) {
|
||||
if (mid[j] == CCMAP_EMPTY_PAGE)
|
||||
continue;
|
||||
|
||||
// walk the page
|
||||
ALU_TYPE *page = (ALU_TYPE*)&ccmap[mid[j]];
|
||||
const ALU_TYPE *page = (ALU_TYPE*)&ccmap[mid[j]];
|
||||
for (k=0; k<CCMAP_NUM_ALUS_PER_PAGE; k++) {
|
||||
if (page[k] != 0) {
|
||||
PRUint32 base = (i*CCMAP_NUM_UCHARS_PER_MID) + (j*CCMAP_NUM_UCHARS_PER_PAGE);
|
||||
|
@ -67,7 +67,7 @@ extern PRUint16* CreateEmptyCCMap();
|
||||
extern PRUint16* MapToCCMap(PRUint32* aMap);
|
||||
extern PRUint16* MapperToCCMap(nsICharRepresentable *aMapper);
|
||||
extern void FreeCCMap(PRUint16* &aMap);
|
||||
extern PRBool NextNonEmptyCCMapPage(PRUint16 *, PRUint32 *);
|
||||
extern PRBool NextNonEmptyCCMapPage(const PRUint16 *, PRUint32 *);
|
||||
extern PRBool IsSameCCMap(PRUint16* ccmap1, PRUint16* ccmap2);
|
||||
#ifdef DEBUG
|
||||
void printCCMap(PRUint16* aCCMap);
|
||||
|
@ -83,6 +83,8 @@
|
||||
|
||||
#include "nsILineIterator.h"
|
||||
|
||||
#include "nsCompressedCharMap.h"
|
||||
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
@ -4637,65 +4639,16 @@ nsTextFrame::EstimateNumChars(PRUint32 aAvailableWidth,
|
||||
PRUint32 estimatedNumChars = aAvailableWidth / aAverageCharWidth;
|
||||
return estimatedNumChars + estimatedNumChars / 20;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsPunctuationMark(PRUnichar aChar)
|
||||
{
|
||||
//The following table is generated by a method written by Ftang, see bug 54467.
|
||||
//In case we need to add or substract any character (for example, unicode standard got
|
||||
// updated), the character in table must be kept in strict ascending order
|
||||
static const PRUnichar PuncSet[] =
|
||||
{
|
||||
0x0021, 0x0022, 0x0023, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029,
|
||||
0x002A, 0x002C, 0x002E, 0x002F, 0x003A, 0x003B, 0x003F, 0x0040,
|
||||
0x005B, 0x005C, 0x005D, 0x007B, 0x007D, 0x00A1, 0x00B7, 0x00BF,
|
||||
0x0313, 0x037E, 0x0387, 0x055A, 0x055B, 0x055C, 0x055D, 0x055E,
|
||||
0x055F, 0x0589, 0x05BE, 0x05C0, 0x05C3, 0x05F3, 0x05F4, 0x060C,
|
||||
0x061B, 0x061F, 0x066A, 0x066B, 0x066C, 0x066D, 0x06D4, 0x0700,
|
||||
0x0701, 0x0702, 0x0703, 0x0704, 0x0705, 0x0706, 0x0707, 0x0708,
|
||||
0x0709, 0x070A, 0x070B, 0x070C, 0x070D, 0x0964, 0x0965, 0x0970,
|
||||
0x0DF4, 0x0E4F, 0x0E5A, 0x0E5B, 0x0F04, 0x0F05, 0x0F06, 0x0F07,
|
||||
0x0F08, 0x0F09, 0x0F0A, 0x0F0B, 0x0F0C, 0x0F0D, 0x0F0E, 0x0F0F,
|
||||
0x0F10, 0x0F11, 0x0F12, 0x0F3A, 0x0F3B, 0x0F3C, 0x0F3D, 0x0F85,
|
||||
0x104A, 0x104B, 0x104C, 0x104D, 0x104E, 0x104F, 0x10FB, 0x1361,
|
||||
0x1362, 0x1363, 0x1364, 0x1365, 0x1366, 0x1367, 0x1368, 0x166D,
|
||||
0x166E, 0x169B, 0x169C, 0x16EB, 0x16EC, 0x16ED, 0x17D4, 0x17D5,
|
||||
0x17D6, 0x17D7, 0x17D8, 0x17D9, 0x17DA, 0x17DC, 0x1800, 0x1801,
|
||||
0x1802, 0x1803, 0x1804, 0x1805, 0x1807, 0x1808, 0x1809, 0x180A,
|
||||
0x2016, 0x2017, 0x201A, 0x201E, 0x2020, 0x2021, 0x2022, 0x2023,
|
||||
0x2024, 0x2025, 0x2026, 0x2027, 0x2030, 0x2031, 0x2032, 0x2033,
|
||||
0x2034, 0x2035, 0x2036, 0x2037, 0x2038, 0x203B, 0x203C, 0x203D,
|
||||
0x203E, 0x2041, 0x2042, 0x2043, 0x2045, 0x2046, 0x2048, 0x2049,
|
||||
0x204A, 0x204B, 0x204C, 0x204D, 0x207D, 0x207E, 0x208D, 0x208E,
|
||||
0x2329, 0x232A, 0x3001, 0x3002, 0x3003, 0x3008, 0x3009, 0x300A,
|
||||
0x300B, 0x300C, 0x300D, 0x300E, 0x300F, 0x3010, 0x3011, 0x3014,
|
||||
0x3015, 0x3016, 0x3017, 0x3018, 0x3019, 0x301A, 0x301B, 0x301D,
|
||||
0x301E, 0x301F, 0xFD3E, 0xFD3F, 0xFE30, 0xFE35, 0xFE36, 0xFE37,
|
||||
0xFE38, 0xFE39, 0xFE3A, 0xFE3B, 0xFE3C, 0xFE3D, 0xFE3E, 0xFE3F,
|
||||
0xFE40, 0xFE41, 0xFE42, 0xFE43, 0xFE44, 0xFE49, 0xFE4A, 0xFE4B,
|
||||
0xFE4C, 0xFE50, 0xFE51, 0xFE52, 0xFE54, 0xFE55, 0xFE56, 0xFE57,
|
||||
0xFE59, 0xFE5A, 0xFE5B, 0xFE5C, 0xFE5D, 0xFE5E, 0xFE5F, 0xFE60,
|
||||
0xFE61, 0xFE68, 0xFE6A, 0xFE6B, 0xFF01, 0xFF02, 0xFF03, 0xFF05,
|
||||
0xFF06, 0xFF07, 0xFF08, 0xFF09, 0xFF0A, 0xFF0C, 0xFF0E, 0xFF0F,
|
||||
0xFF1A, 0xFF1B, 0xFF1F, 0xFF20, 0xFF3B, 0xFF3C, 0xFF3D, 0xFF5B,
|
||||
0xFF5D, 0xFF61, 0xFF62, 0xFF63, 0xFF64,
|
||||
};
|
||||
static PRInt32 PuncSetSize = sizeof(PuncSet) / sizeof(PuncSet[0]);
|
||||
|
||||
PRInt32 i = PuncSetSize/2, begin = 0, end = PuncSetSize -1;
|
||||
|
||||
for (; begin != end; i = (begin + end ) / 2)
|
||||
{
|
||||
if (aChar == PuncSet[i])
|
||||
return PR_TRUE;
|
||||
if (aChar > PuncSet[i])
|
||||
begin = i+1;
|
||||
else
|
||||
end = i;
|
||||
}
|
||||
|
||||
return (aChar == PuncSet[i]);
|
||||
}
|
||||
// Replaced by precompiled CCMap (see bug 180266). To update the list
|
||||
// of characters, see one of files included below. As for the way
|
||||
// the original list of characters was obtained by Frank Tang, see bug 54467.
|
||||
static const PRUint16 gPuncCharsCCMap[] =
|
||||
{
|
||||
#include "punct_marks.ccmap"
|
||||
};
|
||||
|
||||
#define IsPunctuationMark(ch) (CCMAP_HAS_CHAR(gPuncCharsCCMap, ch))
|
||||
|
||||
nsReflowStatus
|
||||
nsTextFrame::MeasureText(nsIPresContext* aPresContext,
|
||||
|
247
layout/generic/punct_marks.ccmap
Executable file
247
layout/generic/punct_marks.ccmap
Executable file
@ -0,0 +1,247 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* Contributor(s): Jungshik Shin <jshin@mailaps.org> (Original developer)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*========================================================
|
||||
This file contains a precompiled CCMap for a class of Unicode
|
||||
characters (punct_marks) to be identified quickly by Mozilla.
|
||||
It was generated by ccmapbin.pl which you can find under
|
||||
mozilla/intl/unicharutil/tools.
|
||||
|
||||
Enumerated below are characters included in the precompiled CCMap
|
||||
which is human-readable but not so human-friendly. If you
|
||||
needs to modify the list of characters belonging to "punct_marks",
|
||||
you have to make a new file (with the name of your choice)
|
||||
listing characters (one character per line) you want to put
|
||||
into "punct_marks" in the format
|
||||
|
||||
0xuuuu // comment
|
||||
|
||||
In addition, the input file can have the following optional lines that
|
||||
read
|
||||
|
||||
CLASS::punct_marks
|
||||
DESCRIPTION:: description of a character class
|
||||
FILE:: mozilla source file to include output files
|
||||
|
||||
|
||||
Then, run the following in the current directory.
|
||||
|
||||
perl ccmapbin.pl input_file [punct_marks]
|
||||
|
||||
which will generate punct_marks.ccmap.
|
||||
|
||||
(see bug 180266 and bug 167136)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
0X3001 :
|
||||
0X3002 :
|
||||
0X3003 :
|
||||
0X3008 :
|
||||
0X3009 :
|
||||
0X3010 :
|
||||
0X3011 :
|
||||
0X3014 :
|
||||
0X3016 :
|
||||
0X3017 :
|
||||
0X3018 :
|
||||
0X3019 :
|
||||
0X0589 :
|
||||
0X0700 :
|
||||
0X0702 :
|
||||
0X0703 :
|
||||
0X0704 :
|
||||
0X0705 :
|
||||
0X0706 :
|
||||
0X0707 :
|
||||
0X0708 :
|
||||
0X0964 :
|
||||
0X0965 :
|
||||
0X0970 :
|
||||
0X0022 :
|
||||
0X0023 :
|
||||
0X0025 :
|
||||
0X0026 :
|
||||
0X0027 :
|
||||
0X0028 :
|
||||
0X0029 :
|
||||
0X1361 :
|
||||
0X1363 :
|
||||
0X1364 :
|
||||
0X1365 :
|
||||
0X1366 :
|
||||
0X1367 :
|
||||
0X1368 :
|
||||
0X1800 :
|
||||
0X1801 :
|
||||
0X1803 :
|
||||
0X1804 :
|
||||
0X1805 :
|
||||
0X1807 :
|
||||
0X1808 :
|
||||
0X1809 :
|
||||
0X0040 :
|
||||
0X2017 :
|
||||
0X2020 :
|
||||
0X2021 :
|
||||
0X2022 :
|
||||
0X2023 :
|
||||
0X2025 :
|
||||
0X2026 :
|
||||
0X2027 :
|
||||
0X2030 :
|
||||
0X2031 :
|
||||
0X2032 :
|
||||
0X2033 :
|
||||
0X2035 :
|
||||
0X2036 :
|
||||
0X2037 :
|
||||
0X2038 :
|
||||
0X2041 :
|
||||
0X2042 :
|
||||
0X2043 :
|
||||
0X2045 :
|
||||
0X2046 :
|
||||
0X2048 :
|
||||
0X2049 :
|
||||
0X0387 :
|
||||
*/
|
||||
|
||||
#if (defined(IS_LITTLE_ENDIAN) || ALU_SIZE == 16)
|
||||
// Precompiled CCMap for Big Endian(16bit)/Little Endian(16/32/64bit)
|
||||
/* 0000 */ 0x0030,0x0090,0x00C0,0x00E0,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0040,0x0020,0x0020,0x0050,0x0020,0x0060,0x0020,0x0070,
|
||||
0x0020,0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x0000,0x03EC,0x0000,0x0001,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0080,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0060 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0200,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0070 */ 0x01FD,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0080 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0030,0x0001,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0090 */ 0x0020,0x0020,0x0020,0x00A0,0x0020,0x0020,0x0020,0x0020,
|
||||
0x00B0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00a0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x01FA,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00b0 */ 0x03BB,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00c0 */ 0x00D0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00d0 */ 0x0000,0x0080,0x00EF,0x01EF,0x036E,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00e0 */ 0x00F0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00f0 */ 0x030E,0x03D3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
#elif (ALU_SIZE == 32)
|
||||
// Precompiled CCMap for Big Endian(32bit)
|
||||
/* 0000 */ 0x0030,0x0090,0x00C0,0x00E0,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0040,0x0020,0x0020,0x0050,0x0020,0x0060,0x0020,0x0070,
|
||||
0x0020,0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x0000,0x0000,0x03EC,0x0000,0x0001,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0080,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0060 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0200,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0070 */ 0x0000,0x01FD,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0080 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,0x0030,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0090 */ 0x0020,0x0020,0x0020,0x00A0,0x0020,0x0020,0x0020,0x0020,
|
||||
0x00B0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00a0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x01FA,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00b0 */ 0x0000,0x03BB,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00c0 */ 0x00D0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00d0 */ 0x0080,0x0000,0x01EF,0x00EF,0x0000,0x036E,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00e0 */ 0x00F0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00f0 */ 0x03D3,0x030E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
#elif (ALU_SIZE == 64)
|
||||
// Precompiled CCMap for Big Endian(64bit)
|
||||
/* 0000 */ 0x0030,0x0090,0x00C0,0x00E0,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0040,0x0020,0x0020,0x0050,0x0020,0x0060,0x0020,0x0070,
|
||||
0x0020,0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x03EC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0080,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0060 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0200,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0070 */ 0x0000,0x0000,0x0000,0x01FD,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0080 */ 0x0000,0x0000,0x0000,0x0000,0x0001,0x0030,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0090 */ 0x0020,0x0020,0x0020,0x00A0,0x0020,0x0020,0x0020,0x0020,
|
||||
0x00B0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00a0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x01FA,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00b0 */ 0x0000,0x0000,0x0000,0x03BB,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00c0 */ 0x00D0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00d0 */ 0x01EF,0x00EF,0x0080,0x0000,0x0000,0x0000,0x0000,0x036E,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00e0 */ 0x00F0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00f0 */ 0x0000,0x0000,0x03D3,0x030E,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
#else
|
||||
#error "We don't support this architecture."
|
||||
#endif
|
||||
|
@ -57,6 +57,7 @@ REQUIRES = xpcom \
|
||||
java \
|
||||
exthandler \
|
||||
intl \
|
||||
uconv \
|
||||
$(NULL)
|
||||
|
||||
# Sun's Complex Text Layout support
|
||||
|
@ -83,6 +83,8 @@
|
||||
|
||||
#include "nsILineIterator.h"
|
||||
|
||||
#include "nsCompressedCharMap.h"
|
||||
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
@ -4637,65 +4639,16 @@ nsTextFrame::EstimateNumChars(PRUint32 aAvailableWidth,
|
||||
PRUint32 estimatedNumChars = aAvailableWidth / aAverageCharWidth;
|
||||
return estimatedNumChars + estimatedNumChars / 20;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsPunctuationMark(PRUnichar aChar)
|
||||
{
|
||||
//The following table is generated by a method written by Ftang, see bug 54467.
|
||||
//In case we need to add or substract any character (for example, unicode standard got
|
||||
// updated), the character in table must be kept in strict ascending order
|
||||
static const PRUnichar PuncSet[] =
|
||||
{
|
||||
0x0021, 0x0022, 0x0023, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029,
|
||||
0x002A, 0x002C, 0x002E, 0x002F, 0x003A, 0x003B, 0x003F, 0x0040,
|
||||
0x005B, 0x005C, 0x005D, 0x007B, 0x007D, 0x00A1, 0x00B7, 0x00BF,
|
||||
0x0313, 0x037E, 0x0387, 0x055A, 0x055B, 0x055C, 0x055D, 0x055E,
|
||||
0x055F, 0x0589, 0x05BE, 0x05C0, 0x05C3, 0x05F3, 0x05F4, 0x060C,
|
||||
0x061B, 0x061F, 0x066A, 0x066B, 0x066C, 0x066D, 0x06D4, 0x0700,
|
||||
0x0701, 0x0702, 0x0703, 0x0704, 0x0705, 0x0706, 0x0707, 0x0708,
|
||||
0x0709, 0x070A, 0x070B, 0x070C, 0x070D, 0x0964, 0x0965, 0x0970,
|
||||
0x0DF4, 0x0E4F, 0x0E5A, 0x0E5B, 0x0F04, 0x0F05, 0x0F06, 0x0F07,
|
||||
0x0F08, 0x0F09, 0x0F0A, 0x0F0B, 0x0F0C, 0x0F0D, 0x0F0E, 0x0F0F,
|
||||
0x0F10, 0x0F11, 0x0F12, 0x0F3A, 0x0F3B, 0x0F3C, 0x0F3D, 0x0F85,
|
||||
0x104A, 0x104B, 0x104C, 0x104D, 0x104E, 0x104F, 0x10FB, 0x1361,
|
||||
0x1362, 0x1363, 0x1364, 0x1365, 0x1366, 0x1367, 0x1368, 0x166D,
|
||||
0x166E, 0x169B, 0x169C, 0x16EB, 0x16EC, 0x16ED, 0x17D4, 0x17D5,
|
||||
0x17D6, 0x17D7, 0x17D8, 0x17D9, 0x17DA, 0x17DC, 0x1800, 0x1801,
|
||||
0x1802, 0x1803, 0x1804, 0x1805, 0x1807, 0x1808, 0x1809, 0x180A,
|
||||
0x2016, 0x2017, 0x201A, 0x201E, 0x2020, 0x2021, 0x2022, 0x2023,
|
||||
0x2024, 0x2025, 0x2026, 0x2027, 0x2030, 0x2031, 0x2032, 0x2033,
|
||||
0x2034, 0x2035, 0x2036, 0x2037, 0x2038, 0x203B, 0x203C, 0x203D,
|
||||
0x203E, 0x2041, 0x2042, 0x2043, 0x2045, 0x2046, 0x2048, 0x2049,
|
||||
0x204A, 0x204B, 0x204C, 0x204D, 0x207D, 0x207E, 0x208D, 0x208E,
|
||||
0x2329, 0x232A, 0x3001, 0x3002, 0x3003, 0x3008, 0x3009, 0x300A,
|
||||
0x300B, 0x300C, 0x300D, 0x300E, 0x300F, 0x3010, 0x3011, 0x3014,
|
||||
0x3015, 0x3016, 0x3017, 0x3018, 0x3019, 0x301A, 0x301B, 0x301D,
|
||||
0x301E, 0x301F, 0xFD3E, 0xFD3F, 0xFE30, 0xFE35, 0xFE36, 0xFE37,
|
||||
0xFE38, 0xFE39, 0xFE3A, 0xFE3B, 0xFE3C, 0xFE3D, 0xFE3E, 0xFE3F,
|
||||
0xFE40, 0xFE41, 0xFE42, 0xFE43, 0xFE44, 0xFE49, 0xFE4A, 0xFE4B,
|
||||
0xFE4C, 0xFE50, 0xFE51, 0xFE52, 0xFE54, 0xFE55, 0xFE56, 0xFE57,
|
||||
0xFE59, 0xFE5A, 0xFE5B, 0xFE5C, 0xFE5D, 0xFE5E, 0xFE5F, 0xFE60,
|
||||
0xFE61, 0xFE68, 0xFE6A, 0xFE6B, 0xFF01, 0xFF02, 0xFF03, 0xFF05,
|
||||
0xFF06, 0xFF07, 0xFF08, 0xFF09, 0xFF0A, 0xFF0C, 0xFF0E, 0xFF0F,
|
||||
0xFF1A, 0xFF1B, 0xFF1F, 0xFF20, 0xFF3B, 0xFF3C, 0xFF3D, 0xFF5B,
|
||||
0xFF5D, 0xFF61, 0xFF62, 0xFF63, 0xFF64,
|
||||
};
|
||||
static PRInt32 PuncSetSize = sizeof(PuncSet) / sizeof(PuncSet[0]);
|
||||
|
||||
PRInt32 i = PuncSetSize/2, begin = 0, end = PuncSetSize -1;
|
||||
|
||||
for (; begin != end; i = (begin + end ) / 2)
|
||||
{
|
||||
if (aChar == PuncSet[i])
|
||||
return PR_TRUE;
|
||||
if (aChar > PuncSet[i])
|
||||
begin = i+1;
|
||||
else
|
||||
end = i;
|
||||
}
|
||||
|
||||
return (aChar == PuncSet[i]);
|
||||
}
|
||||
// Replaced by precompiled CCMap (see bug 180266). To update the list
|
||||
// of characters, see one of files included below. As for the way
|
||||
// the original list of characters was obtained by Frank Tang, see bug 54467.
|
||||
static const PRUint16 gPuncCharsCCMap[] =
|
||||
{
|
||||
#include "punct_marks.ccmap"
|
||||
};
|
||||
|
||||
#define IsPunctuationMark(ch) (CCMAP_HAS_CHAR(gPuncCharsCCMap, ch))
|
||||
|
||||
nsReflowStatus
|
||||
nsTextFrame::MeasureText(nsIPresContext* aPresContext,
|
||||
|
247
layout/html/base/src/punct_marks.ccmap
Executable file
247
layout/html/base/src/punct_marks.ccmap
Executable file
@ -0,0 +1,247 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* Contributor(s): Jungshik Shin <jshin@mailaps.org> (Original developer)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*========================================================
|
||||
This file contains a precompiled CCMap for a class of Unicode
|
||||
characters (punct_marks) to be identified quickly by Mozilla.
|
||||
It was generated by ccmapbin.pl which you can find under
|
||||
mozilla/intl/unicharutil/tools.
|
||||
|
||||
Enumerated below are characters included in the precompiled CCMap
|
||||
which is human-readable but not so human-friendly. If you
|
||||
needs to modify the list of characters belonging to "punct_marks",
|
||||
you have to make a new file (with the name of your choice)
|
||||
listing characters (one character per line) you want to put
|
||||
into "punct_marks" in the format
|
||||
|
||||
0xuuuu // comment
|
||||
|
||||
In addition, the input file can have the following optional lines that
|
||||
read
|
||||
|
||||
CLASS::punct_marks
|
||||
DESCRIPTION:: description of a character class
|
||||
FILE:: mozilla source file to include output files
|
||||
|
||||
|
||||
Then, run the following in the current directory.
|
||||
|
||||
perl ccmapbin.pl input_file [punct_marks]
|
||||
|
||||
which will generate punct_marks.ccmap.
|
||||
|
||||
(see bug 180266 and bug 167136)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
0X3001 :
|
||||
0X3002 :
|
||||
0X3003 :
|
||||
0X3008 :
|
||||
0X3009 :
|
||||
0X3010 :
|
||||
0X3011 :
|
||||
0X3014 :
|
||||
0X3016 :
|
||||
0X3017 :
|
||||
0X3018 :
|
||||
0X3019 :
|
||||
0X0589 :
|
||||
0X0700 :
|
||||
0X0702 :
|
||||
0X0703 :
|
||||
0X0704 :
|
||||
0X0705 :
|
||||
0X0706 :
|
||||
0X0707 :
|
||||
0X0708 :
|
||||
0X0964 :
|
||||
0X0965 :
|
||||
0X0970 :
|
||||
0X0022 :
|
||||
0X0023 :
|
||||
0X0025 :
|
||||
0X0026 :
|
||||
0X0027 :
|
||||
0X0028 :
|
||||
0X0029 :
|
||||
0X1361 :
|
||||
0X1363 :
|
||||
0X1364 :
|
||||
0X1365 :
|
||||
0X1366 :
|
||||
0X1367 :
|
||||
0X1368 :
|
||||
0X1800 :
|
||||
0X1801 :
|
||||
0X1803 :
|
||||
0X1804 :
|
||||
0X1805 :
|
||||
0X1807 :
|
||||
0X1808 :
|
||||
0X1809 :
|
||||
0X0040 :
|
||||
0X2017 :
|
||||
0X2020 :
|
||||
0X2021 :
|
||||
0X2022 :
|
||||
0X2023 :
|
||||
0X2025 :
|
||||
0X2026 :
|
||||
0X2027 :
|
||||
0X2030 :
|
||||
0X2031 :
|
||||
0X2032 :
|
||||
0X2033 :
|
||||
0X2035 :
|
||||
0X2036 :
|
||||
0X2037 :
|
||||
0X2038 :
|
||||
0X2041 :
|
||||
0X2042 :
|
||||
0X2043 :
|
||||
0X2045 :
|
||||
0X2046 :
|
||||
0X2048 :
|
||||
0X2049 :
|
||||
0X0387 :
|
||||
*/
|
||||
|
||||
#if (defined(IS_LITTLE_ENDIAN) || ALU_SIZE == 16)
|
||||
// Precompiled CCMap for Big Endian(16bit)/Little Endian(16/32/64bit)
|
||||
/* 0000 */ 0x0030,0x0090,0x00C0,0x00E0,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0040,0x0020,0x0020,0x0050,0x0020,0x0060,0x0020,0x0070,
|
||||
0x0020,0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x0000,0x03EC,0x0000,0x0001,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0080,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0060 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0200,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0070 */ 0x01FD,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0080 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0030,0x0001,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0090 */ 0x0020,0x0020,0x0020,0x00A0,0x0020,0x0020,0x0020,0x0020,
|
||||
0x00B0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00a0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x01FA,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00b0 */ 0x03BB,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00c0 */ 0x00D0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00d0 */ 0x0000,0x0080,0x00EF,0x01EF,0x036E,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00e0 */ 0x00F0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00f0 */ 0x030E,0x03D3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
#elif (ALU_SIZE == 32)
|
||||
// Precompiled CCMap for Big Endian(32bit)
|
||||
/* 0000 */ 0x0030,0x0090,0x00C0,0x00E0,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0040,0x0020,0x0020,0x0050,0x0020,0x0060,0x0020,0x0070,
|
||||
0x0020,0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x0000,0x0000,0x03EC,0x0000,0x0001,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0080,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0060 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0200,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0070 */ 0x0000,0x01FD,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0080 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,0x0030,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0090 */ 0x0020,0x0020,0x0020,0x00A0,0x0020,0x0020,0x0020,0x0020,
|
||||
0x00B0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00a0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x01FA,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00b0 */ 0x0000,0x03BB,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00c0 */ 0x00D0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00d0 */ 0x0080,0x0000,0x01EF,0x00EF,0x0000,0x036E,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00e0 */ 0x00F0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00f0 */ 0x03D3,0x030E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
#elif (ALU_SIZE == 64)
|
||||
// Precompiled CCMap for Big Endian(64bit)
|
||||
/* 0000 */ 0x0030,0x0090,0x00C0,0x00E0,0x0010,0x0010,0x0010,0x0010,
|
||||
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,
|
||||
/* 0010 */ 0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0020 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0030 */ 0x0040,0x0020,0x0020,0x0050,0x0020,0x0060,0x0020,0x0070,
|
||||
0x0020,0x0080,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 0040 */ 0x0000,0x03EC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0050 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0080,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0060 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0200,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0070 */ 0x0000,0x0000,0x0000,0x01FD,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0080 */ 0x0000,0x0000,0x0000,0x0000,0x0001,0x0030,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 0090 */ 0x0020,0x0020,0x0020,0x00A0,0x0020,0x0020,0x0020,0x0020,
|
||||
0x00B0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00a0 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x01FA,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00b0 */ 0x0000,0x0000,0x0000,0x03BB,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00c0 */ 0x00D0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00d0 */ 0x01EF,0x00EF,0x0080,0x0000,0x0000,0x0000,0x0000,0x036E,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
/* 00e0 */ 0x00F0,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,0x0020,
|
||||
/* 00f0 */ 0x0000,0x0000,0x03D3,0x030E,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
#else
|
||||
#error "We don't support this architecture."
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user