disable weight table code for now...

This commit is contained in:
pavlov%pavlov.net 2006-06-15 07:20:19 +00:00
Родитель 26a76bc2a1
Коммит af22ce56da
3 изменённых файлов: 35 добавлений и 16 удалений

Просмотреть файл

@ -64,20 +64,24 @@
* Only nine steps of bolder or lighter are allowed by the CSS XPCODE.
*/
// XXX change this from using a bitset to something cleaner eventually
class WeightTable {
class WeightTable
{
public:
THEBES_DECL_REFCOUNTING
WeightTable() : mWeights(0) {}
~WeightTable() {
}
PRBool TriedWeight(PRUint8 aWeight) {
return mWeights[aWeight + 10];
return mWeights[aWeight - 1 + 10];
}
PRBool HasWeight(PRUint8 aWeight) {
return mWeights[aWeight];
return mWeights[aWeight - 1];
}
void SetWeight(PRUint8 aWeight, PRBool aValue) {
mWeights[aWeight] = aValue;
mWeights[aWeight + 10] = PR_TRUE;
mWeights[aWeight - 1] = aValue;
mWeights[aWeight - 1 + 10] = PR_TRUE;
}
private:
@ -88,7 +92,8 @@ private:
/* Unicode subrange table
* from: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/unicode_63ub.asp
*/
struct UnicodeRangeTableEntry {
struct UnicodeRangeTableEntry
{
PRUint8 bit;
PRUint32 start;
PRUint32 end;

Просмотреть файл

@ -162,6 +162,7 @@ gfxWindowsFont::MakeCairoFontFace()
if (mFont)
return cairo_win32_font_face_create_for_hfont(mFont);
#if 0
if (!mWeightTable) {
nsString name(mName);
ToLowerCase(name);
@ -174,6 +175,7 @@ gfxWindowsFont::MakeCairoFontFace()
platform->PutFontWeightTable(name, mWeightTable);
}
}
#endif
/* XXX split this code out some, make it a bit more CSS2 15.5.1 compliant */
PRInt16 baseWeight, weightDistance;
@ -186,11 +188,14 @@ gfxWindowsFont::MakeCairoFontFace()
if (weightDistance >= 0) {
for (PRUint16 i = baseWeight, k = 0; i < 10; i++) {
#if 0
if (mWeightTable->HasWeight(i)) {
k++;
chosenWeight = i * 100;
} else if (mWeightTable->TriedWeight(i)) {
continue;
} else {
#endif
const PRUint32 tryWeight = i * 100;
if (!dc)
@ -203,19 +208,22 @@ gfxWindowsFont::MakeCairoFontFace()
GetTextMetrics(dc, &metrics);
PRBool hasWeight = (metrics.tmWeight == tryWeight);
mWeightTable->SetWeight(i, hasWeight);
if (hasWeight)
// mWeightTable->SetWeight(i, hasWeight);
if (hasWeight) {
chosenWeight = i * 100;
k++;
}
SelectObject(dc, oldFont);
if (k <= weightDistance) {
DeleteObject(mFont);
mFont = nsnull;
}
#if 0
}
#endif
if (k > weightDistance) {
chosenWeight = i * 100;;
chosenWeight = i * 100;
break;
}
}

Просмотреть файл

@ -88,7 +88,7 @@ gfxWindowsPlatform::FontEnumProc(const ENUMLOGFONTEXW *lpelfe,
ToLowerCase(name);
nsRefPtr<FontEntry> fe;
if (!thisp->mFonts.Get(nsDependentString(name), &fe)) {
if (!thisp->mFonts.Get(name, &fe)) {
fe = new FontEntry(nsDependentString(logFont.lfFaceName), (PRUint16)fontType);
thisp->mFonts.Put(name, fe);
}
@ -96,11 +96,14 @@ gfxWindowsPlatform::FontEnumProc(const ENUMLOGFONTEXW *lpelfe,
// mark the charset bit
fe->mCharset[metrics.tmCharSet] = 1;
// XXX Populate weight table here
WeightTable *wt = new WeightTable();
wt->SetWeight(PR_MAX(1, PR_MIN(9, metrics.tmWeight / 100)), PR_TRUE);
thisp->PutFontWeightTable(name, wt);
#if 0
nsRefPtr<WeightTable> wt;
if (!thisp->mFontWeights.Get(name, &wt)) {
wt = new WeightTable();
wt->SetWeight(PR_MAX(1, PR_MIN(9, metrics.tmWeight / 100)), PR_TRUE);
thisp->mFontWeights.Put(name, wt);
}
#endif
fe->mFamily = logFont.lfPitchAndFamily & 0xF0;
fe->mPitch = logFont.lfPitchAndFamily & 0x0F;
@ -373,6 +376,9 @@ gfxWindowsPlatform::GetFontWeightTable(const nsAString& aName)
return nsnull;
}
return wt;
WeightTable *ret = wt;
NS_IF_ADDREF(ret);
return ret;
}
void