mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 22:37:50 +00:00
parent
4f0ed5535a
commit
6f72f9fad0
@ -232,8 +232,7 @@ static nsIUnicodeEncoder* gUserDefinedConverter = nsnull;
|
||||
static nsHashtable* gAliases = nsnull;
|
||||
static nsHashtable* gCharSetMaps = nsnull;
|
||||
static nsHashtable* gFamilies = nsnull;
|
||||
static nsHashtable* gFFRENodes = nsnull;
|
||||
static nsHashtable* gAFRENodes = nsnull;
|
||||
static nsHashtable* gNodes = nsnull;
|
||||
// gCachedFFRESearches holds the "already looked up"
|
||||
// FFRE (Foundry Family Registry Encoding) font searches
|
||||
static nsHashtable* gCachedFFRESearches = nsnull;
|
||||
@ -765,15 +764,10 @@ FreeGlobals(void)
|
||||
delete gCachedFFRESearches;
|
||||
gCachedFFRESearches = nsnull;
|
||||
}
|
||||
if (gFFRENodes) {
|
||||
gFFRENodes->Reset(FreeNode, nsnull);
|
||||
delete gFFRENodes;
|
||||
gFFRENodes = nsnull;
|
||||
}
|
||||
if (gAFRENodes) {
|
||||
gAFRENodes->Reset(FreeNode, nsnull);
|
||||
delete gAFRENodes;
|
||||
gAFRENodes = nsnull;
|
||||
if (gNodes) {
|
||||
gNodes->Reset(FreeNode, nsnull);
|
||||
delete gNodes;
|
||||
gNodes = nsnull;
|
||||
}
|
||||
NS_IF_RELEASE(gPref);
|
||||
if (gSpecialCharSets) {
|
||||
@ -926,13 +920,8 @@ InitGlobals(void)
|
||||
SIZE_FONT_PRINTF(("gBitmapUndersize = %g", gBitmapUndersize));
|
||||
}
|
||||
|
||||
gFFRENodes = new nsHashtable();
|
||||
if (!gFFRENodes) {
|
||||
FreeGlobals();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
gAFRENodes = new nsHashtable();
|
||||
if (!gAFRENodes) {
|
||||
gNodes = new nsHashtable();
|
||||
if (!gNodes) {
|
||||
FreeGlobals();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -2741,11 +2730,7 @@ nsFontMetricsGTK::PickASizeAndLoad(nsFontStretch* aStretch,
|
||||
|
||||
// if we do not have the correct size
|
||||
// check if we can use a scaled font
|
||||
// (when the size of a hand tuned font is close to the desired size
|
||||
// favor it over outline scaled font)
|
||||
if (( (bitmap_size < mPixelSize-(mPixelSize/10))
|
||||
|| (bitmap_size > mPixelSize+(mPixelSize/10)))
|
||||
&& (aStretch->mScalable)) {
|
||||
if ((mPixelSize != bitmap_size) && (aStretch->mScalable)) {
|
||||
// if we have an outline font then use that
|
||||
// if it is allowed to be closer than the bitmap
|
||||
if (aStretch->mOutlineScaled) {
|
||||
@ -3296,133 +3281,8 @@ SetFontLangGroupInfo(nsFontCharSetMap* aCharSetMap)
|
||||
}
|
||||
}
|
||||
|
||||
static nsFontStyle*
|
||||
NodeGetStyle(nsFontNode* aNode, int aStyleIndex)
|
||||
{
|
||||
nsFontStyle* style = aNode->mStyles[aStyleIndex];
|
||||
if (!style) {
|
||||
style = new nsFontStyle;
|
||||
if (!style) {
|
||||
return nsnull;
|
||||
}
|
||||
aNode->mStyles[aStyleIndex] = style;
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
static nsFontWeight*
|
||||
NodeGetWeight(nsFontStyle* aStyle, int aWeightIndex)
|
||||
{
|
||||
nsFontWeight* weight = aStyle->mWeights[aWeightIndex];
|
||||
if (!weight) {
|
||||
weight = new nsFontWeight;
|
||||
if (!weight) {
|
||||
return nsnull;
|
||||
}
|
||||
aStyle->mWeights[aWeightIndex] = weight;
|
||||
}
|
||||
return weight;
|
||||
}
|
||||
|
||||
static nsFontStretch*
|
||||
NodeGetStretch(nsFontWeight* aWeight, int aStretchIndex)
|
||||
{
|
||||
nsFontStretch* stretch = aWeight->mStretches[aStretchIndex];
|
||||
if (!stretch) {
|
||||
stretch = new nsFontStretch;
|
||||
if (!stretch) {
|
||||
return nsnull;
|
||||
}
|
||||
aWeight->mStretches[aStretchIndex] = stretch;
|
||||
}
|
||||
return stretch;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
NodeAddScalable(nsFontStretch* aStretch, PRBool aOutlineScaled,
|
||||
const char *aDashFoundry, const char *aFamily,
|
||||
const char *aWeight, const char * aSlant,
|
||||
const char *aWidth, const char *aStyle,
|
||||
const char *aSpacing, const char *aCharSet)
|
||||
{
|
||||
// if we have both an outline scaled font and a bitmap
|
||||
// scaled font pick the outline scaled font
|
||||
if ((aStretch->mScalable) && (!aStretch->mOutlineScaled)
|
||||
&& (aOutlineScaled)) {
|
||||
PR_smprintf_free(aStretch->mScalable);
|
||||
aStretch->mScalable = nsnull;
|
||||
}
|
||||
if (!aStretch->mScalable) {
|
||||
aStretch->mOutlineScaled = aOutlineScaled;
|
||||
if (aOutlineScaled) {
|
||||
aStretch->mScalable =
|
||||
PR_smprintf("%s-%s-%s-%s-%s-%s-%%d-*-0-0-%s-*-%s",
|
||||
aDashFoundry, aFamily, aWeight, aSlant, aWidth, aStyle,
|
||||
aSpacing, aCharSet);
|
||||
if (!aStretch->mScalable)
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
aStretch->mScalable =
|
||||
PR_smprintf("%s-%s-%s-%s-%s-%s-%%d-*-*-*-%s-*-%s",
|
||||
aDashFoundry, aFamily, aWeight, aSlant, aWidth, aStyle,
|
||||
aSpacing, aCharSet);
|
||||
if (!aStretch->mScalable)
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
NodeAddSize(nsFontStretch* aStretch, int aSize, const char *aName,
|
||||
nsFontCharSetInfo* aCharSetInfo)
|
||||
{
|
||||
PRBool haveSize = PR_FALSE;
|
||||
if (aStretch->mSizesCount) {
|
||||
nsFontGTK** end = &aStretch->mSizes[aStretch->mSizesCount];
|
||||
nsFontGTK** s;
|
||||
for (s = aStretch->mSizes; s < end; s++) {
|
||||
if ((*s)->mSize == aSize) {
|
||||
haveSize = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!haveSize) {
|
||||
if (aStretch->mSizesCount == aStretch->mSizesAlloc) {
|
||||
int newSize = 2 * (aStretch->mSizesAlloc ? aStretch->mSizesAlloc : 1);
|
||||
nsFontGTK** newSizes = new nsFontGTK*[newSize];
|
||||
if (!newSizes)
|
||||
return PR_FALSE;
|
||||
for (int j = aStretch->mSizesAlloc - 1; j >= 0; j--) {
|
||||
newSizes[j] = aStretch->mSizes[j];
|
||||
}
|
||||
aStretch->mSizesAlloc = newSize;
|
||||
delete [] aStretch->mSizes;
|
||||
aStretch->mSizes = newSizes;
|
||||
}
|
||||
char* copy = PR_smprintf("%s", aName);
|
||||
if (!copy) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsFontGTK* size = new nsFontGTKNormal();
|
||||
if (!size) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
aStretch->mSizes[aStretch->mSizesCount++] = size;
|
||||
size->mName = copy;
|
||||
// size->mFont is initialized in the constructor
|
||||
size->mSize = aSize;
|
||||
size->mBaselineAdjust = 0;
|
||||
size->mCCMap = nsnull;
|
||||
size->mCharSetInfo = aCharSetInfo;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes)
|
||||
GetFontNames(const char* aPattern, nsFontNodeArray* aNodes)
|
||||
{
|
||||
#ifdef NS_FONT_DEBUG_CALL_TRACE
|
||||
if (gDebug & NS_FONT_DEBUG_CALL_TRACE) {
|
||||
@ -3431,14 +3291,6 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes)
|
||||
#endif
|
||||
|
||||
nsCAutoString previousNodeName;
|
||||
nsHashtable* node_hash;
|
||||
if (aAnyFoundry) {
|
||||
NS_ASSERTION(aPattern[1] == '*', "invalid 'anyFoundry' pattern");
|
||||
node_hash = gAFRENodes;
|
||||
}
|
||||
else {
|
||||
node_hash = gFFRENodes;
|
||||
}
|
||||
|
||||
/*
|
||||
* We do not use XListFontsWithInfo here, because it is very expensive.
|
||||
@ -3548,18 +3400,6 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes)
|
||||
FIND_FIELD(averageWidth);
|
||||
if (averageWidth[0] == '0') {
|
||||
scalable = 1;
|
||||
/* Workaround for bug 103159 ("sorting fonts by foundry names cause font
|
||||
* size of css ignored in some cases").
|
||||
* Hardcoded font ban until bug 104075 ("need X font banning") has been
|
||||
* implemented. See http://bugzilla.mozilla.org/show_bug.cgi?id=94327#c34
|
||||
* for additional comments...
|
||||
*/
|
||||
#ifndef ENABLE_X_FONT_BANNING
|
||||
// skip 'mysterious' and 'spurious' cases like
|
||||
// -adobe-times-medium-r-normal--17-120-100-100-p-0-iso8859-9
|
||||
if (pixelSize[0] != '0' || pointSize[0] != 0 )
|
||||
continue;
|
||||
#endif /* ENABLE_X_FONT_BANNING */
|
||||
}
|
||||
char* charSetName = p; // CHARSET_REGISTRY & CHARSET_ENCODING
|
||||
if (!*charSetName) {
|
||||
@ -3591,27 +3431,22 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes)
|
||||
SetCharsetLangGroup(charSetInfo);
|
||||
SetFontLangGroupInfo(charSetMap);
|
||||
|
||||
nsCAutoString nodeName;
|
||||
if (aAnyFoundry)
|
||||
nodeName.Assign('*');
|
||||
else
|
||||
nodeName.Assign(foundry);
|
||||
nsCAutoString nodeName(foundry);
|
||||
nodeName.Append('-');
|
||||
nodeName.Append(familyName);
|
||||
nodeName.Append('-');
|
||||
nodeName.Append(charSetName);
|
||||
nsCStringKey key(nodeName);
|
||||
nsFontNode* node = (nsFontNode*) node_hash->Get(&key);
|
||||
nsFontNode* node = (nsFontNode*) gNodes->Get(&key);
|
||||
if (!node) {
|
||||
node = new nsFontNode;
|
||||
if (!node) {
|
||||
continue;
|
||||
}
|
||||
node_hash->Put(&key, node);
|
||||
gNodes->Put(&key, node);
|
||||
node->mName = nodeName;
|
||||
node->mCharSetInfo = charSetInfo;
|
||||
}
|
||||
|
||||
int found = 0;
|
||||
if (nodeName == previousNodeName) {
|
||||
found = 1;
|
||||
@ -3638,9 +3473,14 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes)
|
||||
styleIndex = NS_FONT_STYLE_NORMAL;
|
||||
break;
|
||||
}
|
||||
nsFontStyle* style = NodeGetStyle(node, styleIndex);
|
||||
if (!style)
|
||||
continue;
|
||||
nsFontStyle* style = node->mStyles[styleIndex];
|
||||
if (!style) {
|
||||
style = new nsFontStyle;
|
||||
if (!style) {
|
||||
continue;
|
||||
}
|
||||
node->mStyles[styleIndex] = style;
|
||||
}
|
||||
|
||||
nsCStringKey weightKey(weightName);
|
||||
int weightNumber = NS_PTR_TO_INT32(gWeights->Get(&weightKey));
|
||||
@ -3651,9 +3491,14 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes)
|
||||
weightNumber = NS_FONT_WEIGHT_NORMAL;
|
||||
}
|
||||
int weightIndex = WEIGHT_INDEX(weightNumber);
|
||||
nsFontWeight* weight = NodeGetWeight(style, weightIndex);
|
||||
if (!weight)
|
||||
continue;
|
||||
nsFontWeight* weight = style->mWeights[weightIndex];
|
||||
if (!weight) {
|
||||
weight = new nsFontWeight;
|
||||
if (!weight) {
|
||||
continue;
|
||||
}
|
||||
style->mWeights[weightIndex] = weight;
|
||||
}
|
||||
|
||||
nsCStringKey setWidthKey(setWidth);
|
||||
int stretchIndex = NS_PTR_TO_INT32(gStretches->Get(&setWidthKey));
|
||||
@ -3664,16 +3509,68 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes)
|
||||
stretchIndex = 5;
|
||||
}
|
||||
stretchIndex--;
|
||||
nsFontStretch* stretch = NodeGetStretch(weight, stretchIndex);
|
||||
if (!stretch)
|
||||
continue;
|
||||
|
||||
if (scalable) {
|
||||
if (!NodeAddScalable(stretch, outline_scaled, name, familyName,
|
||||
weightName, slant, setWidth, addStyle, spacing, charSetName))
|
||||
nsFontStretch* stretch = weight->mStretches[stretchIndex];
|
||||
if (!stretch) {
|
||||
stretch = new nsFontStretch;
|
||||
if (!stretch) {
|
||||
continue;
|
||||
}
|
||||
weight->mStretches[stretchIndex] = stretch;
|
||||
}
|
||||
if (scalable) {
|
||||
// if we have both an outline scaled font and a bitmap
|
||||
// scaled font pick the outline scaled font
|
||||
if ((stretch->mScalable) && (!stretch->mOutlineScaled)
|
||||
&& (outline_scaled)) {
|
||||
PR_smprintf_free(stretch->mScalable);
|
||||
stretch->mScalable = nsnull;
|
||||
}
|
||||
if (!stretch->mScalable) {
|
||||
stretch->mOutlineScaled = outline_scaled;
|
||||
if (outline_scaled) {
|
||||
stretch->mScalable =
|
||||
PR_smprintf("%s-%s-%s-%s-%s-%s-%%d-*-0-0-%s-*-%s",
|
||||
name, familyName, weightName, slant, setWidth, addStyle,
|
||||
spacing, charSetName);
|
||||
}
|
||||
else {
|
||||
stretch->mScalable =
|
||||
PR_smprintf("%s-%s-%s-%s-%s-%s-%%d-*-*-*-%s-*-%s",
|
||||
name, familyName, weightName, slant, setWidth, addStyle,
|
||||
spacing, charSetName);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
int pixels = atoi(pixelSize);
|
||||
if (stretch->mSizesCount) {
|
||||
nsFontGTK** end = &stretch->mSizes[stretch->mSizesCount];
|
||||
nsFontGTK** s;
|
||||
for (s = stretch->mSizes; s < end; s++) {
|
||||
if ((*s)->mSize == pixels) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (s != end) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (stretch->mSizesCount == stretch->mSizesAlloc) {
|
||||
int newSize = 2 * (stretch->mSizesAlloc ? stretch->mSizesAlloc : 1);
|
||||
nsFontGTK** newPointer = new nsFontGTK*[newSize];
|
||||
if (newPointer) {
|
||||
for (int j = stretch->mSizesAlloc - 1; j >= 0; j--) {
|
||||
newPointer[j] = stretch->mSizes[j];
|
||||
}
|
||||
stretch->mSizesAlloc = newSize;
|
||||
delete [] stretch->mSizes;
|
||||
stretch->mSizes = newPointer;
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
p = name;
|
||||
while (p < charSetName) {
|
||||
if (!*p) {
|
||||
@ -3681,10 +3578,21 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArray* aNodes)
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
int pixels = atoi(pixelSize);
|
||||
if (!NodeAddSize(stretch, pixels, name, charSetInfo))
|
||||
char* copy = PR_smprintf("%s", name);
|
||||
if (!copy) {
|
||||
continue;
|
||||
}
|
||||
nsFontGTK* size = new nsFontGTKNormal();
|
||||
if (!size) {
|
||||
continue;
|
||||
}
|
||||
stretch->mSizes[stretch->mSizesCount++] = size;
|
||||
size->mName = copy;
|
||||
// size->mFont is initialized in the constructor
|
||||
size->mSize = pixels;
|
||||
size->mBaselineAdjust = 0;
|
||||
size->mCCMap = nsnull;
|
||||
size->mCharSetInfo = charSetInfo;
|
||||
}
|
||||
XFreeFontNames(list);
|
||||
|
||||
@ -3703,9 +3611,7 @@ GetAllFontNames(void)
|
||||
if (!gGlobalList) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
/* Using "-*" instead of the full-qualified "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
|
||||
* because it's faster and "smarter" - see bug 34242 for details. */
|
||||
GetFontNames("-*", PR_FALSE, gGlobalList);
|
||||
GetFontNames("-*", gGlobalList);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -3722,7 +3628,7 @@ FindFamily(nsCString* aName)
|
||||
char pattern[256];
|
||||
PR_snprintf(pattern, sizeof(pattern), "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*",
|
||||
aName->get());
|
||||
GetFontNames(pattern, PR_TRUE, &family->mNodes);
|
||||
GetFontNames(pattern, &family->mNodes);
|
||||
gFamilies->Put(&key, family);
|
||||
}
|
||||
}
|
||||
@ -3801,9 +3707,7 @@ nsFontMetricsGTK::TryNodes(nsAWritableCString &aFFREName, PRUnichar aChar)
|
||||
{
|
||||
FIND_FONT_PRINTF((" TryNodes aFFREName = %s",
|
||||
PromiseFlatCString(aFFREName).get()));
|
||||
const char *FFREName = PromiseFlatCString(aFFREName).get();
|
||||
nsCStringKey key(FFREName);
|
||||
PRBool anyFoundry = (FFREName[0] == '*');
|
||||
nsCStringKey key(PromiseFlatCString(aFFREName).get());
|
||||
nsFontNodeArray* nodes = (nsFontNodeArray*) gCachedFFRESearches->Get(&key);
|
||||
if (!nodes) {
|
||||
nsCAutoString pattern;
|
||||
@ -3811,7 +3715,7 @@ nsFontMetricsGTK::TryNodes(nsAWritableCString &aFFREName, PRUnichar aChar)
|
||||
nodes = new nsFontNodeArray;
|
||||
if (!nodes)
|
||||
return nsnull;
|
||||
GetFontNames(pattern.get(), anyFoundry, nodes);
|
||||
GetFontNames(pattern.get(), nodes);
|
||||
gCachedFFRESearches->Put(&key, nodes);
|
||||
}
|
||||
int i, cnt = nodes->Count();
|
||||
@ -3835,16 +3739,17 @@ nsFontMetricsGTK::TryNode(nsCString* aName, PRUnichar aChar)
|
||||
nsFontGTK* font;
|
||||
|
||||
nsCStringKey key(*aName);
|
||||
nsFontNode* node = (nsFontNode*) gFFRENodes->Get(&key);
|
||||
nsFontNode* node = (nsFontNode*) gNodes->Get(&key);
|
||||
if (!node) {
|
||||
nsCAutoString pattern;
|
||||
FFREToXLFDPattern(*aName, pattern);
|
||||
nsFontNodeArray nodes;
|
||||
GetFontNames(pattern.get(), PR_FALSE, &nodes);
|
||||
// no need to call gFFRENodes->Put() since GetFontNames already did
|
||||
GetFontNames(pattern.get(), &nodes);
|
||||
// no need to call gNodes->Put() since GetFontNames already did
|
||||
if (nodes.Count() > 0) {
|
||||
// This assertion is not spurious; when searching for an FFRE
|
||||
// like -*-courier-iso8859-1 TryNodes should be called not TryNode
|
||||
// XXX This assertion may be spurious; you can have more than
|
||||
// -*-courier-iso8859-1 font, for example, from different
|
||||
// foundries.
|
||||
NS_ASSERTION((nodes.Count() == 1), "unexpected number of nodes");
|
||||
node = nodes.GetElement(0);
|
||||
}
|
||||
@ -3854,7 +3759,7 @@ nsFontMetricsGTK::TryNode(nsCString* aName, PRUnichar aChar)
|
||||
if (!node) {
|
||||
return nsnull;
|
||||
}
|
||||
gFFRENodes->Put(&key, node);
|
||||
gNodes->Put(&key, node);
|
||||
node->mDummy = 1;
|
||||
}
|
||||
}
|
||||
@ -4383,10 +4288,10 @@ nsFontMetricsGTK::FindLangGroupFont(nsIAtom* aLangGroup, PRUnichar aChar, nsCStr
|
||||
}
|
||||
// look for a font with this charset (registry-encoding) & char
|
||||
//
|
||||
nsCAutoString ffreName;
|
||||
nsCAutoString ffreName("");
|
||||
if(aName) {
|
||||
// if aName was specified so call TryNode() not TryNodes()
|
||||
ffreName.Assign(*aName);
|
||||
ffreName.Append(*aName);
|
||||
FFRESubstituteCharset(ffreName, charSetMap->mName);
|
||||
FIND_FONT_PRINTF((" %s ffre = %s", charSetMap->mName, ffreName.get()));
|
||||
if(aName->First() == '*') {
|
||||
@ -4398,7 +4303,7 @@ nsFontMetricsGTK::FindLangGroupFont(nsIAtom* aLangGroup, PRUnichar aChar, nsCStr
|
||||
NS_ASSERTION(font ? font->SupportsChar(aChar) : 1, "font supposed to support this char");
|
||||
} else {
|
||||
// no name was specified so call TryNodes() for this charset
|
||||
ffreName.Assign("*-*-*-*");
|
||||
ffreName.Append("*-*-*-*");
|
||||
FFRESubstituteCharset(ffreName, charSetMap->mName);
|
||||
FIND_FONT_PRINTF((" %s ffre = %s", charSetMap->mName, ffreName.get()));
|
||||
font = TryNodes(ffreName, aChar);
|
||||
|
@ -60,7 +60,6 @@
|
||||
#include "nsAWritableString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <X11/Xatom.h>
|
||||
#ifdef USE_XPRINT
|
||||
#include <X11/extensions/Print.h>
|
||||
@ -209,8 +208,7 @@ static nsIUnicodeEncoder* gUserDefinedConverter = nsnull;
|
||||
static nsHashtable* gAliases = nsnull;
|
||||
static nsHashtable* gCharSetMaps = nsnull;
|
||||
static nsHashtable* gFamilies = nsnull;
|
||||
static nsHashtable* gFFRENodes = nsnull;
|
||||
static nsHashtable* gAFRENodes = nsnull;
|
||||
static nsHashtable* gNodes = nsnull;
|
||||
/* gCachedFFRESearches holds the "already looked up"
|
||||
FFRE (Foundry Family Registry Encoding) font searches */
|
||||
static nsHashtable* gCachedFFRESearches = nsnull;
|
||||
@ -727,16 +725,10 @@ nsFontMetricsXlib::FreeGlobals(void)
|
||||
gCachedFFRESearches = nsnull;
|
||||
}
|
||||
|
||||
if (gFFRENodes) {
|
||||
gFFRENodes->Reset(FreeNode, nsnull);
|
||||
delete gFFRENodes;
|
||||
gFFRENodes = nsnull;
|
||||
}
|
||||
|
||||
if (gAFRENodes) {
|
||||
gAFRENodes->Reset(FreeNode, nsnull);
|
||||
delete gAFRENodes;
|
||||
gAFRENodes = nsnull;
|
||||
if (gNodes) {
|
||||
gNodes->Reset(FreeNode, nsnull);
|
||||
delete gNodes;
|
||||
gNodes = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(gPref);
|
||||
@ -841,14 +833,8 @@ nsFontMetricsXlib::InitGlobals(nsIDeviceContext *aDevice)
|
||||
if (percent)
|
||||
gBitmapUndersize = percent / 100.0;
|
||||
|
||||
gFFRENodes = new nsHashtable();
|
||||
if (!gFFRENodes) {
|
||||
FreeGlobals();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
gAFRENodes = new nsHashtable();
|
||||
if (!gAFRENodes) {
|
||||
gNodes = new nsHashtable();
|
||||
if (!gNodes) {
|
||||
FreeGlobals();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -2616,11 +2602,7 @@ nsFontMetricsXlib::PickASizeAndLoad(nsFontStretchXlib* aStretch,
|
||||
#endif /* !ABS */
|
||||
// if we do not have the correct size
|
||||
// check if we can use a scaled font
|
||||
// (when the size of a hand tuned font is close to the desired size
|
||||
// favor it over outline scaled font)
|
||||
if (( (bitmap_size < mPixelSize-(mPixelSize/10))
|
||||
|| (bitmap_size > mPixelSize+(mPixelSize/10)))
|
||||
&& (aStretch->mScalable)) {
|
||||
if ((mPixelSize != bitmap_size) && (aStretch->mScalable)) {
|
||||
// if we have an outline font then use that
|
||||
// if it is allowed to be closer than the bitmap
|
||||
if (aStretch->mOutlineScaled) {
|
||||
@ -2645,7 +2627,7 @@ nsFontMetricsXlib::PickASizeAndLoad(nsFontStretchXlib* aStretch,
|
||||
|
||||
NS_ASSERTION((bitmap_size < NOT_FOUND_FONT_SIZE) || use_scaled_font, "did not find font size");
|
||||
|
||||
if (use_scaled_font && aStretch->mScalable) {
|
||||
if (use_scaled_font) {
|
||||
PRInt32 i;
|
||||
PRInt32 n = aStretch->mScaledFonts.Count();
|
||||
nsFontXlib *p = nsnull;
|
||||
@ -3091,154 +3073,11 @@ SetFontLangGroupInfo(nsFontCharSetMapXlib* aCharSetMap)
|
||||
}
|
||||
}
|
||||
|
||||
static nsFontStyleXlib*
|
||||
NodeGetStyle(nsFontNodeXlib* aNode, int aStyleIndex)
|
||||
{
|
||||
nsFontStyleXlib* style = aNode->mStyles[aStyleIndex];
|
||||
if (!style) {
|
||||
style = new nsFontStyleXlib;
|
||||
if (!style) {
|
||||
return nsnull;
|
||||
}
|
||||
aNode->mStyles[aStyleIndex] = style;
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
static nsFontWeightXlib*
|
||||
NodeGetWeight(nsFontStyleXlib* aStyle, int aWeightIndex)
|
||||
{
|
||||
nsFontWeightXlib* weight = aStyle->mWeights[aWeightIndex];
|
||||
if (!weight) {
|
||||
weight = new nsFontWeightXlib;
|
||||
if (!weight) {
|
||||
return nsnull;
|
||||
}
|
||||
aStyle->mWeights[aWeightIndex] = weight;
|
||||
}
|
||||
return weight;
|
||||
}
|
||||
|
||||
static nsFontStretchXlib*
|
||||
NodeGetStretch(nsFontWeightXlib* aWeight, int aStretchIndex)
|
||||
{
|
||||
nsFontStretchXlib* stretch = aWeight->mStretches[aStretchIndex];
|
||||
if (!stretch) {
|
||||
stretch = new nsFontStretchXlib;
|
||||
if (!stretch) {
|
||||
return nsnull;
|
||||
}
|
||||
aWeight->mStretches[aStretchIndex] = stretch;
|
||||
}
|
||||
return stretch;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
NodeAddScalable(nsFontStretchXlib* aStretch, PRBool aOutlineScaled,
|
||||
const char *aDashFoundry, const char *aFamily,
|
||||
const char *aWeight, const char *aSlant,
|
||||
const char *aWidth, const char *aStyle,
|
||||
const char *aSpacing, const char *aCharSet)
|
||||
{
|
||||
#ifdef USE_XPRINT
|
||||
/* gisburn: disabled for Xprint - this kills printer buildin fonts
|
||||
* Xprint printer-buildin fonts look like bitmap scaled fonts but are
|
||||
* (scaleable) printer-buildin fonts in reality.
|
||||
*/
|
||||
if (nsFontMetricsXlib::mPrinterMode)
|
||||
return PR_TRUE;
|
||||
#endif /* USE_XPRINT */
|
||||
|
||||
// if we have both an outline scaled font and a bitmap
|
||||
// scaled font pick the outline scaled font
|
||||
if ((aStretch->mScalable) && (!aStretch->mOutlineScaled)
|
||||
&& (aOutlineScaled)) {
|
||||
PR_smprintf_free(aStretch->mScalable);
|
||||
aStretch->mScalable = nsnull;
|
||||
}
|
||||
if (!aStretch->mScalable) {
|
||||
aStretch->mOutlineScaled = aOutlineScaled;
|
||||
if (aOutlineScaled) {
|
||||
aStretch->mScalable =
|
||||
PR_smprintf("%s-%s-%s-%s-%s-%s-%%d-*-0-0-%s-*-%s",
|
||||
aDashFoundry, aFamily, aWeight, aSlant, aWidth, aStyle,
|
||||
aSpacing, aCharSet);
|
||||
if (!aStretch->mScalable)
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
aStretch->mScalable =
|
||||
PR_smprintf("%s-%s-%s-%s-%s-%s-%%d-*-*-*-%s-*-%s",
|
||||
aDashFoundry, aFamily, aWeight, aSlant, aWidth, aStyle,
|
||||
aSpacing, aCharSet);
|
||||
if (!aStretch->mScalable)
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
NodeAddSize(nsFontStretchXlib* aStretch, int aSize, const char *aName,
|
||||
nsFontCharSetXlibInfo* aCharSetInfo)
|
||||
{
|
||||
PRBool haveSize = PR_FALSE;
|
||||
if (aStretch->mSizesCount) {
|
||||
nsFontXlib** end = &aStretch->mSizes[aStretch->mSizesCount];
|
||||
nsFontXlib** s;
|
||||
for (s = aStretch->mSizes; s < end; s++) {
|
||||
if ((*s)->mSize == aSize) {
|
||||
haveSize = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!haveSize) {
|
||||
if (aStretch->mSizesCount == aStretch->mSizesAlloc) {
|
||||
int newSize = 2 * (aStretch->mSizesAlloc ? aStretch->mSizesAlloc : 1);
|
||||
nsFontXlib** newSizes = new nsFontXlib*[newSize];
|
||||
if (!newSizes)
|
||||
return PR_FALSE;
|
||||
for (int j = aStretch->mSizesAlloc - 1; j >= 0; j--) {
|
||||
newSizes[j] = aStretch->mSizes[j];
|
||||
}
|
||||
aStretch->mSizesAlloc = newSize;
|
||||
delete [] aStretch->mSizes;
|
||||
aStretch->mSizes = newSizes;
|
||||
}
|
||||
char* copy = PR_smprintf("%s", aName);
|
||||
if (!copy) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
nsFontXlib* size = new nsFontXlibNormal();
|
||||
if (!size) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
aStretch->mSizes[aStretch->mSizesCount++] = size;
|
||||
size->mName = copy;
|
||||
// size->mFont is initialized in the constructor
|
||||
size->mSize = aSize;
|
||||
size->mBaselineAdjust = 0;
|
||||
size->mCCMap = nsnull;
|
||||
size->mCharSetInfo = aCharSetInfo;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArrayXlib * aNodes)
|
||||
GetFontNames(const char* aPattern, nsFontNodeArrayXlib* aNodes)
|
||||
{
|
||||
nsCAutoString previousNodeName;
|
||||
Display *dpy = xxlib_rgb_get_display(gXlibRgbHandle);
|
||||
nsCAutoString previousNodeName;
|
||||
nsHashtable *node_hash;
|
||||
|
||||
if (aAnyFoundry) {
|
||||
NS_ASSERTION(aPattern[1] == '*', "invalid 'anyFoundry' pattern");
|
||||
node_hash = gAFRENodes;
|
||||
}
|
||||
else {
|
||||
node_hash = gFFRENodes;
|
||||
}
|
||||
|
||||
#ifdef USE_XPRINT
|
||||
#ifdef DEBUG
|
||||
@ -3354,24 +3193,6 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArrayXlib * aNo
|
||||
FIND_FIELD(averageWidth);
|
||||
if (averageWidth[0] == '0') {
|
||||
scalable = 1;
|
||||
/* Workaround for bug 103159 ("sorting fonts by foundry names cause font
|
||||
* size of css ignored in some cases").
|
||||
* Hardcoded font ban until bug 104075 ("need X font banning") has been
|
||||
* implemented. See http://bugzilla.mozilla.org/show_bug.cgi?id=94327#c34
|
||||
* for additional comments...
|
||||
*/
|
||||
#ifndef ENABLE_X_FONT_BANNING
|
||||
#ifdef USE_XPRINT
|
||||
/* The following check kills Xprint printer-buildin fonts... ;-( */
|
||||
if (!nsFontMetricsXlib::mPrinterMode)
|
||||
#endif /* USE_XPRINT */
|
||||
{
|
||||
// skip 'mysterious' and 'spurious' cases like
|
||||
// -adobe-times-medium-r-normal--17-120-100-100-p-0-iso8859-9
|
||||
if (pixelSize[0] != '0' || pointSize[0] != 0 )
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLE_X_FONT_BANNING */
|
||||
}
|
||||
char* charSetName = p; // CHARSET_REGISTRY & CHARSET_ENCODING
|
||||
if (!*charSetName) {
|
||||
@ -3404,24 +3225,20 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArrayXlib * aNo
|
||||
SetCharsetLangGroup(charSetInfo);
|
||||
SetFontLangGroupInfo(charSetMap);
|
||||
|
||||
nsCAutoString nodeName;
|
||||
if (aAnyFoundry)
|
||||
nodeName.Assign('*');
|
||||
else
|
||||
nodeName.Assign(foundry);
|
||||
nsCAutoString nodeName(foundry);
|
||||
nodeName.Append('-');
|
||||
nodeName.Append(familyName);
|
||||
nodeName.Append('-');
|
||||
nodeName.Append(charSetName);
|
||||
|
||||
nsCStringKey key(nodeName);
|
||||
nsFontNodeXlib* node = (nsFontNodeXlib*) node_hash->Get(&key);
|
||||
nsFontNodeXlib* node = (nsFontNodeXlib*) gNodes->Get(&key);
|
||||
|
||||
if (!node) {
|
||||
node = new nsFontNodeXlib;
|
||||
if (!node)
|
||||
continue;
|
||||
node_hash->Put(&key, node);
|
||||
gNodes->Put(&key, node);
|
||||
node->mName = nodeName;
|
||||
node->mCharSetInfo = charSetInfo;
|
||||
}
|
||||
@ -3452,9 +3269,14 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArrayXlib * aNo
|
||||
styleIndex = NS_FONT_STYLE_NORMAL;
|
||||
break;
|
||||
}
|
||||
nsFontStyleXlib* style = NodeGetStyle(node, styleIndex);
|
||||
if (!style)
|
||||
continue;
|
||||
nsFontStyleXlib* style = node->mStyles[styleIndex];
|
||||
if (!style) {
|
||||
style = new nsFontStyleXlib;
|
||||
if (!style) {
|
||||
continue;
|
||||
}
|
||||
node->mStyles[styleIndex] = style;
|
||||
}
|
||||
|
||||
nsCStringKey weightKey(weightName);
|
||||
int weightNumber = NS_PTR_TO_INT32(gWeights->Get(&weightKey));
|
||||
@ -3464,9 +3286,14 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArrayXlib * aNo
|
||||
weightNumber = NS_FONT_WEIGHT_NORMAL;
|
||||
}
|
||||
int weightIndex = WEIGHT_INDEX(weightNumber);
|
||||
nsFontWeightXlib *weight = NodeGetWeight(style, weightIndex);
|
||||
if (!weight)
|
||||
continue;
|
||||
nsFontWeightXlib* weight = style->mWeights[weightIndex];
|
||||
if (!weight) {
|
||||
weight = new nsFontWeightXlib;
|
||||
if (!weight) {
|
||||
continue;
|
||||
}
|
||||
style->mWeights[weightIndex] = weight;
|
||||
}
|
||||
|
||||
nsCStringKey setWidthKey(setWidth);
|
||||
int stretchIndex = NS_PTR_TO_INT32(gStretches->Get(&setWidthKey));
|
||||
@ -3476,16 +3303,78 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArrayXlib * aNo
|
||||
stretchIndex = 5;
|
||||
}
|
||||
stretchIndex--;
|
||||
nsFontStretchXlib* stretch = NodeGetStretch(weight, stretchIndex);
|
||||
if (!stretch)
|
||||
continue;
|
||||
|
||||
if (scalable) {
|
||||
if (!NodeAddScalable(stretch, outline_scaled, name, familyName,
|
||||
weightName, slant, setWidth, addStyle, spacing, charSetName))
|
||||
nsFontStretchXlib* stretch = weight->mStretches[stretchIndex];
|
||||
if (!stretch) {
|
||||
stretch = new nsFontStretchXlib;
|
||||
if (!stretch) {
|
||||
continue;
|
||||
}
|
||||
weight->mStretches[stretchIndex] = stretch;
|
||||
}
|
||||
if (scalable) {
|
||||
/* gisburn: disabled for Xprint - this kills printer buildin fonts
|
||||
* Xprint printer-buildin fonts look like bitmap scaled fonts but are
|
||||
* (scaleable) printer-buildin fonts in reality.
|
||||
*/
|
||||
#ifdef USE_XPRINT
|
||||
if(!nsFontMetricsXlib::mPrinterMode)
|
||||
#endif /* USE_XPRINT */
|
||||
{
|
||||
// if we have both an outline scaled font and a bitmap
|
||||
// scaled font pick the outline scaled font
|
||||
if ((stretch->mScalable) && (!stretch->mOutlineScaled)
|
||||
&& (outline_scaled)) {
|
||||
PR_smprintf_free(stretch->mScalable);
|
||||
stretch->mScalable = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
if (!stretch->mScalable) {
|
||||
stretch->mOutlineScaled = outline_scaled;
|
||||
if (outline_scaled) {
|
||||
stretch->mScalable = PR_smprintf("%s-%s-%s-%s-%s-%s-%%d-*-0-0-%s-*-%s",
|
||||
name, familyName, weightName, slant, setWidth, addStyle, spacing, charSetName);
|
||||
}
|
||||
else {
|
||||
stretch->mScalable =
|
||||
PR_smprintf("%s-%s-%s-%s-%s-%s-%%d-*-*-*-%s-*-%s",
|
||||
name, familyName, weightName, slant, setWidth, addStyle,
|
||||
spacing, charSetName);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
int pixels = atoi(pixelSize);
|
||||
NS_ASSERTION((pixels > 0), "unexpected pixel size");
|
||||
|
||||
if (stretch->mSizesCount) {
|
||||
nsFontXlib** end = &stretch->mSizes[stretch->mSizesCount];
|
||||
nsFontXlib** s;
|
||||
for (s = stretch->mSizes; s < end; s++) {
|
||||
if ((*s)->mSize == pixels) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (s != end) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (stretch->mSizesCount == stretch->mSizesAlloc) {
|
||||
int newSize = 2 * (stretch->mSizesAlloc ? stretch->mSizesAlloc : 1);
|
||||
nsFontXlib** newPointer = new nsFontXlib*[newSize];
|
||||
if (newPointer) {
|
||||
for (int j = stretch->mSizesAlloc - 1; j >= 0; j--) {
|
||||
newPointer[j] = stretch->mSizes[j];
|
||||
}
|
||||
stretch->mSizesAlloc = newSize;
|
||||
delete [] stretch->mSizes;
|
||||
stretch->mSizes = newPointer;
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
p = name;
|
||||
while (p < charSetName) {
|
||||
if (!*p) {
|
||||
@ -3494,10 +3383,23 @@ GetFontNames(const char* aPattern, PRBool aAnyFoundry, nsFontNodeArrayXlib * aNo
|
||||
p++;
|
||||
}
|
||||
|
||||
int pixels = atoi(pixelSize);
|
||||
NS_ASSERTION(!((pixels == 0) && (errno == EINVAL)), "unexpected pixel size");
|
||||
if (!NodeAddSize(stretch, pixels, name, charSetInfo))
|
||||
continue;
|
||||
char* copy = PR_smprintf("%s", name);
|
||||
|
||||
if (!copy) {
|
||||
continue;
|
||||
}
|
||||
nsFontXlib* size = new nsFontXlibNormal();
|
||||
if (!size)
|
||||
continue;
|
||||
|
||||
stretch->mSizes[stretch->mSizesCount++] = size;
|
||||
|
||||
size->mName = copy;
|
||||
size->mFont = nsnull;
|
||||
size->mSize = pixels;
|
||||
size->mBaselineAdjust = 0;
|
||||
size->mCCMap = nsnull;
|
||||
size->mCharSetInfo = charSetInfo;
|
||||
}
|
||||
XFreeFontNames(list);
|
||||
|
||||
@ -3518,7 +3420,7 @@ GetAllFontNames(void)
|
||||
}
|
||||
/* Using "-*" instead of the full-qualified "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
|
||||
* because it's faster and "smarter" - see bug 34242 for details. */
|
||||
GetFontNames("-*", PR_FALSE, gGlobalList);
|
||||
GetFontNames("-*", gGlobalList);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -3535,7 +3437,7 @@ FindFamily(nsCString* aName)
|
||||
char pattern[256];
|
||||
PR_snprintf(pattern, sizeof(pattern), "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*",
|
||||
aName->get());
|
||||
GetFontNames(pattern, PR_TRUE, &family->mNodes);
|
||||
GetFontNames(pattern, &family->mNodes);
|
||||
gFamilies->Put(&key, family);
|
||||
}
|
||||
}
|
||||
@ -3602,9 +3504,7 @@ FFRESubstituteEncoding(nsAWritableCString &aFFREName, const char *aReplacementEn
|
||||
nsFontXlib*
|
||||
nsFontMetricsXlib::TryNodes(nsAWritableCString &aFFREName, PRUnichar aChar)
|
||||
{
|
||||
const char *FFREName = PromiseFlatCString(aFFREName).get();
|
||||
nsCStringKey key(FFREName);
|
||||
PRBool anyFoundry = (FFREName[0] == '*');
|
||||
nsCStringKey key(PromiseFlatCString(aFFREName).get());
|
||||
nsFontNodeArrayXlib* nodes = (nsFontNodeArrayXlib*) gCachedFFRESearches->Get(&key);
|
||||
if (!nodes) {
|
||||
nsCAutoString pattern;
|
||||
@ -3612,7 +3512,7 @@ nsFontMetricsXlib::TryNodes(nsAWritableCString &aFFREName, PRUnichar aChar)
|
||||
nodes = new nsFontNodeArrayXlib;
|
||||
if (!nodes)
|
||||
return nsnull;
|
||||
GetFontNames(pattern.get(), anyFoundry, nodes);
|
||||
GetFontNames(pattern.get(), nodes);
|
||||
gCachedFFRESearches->Put(&key, nodes);
|
||||
}
|
||||
int i, cnt = nodes->Count();
|
||||
@ -3633,16 +3533,17 @@ nsFontMetricsXlib::TryNode(nsCString* aName, PRUnichar aChar)
|
||||
nsFontXlib* font;
|
||||
|
||||
nsCStringKey key(*aName);
|
||||
nsFontNodeXlib* node = (nsFontNodeXlib*) gFFRENodes->Get(&key);
|
||||
nsFontNodeXlib* node = (nsFontNodeXlib*) gNodes->Get(&key);
|
||||
if (!node) {
|
||||
nsCAutoString pattern;
|
||||
FFREToXLFDPattern(*aName, pattern);
|
||||
nsFontNodeArrayXlib nodes;
|
||||
GetFontNames(pattern.get(), PR_FALSE, &nodes);
|
||||
// no need to call gFFRENodes->Put() since GetFontNames already did
|
||||
GetFontNames(pattern.get(), &nodes);
|
||||
// no need to call gNodes->Put() since GetFontNames already did
|
||||
if (nodes.Count() > 0) {
|
||||
// This assertion is not spurious; when searching for an FFRE
|
||||
// like -*-courier-iso8859-1 TryNodes should be called not TryNode
|
||||
// XXX This assertion may be spurious; you can have more than
|
||||
// -*-courier-iso8859-1 font, for example, from different
|
||||
// foundries.
|
||||
NS_ASSERTION((nodes.Count() == 1), "unexpected number of nodes");
|
||||
node = nodes.GetElement(0);
|
||||
}
|
||||
@ -3652,7 +3553,7 @@ nsFontMetricsXlib::TryNode(nsCString* aName, PRUnichar aChar)
|
||||
if (!node) {
|
||||
return nsnull;
|
||||
}
|
||||
gFFRENodes->Put(&key, node);
|
||||
gNodes->Put(&key, node);
|
||||
node->mDummy = 1;
|
||||
}
|
||||
}
|
||||
@ -4124,10 +4025,10 @@ nsFontMetricsXlib::FindLangGroupFont(nsIAtom* aLangGroup, PRUnichar aChar, nsCSt
|
||||
|
||||
// look for a font with this charset (registry-encoding) & char
|
||||
//
|
||||
nsCAutoString ffreName;
|
||||
nsCAutoString ffreName("");
|
||||
if (aName) {
|
||||
// if aName was specified so call TryNode() not TryNodes()
|
||||
ffreName.Assign(*aName);
|
||||
ffreName.Append(*aName);
|
||||
FFRESubstituteCharset(ffreName, charSetMap->mName);
|
||||
if(aName->First() == '*') {
|
||||
// called from TryFamily()
|
||||
@ -4138,7 +4039,7 @@ nsFontMetricsXlib::FindLangGroupFont(nsIAtom* aLangGroup, PRUnichar aChar, nsCSt
|
||||
NS_ASSERTION(font ? font->SupportsChar(aChar) : 1, "font supposed to support this char");
|
||||
} else {
|
||||
// no name was specified so call TryNodes() for this charset
|
||||
ffreName.Assign("*-*-*-*");
|
||||
ffreName.Append("*-*-*-*");
|
||||
FFRESubstituteCharset(ffreName, charSetMap->mName);
|
||||
font = TryNodes(ffreName, aChar);
|
||||
NS_ASSERTION(font ? font->SupportsChar(aChar) : 1, "font supposed to support this char");
|
||||
|
Loading…
x
Reference in New Issue
Block a user