mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-01 11:27:55 +00:00
bug 724826 pt 1 - move various Unicode property tables from gfx to intl. r=smontagu
--HG-- rename : gfx/thebes/gfxUnicodeProperties.h => intl/unicharutil/public/nsUnicodeProperties.h rename : gfx/thebes/gfxUnicodeScriptCodes.h => intl/unicharutil/public/nsUnicodeScriptCodes.h rename : gfx/thebes/gfxUnicodeProperties.cpp => intl/unicharutil/src/nsUnicodeProperties.cpp rename : gfx/thebes/gfxUnicodePropertyData.cpp => intl/unicharutil/src/nsUnicodePropertyData.cpp rename : gfx/thebes/genUnicodeScriptData.pl => intl/unicharutil/tools/genUnicodePropertyData.pl
This commit is contained in:
parent
7c4000a995
commit
c7fa86d451
@ -75,8 +75,6 @@ EXPORTS = \
|
||||
gfxSkipChars.h \
|
||||
gfxTeeSurface.h \
|
||||
gfxTypes.h \
|
||||
gfxUnicodeProperties.h \
|
||||
gfxUnicodeScriptCodes.h \
|
||||
gfxUtils.h \
|
||||
gfxUserFontSet.h \
|
||||
nsCoreAnimationSupport.h \
|
||||
@ -204,7 +202,6 @@ CPPSRCS = \
|
||||
gfxTeeSurface.cpp \
|
||||
gfxUserFontSet.cpp \
|
||||
gfxUtils.cpp \
|
||||
gfxUnicodeProperties.cpp \
|
||||
gfxScriptItemizer.cpp \
|
||||
gfxHarfBuzzShaper.cpp \
|
||||
gfxSharedImageSurface.cpp \
|
||||
|
@ -59,7 +59,6 @@
|
||||
#ifdef MOZ_GRAPHITE
|
||||
#include "gfxGraphiteShaper.h"
|
||||
#endif
|
||||
#include "gfxUnicodeProperties.h"
|
||||
#include "gfxAtoms.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsUnicodeRange.h"
|
||||
|
@ -62,7 +62,7 @@
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "gfxPlatformFontList.h"
|
||||
#include "gfxScriptItemizer.h"
|
||||
#include "gfxUnicodeProperties.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "nsMathUtils.h"
|
||||
#include "nsBidiUtils.h"
|
||||
#include "nsUnicodeRange.h"
|
||||
@ -83,6 +83,7 @@
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::unicode;
|
||||
using mozilla::services::GetObserverService;
|
||||
|
||||
gfxFontCache *gfxFontCache::gGlobalCache = nsnull;
|
||||
@ -723,7 +724,7 @@ gfxFontFamily::FindFontForChar(FontSearch *aMatchData)
|
||||
if (NS_UNLIKELY(log)) {
|
||||
PRUint32 charRange = gfxFontUtils::CharRangeBit(aMatchData->mCh);
|
||||
PRUint32 unicodeRange = FindCharUnicodeRange(aMatchData->mCh);
|
||||
PRUint32 script = gfxUnicodeProperties::GetScriptCode(aMatchData->mCh);
|
||||
PRUint32 script = GetScriptCode(aMatchData->mCh);
|
||||
PR_LOG(log, PR_LOG_DEBUG,\
|
||||
("(textrun-systemfallback-fonts) char: u+%6.6x "
|
||||
"char-range: %d unicode-range: %d script: %d match: [%s]\n",
|
||||
@ -1878,7 +1879,7 @@ gfxFont::Measure(gfxTextRun *aTextRun,
|
||||
static bool
|
||||
IsClusterExtender(PRUint32 aUSV)
|
||||
{
|
||||
PRUint8 category = gfxUnicodeProperties::GetGeneralCategory(aUSV);
|
||||
PRUint8 category = GetGeneralCategory(aUSV);
|
||||
return ((category >= HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK &&
|
||||
category <= HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) ||
|
||||
(aUSV >= 0x200c && aUSV <= 0x200d) || // ZWJ, ZWNJ
|
||||
@ -3332,7 +3333,7 @@ gfxFontGroup::FindFontForChar(PRUint32 aCh, PRUint32 aPrevCh,
|
||||
// Don't switch fonts for control characters, regardless of
|
||||
// whether they are present in the current font, as they won't
|
||||
// actually be rendered (see bug 716229)
|
||||
PRUint8 category = gfxUnicodeProperties::GetGeneralCategory(aCh);
|
||||
PRUint8 category = GetGeneralCategory(aCh);
|
||||
if (category == HB_UNICODE_GENERAL_CATEGORY_CONTROL) {
|
||||
selectedFont = aPrevMatchedFont;
|
||||
return selectedFont.forget();
|
||||
@ -3406,7 +3407,7 @@ gfxFontGroup::FindFontForChar(PRUint32 aCh, PRUint32 aPrevCh,
|
||||
|
||||
// for known "space" characters, don't do a full system-fallback search;
|
||||
// we'll synthesize appropriate-width spaces instead of missing-glyph boxes
|
||||
if (gfxUnicodeProperties::GetGeneralCategory(aCh) ==
|
||||
if (GetGeneralCategory(aCh) ==
|
||||
HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR &&
|
||||
GetFontAt(0)->SynthesizeSpaceWidth(aCh) >= 0.0)
|
||||
{
|
||||
@ -3796,7 +3797,7 @@ gfxShapedWord::SetupClusterBoundaries(CompressedGlyph *aGlyphs,
|
||||
gfxTextRun::CompressedGlyph extendCluster;
|
||||
extendCluster.SetComplex(false, true, 0);
|
||||
|
||||
gfxUnicodeProperties::HSType hangulState = gfxUnicodeProperties::HST_NONE;
|
||||
HSType hangulState = HST_NONE;
|
||||
|
||||
for (PRUint32 i = 0; i < aLength; ++i) {
|
||||
bool surrogatePair = false;
|
||||
@ -3808,8 +3809,8 @@ gfxShapedWord::SetupClusterBoundaries(CompressedGlyph *aGlyphs,
|
||||
surrogatePair = true;
|
||||
}
|
||||
|
||||
PRUint8 category = gfxUnicodeProperties::GetGeneralCategory(ch);
|
||||
gfxUnicodeProperties::HSType hangulType = gfxUnicodeProperties::HST_NONE;
|
||||
PRUint8 category = GetGeneralCategory(ch);
|
||||
HSType hangulType = HST_NONE;
|
||||
|
||||
// combining marks extend the cluster
|
||||
if (IsClusterExtender(ch)) {
|
||||
@ -3850,25 +3851,25 @@ gfxShapedWord::SetupClusterBoundaries(CompressedGlyph *aGlyphs,
|
||||
(ch >= 0xac00 && ch <= 0xd7ff))
|
||||
{
|
||||
// no break within Hangul syllables
|
||||
hangulType = gfxUnicodeProperties::GetHangulSyllableType(ch);
|
||||
hangulType = GetHangulSyllableType(ch);
|
||||
switch (hangulType) {
|
||||
case gfxUnicodeProperties::HST_L:
|
||||
case gfxUnicodeProperties::HST_LV:
|
||||
case gfxUnicodeProperties::HST_LVT:
|
||||
if (hangulState == gfxUnicodeProperties::HST_L) {
|
||||
case HST_L:
|
||||
case HST_LV:
|
||||
case HST_LVT:
|
||||
if (hangulState == HST_L) {
|
||||
aGlyphs[i] = extendCluster;
|
||||
}
|
||||
break;
|
||||
case gfxUnicodeProperties::HST_V:
|
||||
if ( (hangulState != gfxUnicodeProperties::HST_NONE) &&
|
||||
!(hangulState & gfxUnicodeProperties::HST_T))
|
||||
case HST_V:
|
||||
if ( (hangulState != HST_NONE) &&
|
||||
!(hangulState & HST_T))
|
||||
{
|
||||
aGlyphs[i] = extendCluster;
|
||||
}
|
||||
break;
|
||||
case gfxUnicodeProperties::HST_T:
|
||||
if (hangulState & (gfxUnicodeProperties::HST_V |
|
||||
gfxUnicodeProperties::HST_T))
|
||||
case HST_T:
|
||||
if (hangulState & (HST_V |
|
||||
HST_T))
|
||||
{
|
||||
aGlyphs[i] = extendCluster;
|
||||
}
|
||||
@ -5021,7 +5022,7 @@ gfxTextRun::SetGlyphs(PRUint32 aIndex, CompressedGlyph aGlyph,
|
||||
void
|
||||
gfxTextRun::SetMissingGlyph(PRUint32 aIndex, PRUint32 aChar)
|
||||
{
|
||||
PRUint8 category = gfxUnicodeProperties::GetGeneralCategory(aChar);
|
||||
PRUint8 category = GetGeneralCategory(aChar);
|
||||
if (category >= HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK &&
|
||||
category <= HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
|
||||
{
|
||||
|
@ -48,7 +48,6 @@
|
||||
#endif
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxUnicodeProperties.h"
|
||||
|
||||
#include "cairo-win32.h"
|
||||
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxGraphiteShaper.h"
|
||||
#include "gfxFontUtils.h"
|
||||
#include "gfxUnicodeProperties.h"
|
||||
|
||||
#include "graphite2/Font.h"
|
||||
#include "graphite2/Segment.h"
|
||||
|
@ -49,7 +49,8 @@
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxHarfBuzzShaper.h"
|
||||
#include "gfxFontUtils.h"
|
||||
#include "gfxUnicodeProperties.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "nsUnicodeScriptCodes.h"
|
||||
#include "nsUnicodeNormalizer.h"
|
||||
|
||||
#include "harfbuzz/hb-unicode.h"
|
||||
@ -72,6 +73,7 @@
|
||||
: -((32767 - (f)) >> 16))
|
||||
|
||||
using namespace mozilla; // for AutoSwap_* types
|
||||
using namespace mozilla::unicode; // for Unicode property lookup
|
||||
|
||||
/*
|
||||
* Creation and destruction; on deletion, release any font tables we're holding
|
||||
@ -672,32 +674,32 @@ HBGetHKerning(hb_font_t *font, void *font_data,
|
||||
static hb_codepoint_t
|
||||
HBGetMirroring(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, void *user_data)
|
||||
{
|
||||
return gfxUnicodeProperties::GetMirroredChar(aCh);
|
||||
return GetMirroredChar(aCh);
|
||||
}
|
||||
|
||||
static hb_unicode_general_category_t
|
||||
HBGetGeneralCategory(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, void *user_data)
|
||||
{
|
||||
return hb_unicode_general_category_t(gfxUnicodeProperties::GetGeneralCategory(aCh));
|
||||
return hb_unicode_general_category_t(GetGeneralCategory(aCh));
|
||||
}
|
||||
|
||||
static hb_script_t
|
||||
HBGetScript(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, void *user_data)
|
||||
{
|
||||
return hb_script_t(gfxUnicodeProperties::GetScriptTagForCode
|
||||
(gfxUnicodeProperties::GetScriptCode(aCh)));
|
||||
return hb_script_t(GetScriptTagForCode
|
||||
(GetScriptCode(aCh)));
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
HBGetCombiningClass(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, void *user_data)
|
||||
{
|
||||
return gfxUnicodeProperties::GetCombiningClass(aCh);
|
||||
return GetCombiningClass(aCh);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
HBGetEastAsianWidth(hb_unicode_funcs_t *ufuncs, hb_codepoint_t aCh, void *user_data)
|
||||
{
|
||||
return gfxUnicodeProperties::GetEastAsianWidth(aCh);
|
||||
return GetEastAsianWidth(aCh);
|
||||
}
|
||||
|
||||
// Hebrew presentation forms with dagesh, for characters 0x05D0..0x05EA;
|
||||
@ -1005,7 +1007,7 @@ gfxHarfBuzzShaper::ShapeWord(gfxContext *aContext,
|
||||
PRInt32 scriptCode = aShapedWord->Script();
|
||||
hb_script_t scriptTag = (scriptCode <= MOZ_SCRIPT_INHERITED) ?
|
||||
HB_SCRIPT_LATIN :
|
||||
hb_script_t(gfxUnicodeProperties::GetScriptTagForCode(scriptCode));
|
||||
hb_script_t(GetScriptTagForCode(scriptCode));
|
||||
hb_buffer_set_script(buffer, scriptTag);
|
||||
|
||||
hb_language_t language;
|
||||
|
@ -46,7 +46,6 @@
|
||||
#endif
|
||||
#include "gfxPlatformMac.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxUnicodeProperties.h"
|
||||
#include "gfxFontUtils.h"
|
||||
|
||||
#include "cairo-quartz.h"
|
||||
|
@ -69,7 +69,8 @@
|
||||
#ifdef MOZ_GRAPHITE
|
||||
#include "gfxGraphiteShaper.h"
|
||||
#endif
|
||||
#include "gfxUnicodeProperties.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "nsUnicodeScriptCodes.h"
|
||||
#include "gfxFontconfigUtils.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "gfxAtoms.h"
|
||||
@ -90,6 +91,7 @@
|
||||
#include <math.h>
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::unicode;
|
||||
|
||||
#define FLOAT_PANGO_SCALE ((gfxFloat)PANGO_SCALE)
|
||||
|
||||
@ -329,7 +331,7 @@ gfxFcFontEntry::ShouldUseHarfBuzz(PRInt32 aRunScript) {
|
||||
// Mimicing gfxHarfBuzzShaper::ShapeWord
|
||||
hb_script_t script = (aRunScript <= MOZ_SCRIPT_INHERITED) ?
|
||||
HB_SCRIPT_LATIN :
|
||||
hb_script_t(gfxUnicodeProperties::GetScriptTagForCode(aRunScript));
|
||||
hb_script_t(GetScriptTagForCode(aRunScript));
|
||||
|
||||
// Prefer HarfBuzz if the font also has support for OpenType shaping of
|
||||
// this script.
|
||||
@ -2053,7 +2055,7 @@ gfxPangoFontGroup::FindFontForChar(PRUint32 aCh, PRUint32 aPrevCh,
|
||||
// Don't switch fonts for control characters, regardless of
|
||||
// whether they are present in the current font, as they won't
|
||||
// actually be rendered (see bug 716229)
|
||||
PRUint8 category = gfxUnicodeProperties::GetGeneralCategory(aCh);
|
||||
PRUint8 category = GetGeneralCategory(aCh);
|
||||
if (category == HB_UNICODE_GENERAL_CATEGORY_CONTROL) {
|
||||
return nsRefPtr<gfxFont>(aPrevMatchedFont).forget();
|
||||
}
|
||||
|
@ -62,7 +62,7 @@
|
||||
#include "gfxContext.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
#include "gfxUnicodeProperties.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "harfbuzz/hb-unicode.h"
|
||||
#ifdef MOZ_GRAPHITE
|
||||
#include "gfxGraphiteShaper.h"
|
||||
@ -149,7 +149,7 @@ SRGBOverrideObserver::Observe(nsISupports *aSubject,
|
||||
#define GFX_DOWNLOADABLE_FONTS_SANITIZE "gfx.downloadable_fonts.sanitize"
|
||||
|
||||
#define GFX_PREF_HARFBUZZ_SCRIPTS "gfx.font_rendering.harfbuzz.scripts"
|
||||
#define HARFBUZZ_SCRIPTS_DEFAULT gfxUnicodeProperties::SHAPING_DEFAULT
|
||||
#define HARFBUZZ_SCRIPTS_DEFAULT mozilla::unicode::SHAPING_DEFAULT
|
||||
|
||||
#ifdef MOZ_GRAPHITE
|
||||
#define GFX_PREF_GRAPHITE_SHAPING "gfx.font_rendering.graphite.enabled"
|
||||
@ -697,7 +697,7 @@ gfxPlatform::UseHarfBuzzForScript(PRInt32 aScriptCode)
|
||||
mUseHarfBuzzScripts = Preferences::GetInt(GFX_PREF_HARFBUZZ_SCRIPTS, HARFBUZZ_SCRIPTS_DEFAULT);
|
||||
}
|
||||
|
||||
PRInt32 shapingType = gfxUnicodeProperties::ScriptShapingType(aScriptCode);
|
||||
PRInt32 shapingType = mozilla::unicode::ScriptShapingType(aScriptCode);
|
||||
|
||||
return (mUseHarfBuzzScripts & shapingType) != 0;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@
|
||||
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsUnicodeRange.h"
|
||||
#include "gfxUnicodeProperties.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
@ -422,7 +422,7 @@ gfxPlatformFontList::FindFontForChar(const PRUint32 aCh, gfxFont *aPrevFont)
|
||||
if (NS_UNLIKELY(log)) {
|
||||
PRUint32 charRange = gfxFontUtils::CharRangeBit(aCh);
|
||||
PRUint32 unicodeRange = FindCharUnicodeRange(aCh);
|
||||
PRInt32 script = gfxUnicodeProperties::GetScriptCode(aCh);
|
||||
PRInt32 script = mozilla::unicode::GetScriptCode(aCh);
|
||||
PR_LOG(log, PR_LOG_DEBUG,\
|
||||
("(textrun-systemfallback) char: u+%6.6x "
|
||||
"char-range: %d unicode-range: %d script: %d match: [%s]"
|
||||
|
@ -78,8 +78,8 @@
|
||||
*/
|
||||
|
||||
#include "gfxScriptItemizer.h"
|
||||
#include "gfxUnicodeProperties.h"
|
||||
#include "gfxFontUtils.h" // for the FindHighestBit function
|
||||
#include "nsUnicodeProperties.h"
|
||||
|
||||
#include "nsCharTraits.h"
|
||||
|
||||
@ -281,7 +281,7 @@ gfxScriptItemizer::Next(PRUint32& aRunStart, PRUint32& aRunLimit,
|
||||
}
|
||||
}
|
||||
|
||||
sc = gfxUnicodeProperties::GetScriptCode(ch);
|
||||
sc = mozilla::unicode::GetScriptCode(ch);
|
||||
|
||||
pairIndex = getPairIndex(ch);
|
||||
|
||||
|
@ -83,7 +83,7 @@
|
||||
#include "mozilla/StdInt.h"
|
||||
#include "prtypes.h"
|
||||
#include "harfbuzz/hb.h"
|
||||
#include "gfxUnicodeScriptCodes.h"
|
||||
#include "nsUnicodeScriptCodes.h"
|
||||
|
||||
#define PAREN_STACK_DEPTH 32
|
||||
|
||||
|
@ -49,6 +49,8 @@ EXPORTS = \
|
||||
nsIUGenCategory.h \
|
||||
nsUnicharUtilCIID.h \
|
||||
nsUnicodeNormalizer.h \
|
||||
nsUnicodeProperties.h \
|
||||
nsUnicodeScriptCodes.h \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -35,50 +35,52 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef GFX_UNICODEPROPERTIES_H
|
||||
#define GFX_UNICODEPROPERTIES_H
|
||||
#ifndef NS_UNICODEPROPERTIES_H
|
||||
#define NS_UNICODEPROPERTIES_H
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "gfxTypes.h"
|
||||
#include "gfxUnicodeScriptCodes.h"
|
||||
|
||||
class THEBES_API gfxUnicodeProperties
|
||||
{
|
||||
public:
|
||||
static PRUint32 GetMirroredChar(PRUint32 aCh);
|
||||
namespace mozilla {
|
||||
|
||||
static PRUint8 GetCombiningClass(PRUint32 aCh);
|
||||
namespace unicode {
|
||||
|
||||
static PRUint8 GetGeneralCategory(PRUint32 aCh);
|
||||
PRUint32 GetMirroredChar(PRUint32 aCh);
|
||||
|
||||
static PRUint8 GetEastAsianWidth(PRUint32 aCh);
|
||||
PRUint8 GetCombiningClass(PRUint32 aCh);
|
||||
|
||||
static PRInt32 GetScriptCode(PRUint32 aCh);
|
||||
PRUint8 GetGeneralCategory(PRUint32 aCh);
|
||||
|
||||
static PRUint32 GetScriptTagForCode(PRInt32 aScriptCode);
|
||||
PRUint8 GetEastAsianWidth(PRUint32 aCh);
|
||||
|
||||
enum HSType {
|
||||
HST_NONE = 0x00,
|
||||
HST_L = 0x01,
|
||||
HST_V = 0x02,
|
||||
HST_T = 0x04,
|
||||
HST_LV = 0x03,
|
||||
HST_LVT = 0x07
|
||||
};
|
||||
PRInt32 GetScriptCode(PRUint32 aCh);
|
||||
|
||||
static HSType GetHangulSyllableType(PRUint32 aCh);
|
||||
PRUint32 GetScriptTagForCode(PRInt32 aScriptCode);
|
||||
|
||||
enum ShapingType {
|
||||
SHAPING_DEFAULT = 0x0001,
|
||||
SHAPING_ARABIC = 0x0002,
|
||||
SHAPING_HEBREW = 0x0004,
|
||||
SHAPING_HANGUL = 0x0008,
|
||||
SHAPING_MONGOLIAN = 0x0010,
|
||||
SHAPING_INDIC = 0x0020,
|
||||
SHAPING_THAI = 0x0040
|
||||
};
|
||||
|
||||
static PRInt32 ScriptShapingType(PRInt32 aScriptCode);
|
||||
enum HSType {
|
||||
HST_NONE = 0x00,
|
||||
HST_L = 0x01,
|
||||
HST_V = 0x02,
|
||||
HST_T = 0x04,
|
||||
HST_LV = 0x03,
|
||||
HST_LVT = 0x07
|
||||
};
|
||||
|
||||
#endif /* GFX_UNICODEPROPERTIES_H */
|
||||
HSType GetHangulSyllableType(PRUint32 aCh);
|
||||
|
||||
enum ShapingType {
|
||||
SHAPING_DEFAULT = 0x0001,
|
||||
SHAPING_ARABIC = 0x0002,
|
||||
SHAPING_HEBREW = 0x0004,
|
||||
SHAPING_HANGUL = 0x0008,
|
||||
SHAPING_MONGOLIAN = 0x0010,
|
||||
SHAPING_INDIC = 0x0020,
|
||||
SHAPING_THAI = 0x0040
|
||||
};
|
||||
|
||||
PRInt32 ScriptShapingType(PRInt32 aScriptCode);
|
||||
|
||||
} // end namespace unicode
|
||||
|
||||
} // end namespace mozilla
|
||||
|
||||
#endif /* NS_UNICODEPROPERTIES_H */
|
@ -34,14 +34,14 @@
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* Derived from the Unicode Character Database by genUnicodeScriptData.pl
|
||||
* Derived from the Unicode Character Database by genUnicodePropertyData.pl
|
||||
*
|
||||
* For Unicode terms of use, see http://www.unicode.org/terms_of_use.html
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Created on Mon Feb 13 09:25:50 2012 from UCD data files with version info:
|
||||
* Created on Thu Feb 23 13:15:51 2012 from UCD data files with version info:
|
||||
*
|
||||
|
||||
# Date: 2012-01-26, 22:03:00 GMT [KW]
|
||||
@ -74,8 +74,8 @@ for the Unicode Character Database (UCD) for Unicode 6.1.0.
|
||||
* * * * * This file contains MACHINE-GENERATED DATA, do not edit! * * * * *
|
||||
*/
|
||||
|
||||
#ifndef GFX_UNICODE_SCRIPT_CODES
|
||||
#define GFX_UNICODE_SCRIPT_CODES
|
||||
#ifndef NS_UNICODE_SCRIPT_CODES
|
||||
#define NS_UNICODE_SCRIPT_CODES
|
||||
enum {
|
||||
MOZ_SCRIPT_COMMON = 0,
|
||||
MOZ_SCRIPT_INHERITED = 1,
|
@ -47,6 +47,7 @@ LIBRARY_NAME = ucharucomp_s
|
||||
FORCE_STATIC_LIB = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
DEFINES += -DHB_DONT_DEFINE_STDINT
|
||||
|
||||
CPPSRCS = \
|
||||
nsCaseConversionImp2.cpp \
|
||||
@ -54,6 +55,7 @@ CPPSRCS = \
|
||||
nsEntityConverter.cpp \
|
||||
nsSaveAsCharset.cpp \
|
||||
nsUnicodeNormalizer.cpp \
|
||||
nsUnicodeProperties.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -35,19 +35,22 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "gfxUnicodeProperties.h"
|
||||
#include "gfxUnicodePropertyData.cpp"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "nsUnicodeScriptCodes.h"
|
||||
#include "nsUnicodePropertyData.cpp"
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
#include "harfbuzz/hb-unicode.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#define UNICODE_BMP_LIMIT 0x10000
|
||||
#define UNICODE_LIMIT 0x110000
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace unicode {
|
||||
|
||||
/*
|
||||
To store properties for a million Unicode codepoints compactly, we use
|
||||
a three-level array structure, with the Unicode values considered as
|
||||
@ -70,7 +73,7 @@ of values.
|
||||
*/
|
||||
|
||||
PRUint32
|
||||
gfxUnicodeProperties::GetMirroredChar(PRUint32 aCh)
|
||||
GetMirroredChar(PRUint32 aCh)
|
||||
{
|
||||
// all mirrored chars are in plane 0
|
||||
if (aCh < UNICODE_BMP_LIMIT) {
|
||||
@ -90,7 +93,7 @@ gfxUnicodeProperties::GetMirroredChar(PRUint32 aCh)
|
||||
}
|
||||
|
||||
PRUint8
|
||||
gfxUnicodeProperties::GetCombiningClass(PRUint32 aCh)
|
||||
GetCombiningClass(PRUint32 aCh)
|
||||
{
|
||||
if (aCh < UNICODE_BMP_LIMIT) {
|
||||
return sCClassValues[sCClassPages[0][aCh >> kCClassCharBits]]
|
||||
@ -106,7 +109,7 @@ gfxUnicodeProperties::GetCombiningClass(PRUint32 aCh)
|
||||
}
|
||||
|
||||
PRUint8
|
||||
gfxUnicodeProperties::GetGeneralCategory(PRUint32 aCh)
|
||||
GetGeneralCategory(PRUint32 aCh)
|
||||
{
|
||||
if (aCh < UNICODE_BMP_LIMIT) {
|
||||
return sCatEAWValues[sCatEAWPages[0][aCh >> kCatEAWCharBits]]
|
||||
@ -122,7 +125,7 @@ gfxUnicodeProperties::GetGeneralCategory(PRUint32 aCh)
|
||||
}
|
||||
|
||||
PRUint8
|
||||
gfxUnicodeProperties::GetEastAsianWidth(PRUint32 aCh)
|
||||
GetEastAsianWidth(PRUint32 aCh)
|
||||
{
|
||||
if (aCh < UNICODE_BMP_LIMIT) {
|
||||
return sCatEAWValues[sCatEAWPages[0][aCh >> kCatEAWCharBits]]
|
||||
@ -138,7 +141,7 @@ gfxUnicodeProperties::GetEastAsianWidth(PRUint32 aCh)
|
||||
}
|
||||
|
||||
PRInt32
|
||||
gfxUnicodeProperties::GetScriptCode(PRUint32 aCh)
|
||||
GetScriptCode(PRUint32 aCh)
|
||||
{
|
||||
if (aCh < UNICODE_BMP_LIMIT) {
|
||||
return sScriptValues[sScriptPages[0][aCh >> kScriptCharBits]]
|
||||
@ -154,7 +157,7 @@ gfxUnicodeProperties::GetScriptCode(PRUint32 aCh)
|
||||
}
|
||||
|
||||
PRUint32
|
||||
gfxUnicodeProperties::GetScriptTagForCode(PRInt32 aScriptCode)
|
||||
GetScriptTagForCode(PRInt32 aScriptCode)
|
||||
{
|
||||
// this will safely return 0 for negative script codes, too :)
|
||||
if (PRUint32(aScriptCode) > ArrayLength(sScriptCodeToTag)) {
|
||||
@ -163,8 +166,8 @@ gfxUnicodeProperties::GetScriptTagForCode(PRInt32 aScriptCode)
|
||||
return sScriptCodeToTag[aScriptCode];
|
||||
}
|
||||
|
||||
gfxUnicodeProperties::HSType
|
||||
gfxUnicodeProperties::GetHangulSyllableType(PRUint32 aCh)
|
||||
HSType
|
||||
GetHangulSyllableType(PRUint32 aCh)
|
||||
{
|
||||
// all Hangul chars are in plane 0
|
||||
if (aCh < UNICODE_BMP_LIMIT) {
|
||||
@ -183,7 +186,7 @@ gfxUnicodeProperties::GetHangulSyllableType(PRUint32 aCh)
|
||||
// preference to decide whether to use the harfbuzz shaper.
|
||||
//
|
||||
PRInt32
|
||||
gfxUnicodeProperties::ScriptShapingType(PRInt32 aScriptCode)
|
||||
ScriptShapingType(PRInt32 aScriptCode)
|
||||
{
|
||||
switch (aScriptCode) {
|
||||
default:
|
||||
@ -231,3 +234,7 @@ gfxUnicodeProperties::ScriptShapingType(PRInt32 aScriptCode)
|
||||
return SHAPING_INDIC; // scripts that require Indic or other "special" shaping
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace unicode
|
||||
|
||||
} // end namespace mozilla
|
@ -34,14 +34,14 @@
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* Derived from the Unicode Character Database by genUnicodeScriptData.pl
|
||||
* Derived from the Unicode Character Database by genUnicodePropertyData.pl
|
||||
*
|
||||
* For Unicode terms of use, see http://www.unicode.org/terms_of_use.html
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Created on Mon Feb 13 09:25:50 2012 from UCD data files with version info:
|
||||
* Created on Thu Feb 23 13:15:51 2012 from UCD data files with version info:
|
||||
*
|
||||
|
||||
# Date: 2012-01-26, 22:03:00 GMT [KW]
|
@ -41,7 +41,7 @@
|
||||
# read from the Unicode Character Database and compiled into multi-level arrays
|
||||
# for efficient lookup.
|
||||
#
|
||||
# To regenerate the tables in gfxUnicodePropertyData.cpp:
|
||||
# To regenerate the tables in nsUnicodePropertyData.cpp:
|
||||
#
|
||||
# (1) Download the current Unicode data files from
|
||||
#
|
||||
@ -60,21 +60,44 @@
|
||||
#
|
||||
# (2) Run this tool using a command line of the form
|
||||
#
|
||||
# perl genUnicodeScriptData.pl \
|
||||
# /path/to/hb-common.h \
|
||||
# perl genUnicodePropertyData.pl \
|
||||
# /path/to/hb-common.h \
|
||||
# /path/to/UCD-directory
|
||||
#
|
||||
# (where hb-common.h is found in the gfx/harfbuzz/src directory).
|
||||
#
|
||||
# This will generate (or overwrite!) the files
|
||||
#
|
||||
# gfxUnicodePropertyData.cpp
|
||||
# gfxUnicodeScriptCodes.h
|
||||
# nsUnicodePropertyData.cpp
|
||||
# nsUnicodeScriptCodes.h
|
||||
#
|
||||
# in the current directory.
|
||||
|
||||
use strict;
|
||||
|
||||
if ($#ARGV != 1) {
|
||||
print <<__EOT;
|
||||
# Run this tool using a command line of the form
|
||||
#
|
||||
# perl genUnicodePropertyData.pl \
|
||||
# /path/to/hb-common.h \
|
||||
# /path/to/UCD-directory
|
||||
#
|
||||
# where hb-common.h is currently found in the gfx/harfbuzz/src directory,
|
||||
# and UCD-directory is a directory containing the current Unicode Character
|
||||
# Database files (UnicodeData.txt, etc), available from
|
||||
# http://www.unicode.org/Public/UNIDATA/
|
||||
#
|
||||
# This will generate (or overwrite!) the files
|
||||
#
|
||||
# nsUnicodePropertyData.cpp
|
||||
# nsUnicodeScriptCodes.h
|
||||
#
|
||||
# in the current directory.
|
||||
__EOT
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# load HB_Script and HB_Category constants
|
||||
|
||||
# NOTE that HB_SCRIPT_* constants are now "tag" values, NOT sequentially-allocated
|
||||
@ -89,7 +112,7 @@ my %catCode;
|
||||
my @scriptCodeToTag;
|
||||
my @scriptCodeToName;
|
||||
|
||||
open FH, "< $ARGV[0]" or die "can't open $ARGV[0] (header file hb-unicode.h)\n";
|
||||
open FH, "< $ARGV[0]" or die "can't open $ARGV[0] (should be header file hb-common.h)\n";
|
||||
while (<FH>) {
|
||||
if (m/HB_SCRIPT_([A-Z_]+)\s*=\s*HB_TAG\s*\(('.','.','.','.')\)\s*,/) {
|
||||
$scriptCodeToTag[++$sc] = $2;
|
||||
@ -294,7 +317,7 @@ close FH;
|
||||
|
||||
my $timestamp = gmtime();
|
||||
|
||||
open DATA_TABLES, "> gfxUnicodePropertyData.cpp" or die "unable to open gfxUnicodePropertyData.cpp for output";
|
||||
open DATA_TABLES, "> nsUnicodePropertyData.cpp" or die "unable to open nsUnicodePropertyData.cpp for output";
|
||||
|
||||
my $licenseBlock = q[
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
@ -332,7 +355,7 @@ my $licenseBlock = q[
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* Derived from the Unicode Character Database by genUnicodeScriptData.pl
|
||||
* Derived from the Unicode Character Database by genUnicodePropertyData.pl
|
||||
*
|
||||
* For Unicode terms of use, see http://www.unicode.org/terms_of_use.html
|
||||
*
|
||||
@ -486,7 +509,7 @@ __END
|
||||
|
||||
close DATA_TABLES;
|
||||
|
||||
open HEADER, "> gfxUnicodeScriptCodes.h" or die "unable to open gfxUnicodeScriptCodes.h for output";
|
||||
open HEADER, "> nsUnicodeScriptCodes.h" or die "unable to open nsUnicodeScriptCodes.h for output";
|
||||
|
||||
print HEADER <<__END;
|
||||
$licenseBlock
|
||||
@ -500,8 +523,8 @@ $versionInfo
|
||||
* * * * * This file contains MACHINE-GENERATED DATA, do not edit! * * * * *
|
||||
*/
|
||||
|
||||
#ifndef GFX_UNICODE_SCRIPT_CODES
|
||||
#define GFX_UNICODE_SCRIPT_CODES
|
||||
#ifndef NS_UNICODE_SCRIPT_CODES
|
||||
#define NS_UNICODE_SCRIPT_CODES
|
||||
__END
|
||||
|
||||
print HEADER "enum {\n";
|
@ -54,7 +54,7 @@
|
||||
#include "nsPlaceholderFrame.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsFirstLetterFrame.h"
|
||||
#include "gfxUnicodeProperties.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "nsTextFrame.h"
|
||||
|
||||
#undef NOISY_BIDI
|
||||
@ -2020,7 +2020,7 @@ void nsBidiPresUtils::WriteReverse(const PRUnichar* aSrc,
|
||||
UTF32Char = *src;
|
||||
}
|
||||
|
||||
UTF32Char = gfxUnicodeProperties::GetMirroredChar(UTF32Char);
|
||||
UTF32Char = mozilla::unicode::GetMirroredChar(UTF32Char);
|
||||
|
||||
if (IS_IN_BMP(UTF32Char)) {
|
||||
*(dest++) = UTF32Char;
|
||||
|
Loading…
x
Reference in New Issue
Block a user