Backed out bug 480267 because it seems to have caused failures in reftests.

This commit is contained in:
Joe Drew 2009-03-10 12:25:54 -04:00
Родитель b0b03849ac d4cb78e563
Коммит 9f16459c2e
7 изменённых файлов: 15 добавлений и 342 удалений

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

@ -368,9 +368,6 @@ public:
static void GetPrefsFontList(const char *aPrefName, static void GetPrefsFontList(const char *aPrefName,
nsTArray<nsString>& aFontList); nsTArray<nsString>& aFontList);
// generate a unique font name
static nsresult MakeUniqueUserFontName(nsAString& aName);
}; };
// helper class for loading in font info spaced out at regular intervals // helper class for loading in font info spaced out at regular intervals

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

@ -46,12 +46,8 @@
#include "nsIPrefLocalizedString.h" #include "nsIPrefLocalizedString.h"
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
#include "nsIStreamBufferAccess.h" #include "nsIStreamBufferAccess.h"
#include "nsIUUIDGenerator.h"
#include "nsMemory.h" #include "nsMemory.h"
#include "plbase64.h"
#define NO_RANGE_FOUND 126 // bit 126 in the font unicode ranges is required to be 0 #define NO_RANGE_FOUND 126 // bit 126 in the font unicode ranges is required to be 0
/* Unicode subrange table /* Unicode subrange table
@ -475,43 +471,6 @@ void gfxFontUtils::GetPrefsFontList(const char *aPrefName, nsTArray<nsString>& a
} }
// produce a unique font name that is (1) a valid Postscript name and (2) less
// than 31 characters in length. Using AddFontMemResourceEx on Windows fails
// for names longer than 30 characters in length.
#define MAX_B64_LEN 32
nsresult gfxFontUtils::MakeUniqueUserFontName(nsAString& aName)
{
nsCOMPtr<nsIUUIDGenerator> uuidgen =
do_GetService("@mozilla.org/uuid-generator;1");
NS_ENSURE_TRUE(uuidgen, NS_ERROR_OUT_OF_MEMORY);
nsID guid;
NS_ASSERTION(sizeof(guid) * 2 <= MAX_B64_LEN, "size of nsID has changed!");
nsresult rv = uuidgen->GenerateUUIDInPlace(&guid);
NS_ENSURE_SUCCESS(rv, rv);
char guidB64[MAX_B64_LEN] = {0};
if (!PL_Base64Encode((char *)(&guid), sizeof(guid), guidB64))
return NS_ERROR_FAILURE;
// all b64 characters except for '/' are allowed in Postscript names, so convert / ==> -
char *p;
for (p = guidB64; *p; p++) {
if (*p == '/')
*p = '-';
}
aName.Assign(NS_LITERAL_STRING("uf"));
aName.AppendASCII(guidB64);
return NS_OK;
}
// TrueType/OpenType table handling code // TrueType/OpenType table handling code
// need byte aligned structs // need byte aligned structs

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

@ -1429,8 +1429,10 @@ gfxQuartzFontCache::MakePlatformFont(const gfxFontEntry *aProxyEntry,
// now lookup the Postscript name; this may fail if the font cache is bad // now lookup the Postscript name; this may fail if the font cache is bad
OSStatus err; OSStatus err;
NSString *psname = NULL; NSString *psname = NULL;
nsAutoString postscriptName;
err = ATSFontGetPostScriptName(fontRef, kATSOptionFlagsDefault, (CFStringRef*) (&psname)); err = ATSFontGetPostScriptName(fontRef, kATSOptionFlagsDefault, (CFStringRef*) (&psname));
if (err == noErr) { if (err == noErr) {
GetStringForNSString(psname, postscriptName);
[psname release]; [psname release];
} else { } else {
#ifdef DEBUG #ifdef DEBUG
@ -1459,16 +1461,8 @@ gfxQuartzFontCache::MakePlatformFont(const gfxFontEntry *aProxyEntry,
NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!"); NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!");
// create the font entry // create the font entry
nsAutoString uniqueName;
nsresult rv = gfxFontUtils::MakeUniqueUserFontName(uniqueName);
if (NS_FAILED(rv)) {
delete userFontData;
return nsnull;
}
MacOSFontEntry *newFontEntry = MacOSFontEntry *newFontEntry =
new MacOSFontEntry(uniqueName, new MacOSFontEntry(postscriptName,
FMGetFontFromATSFontRef(fontRef), FMGetFontFromATSFontRef(fontRef),
w, aProxyEntry->mStretch, w, aProxyEntry->mStretch,
(PRUint32(aProxyEntry->mItalic) ? (PRUint32(aProxyEntry->mItalic) ?

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

@ -492,6 +492,17 @@ public:
}; };
static void MakeUniqueFontName(nsAString& aName)
{
char buf[50];
static PRUint32 fontCount = 0;
++fontCount;
sprintf(buf, "mozfont%8.8x%8.8x", ::GetTickCount(), fontCount); // slightly retarded, figure something better later...
aName.AssignASCII(buf);
}
/* static */ /* static */
FontEntry* FontEntry*
FontEntry::CreateFontEntry(const gfxProxyFontEntry &aProxyEntry, FontEntry::CreateFontEntry(const gfxProxyFontEntry &aProxyEntry,
@ -509,9 +520,7 @@ FontEntry::CreateFontEntry(const gfxProxyFontEntry &aProxyEntry,
HANDLE fontRef; HANDLE fontRef;
nsAutoString uniqueName; nsAutoString uniqueName;
rv = gfxFontUtils::MakeUniqueUserFontName(uniqueName); MakeUniqueFontName(uniqueName);
if (NS_FAILED(rv))
return nsnull;
if (isCFF) { if (isCFF) {
// Postscript-style glyphs, swizzle name table, load directly // Postscript-style glyphs, swizzle name table, load directly

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

@ -77,4 +77,3 @@ HTTP(..) == ex-unit-1.html ex-unit-1-ref.html
HTTP(..) == ex-unit-1-dynamic.html ex-unit-1-ref.html HTTP(..) == ex-unit-1-dynamic.html ex-unit-1-ref.html
fails-if(MOZ_WIDGET_TOOLKIT=="windows") == local-1.html local-1-ref.html # bug 468387 fails-if(MOZ_WIDGET_TOOLKIT=="windows") == local-1.html local-1-ref.html # bug 468387
fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") HTTP(..) == synthetic-weight-style.html synthetic-weight-style-ref.html # bug 468387, 480098

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

@ -1,120 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>@font-face and synthetic rendering</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
@import url(../fonts/mplus/mplusfonts.css);
body {
margin: 50px;
font-family: mplus1p, Futura, sans-serif;
font-size: 18pt;
}
table {
border-collapse: collapse;
margin-left: 1em;
}
td + td {
padding-left: 1em;
}
</style>
</head>
<body>
<h4>Text below should appear in normal face with no synthetic bolding/italics</h4>
<table>
<tr>
<td>100</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
</tr>
<tr>
<td>200</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
</tr>
<tr>
<td>300</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
</tr>
<tr>
<td>400</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
</tr>
<tr>
<td>500</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
</tr>
<tr>
<td>600</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
</tr>
<tr>
<td>700</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
</tr>
<tr>
<td>800</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
</tr>
<tr>
<td>900</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
<td>Regular</td>
<td>Italic</td>
<td>Oblique</td>
</tr>
</table>
</body>
</html>

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

@ -1,165 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>@font-face and synthetic rendering</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
@import url(../fonts/mplus/mplusfonts.css);
body {
margin: 50px;
font-family: mplus1p, Futura, sans-serif;
font-size: 18pt;
}
table {
border-collapse: collapse;
margin-left: 1em;
}
td + td {
padding-left: 1em;
}
@font-face { font-family: mplus-w1; font-weight: 100; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w1; font-style: italic; font-weight: 100; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w1; font-style: oblique; font-weight: 100; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
.mplus-w1 { font-family: mplus-w1; }
@font-face { font-family: mplus-w2; font-weight: 200; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w2; font-style: italic; font-weight: 200; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w2; font-style: oblique; font-weight: 200; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
.mplus-w2 { font-family: mplus-w2; }
@font-face { font-family: mplus-w3; font-weight: 300; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w3; font-style: italic; font-weight: 300; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w3; font-style: oblique; font-weight: 300; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
.mplus-w3 { font-family: mplus-w3; }
@font-face { font-family: mplus-w4; font-weight: 400; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w4; font-style: italic; font-weight: 400; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w4; font-style: oblique; font-weight: 400; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
.mplus-w4 { font-family: mplus-w4; }
@font-face { font-family: mplus-w5; font-weight: 500; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w5; font-style: italic; font-weight: 500; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w5; font-style: oblique; font-weight: 500; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
.mplus-w5 { font-family: mplus-w5; }
@font-face { font-family: mplus-w6; font-weight: 600; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w6; font-style: italic; font-weight: 600; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w6; font-style: oblique; font-weight: 600; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
.mplus-w6 { font-family: mplus-w6; }
@font-face { font-family: mplus-w7; font-weight: 700; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w7; font-style: italic; font-weight: 700; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w7; font-style: oblique; font-weight: 700; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
.mplus-w7 { font-family: mplus-w7; }
@font-face { font-family: mplus-w8; font-weight: 800; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w8; font-style: italic; font-weight: 800; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w8; font-style: oblique; font-weight: 800; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
.mplus-w8 { font-family: mplus-w8; }
@font-face { font-family: mplus-w9; font-weight: 900; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w9; font-style: italic; font-weight: 900; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
@font-face { font-family: mplus-w9; font-style: oblique; font-weight: 900; src: url(../fonts/mplus/mplus-1p-regular.ttf); }
.mplus-w9 { font-family: mplus-w9; }
</style>
</head>
<body>
<h4>Text below should appear in normal face with no synthetic bolding/italics</h4>
<table>
<tr class="mplus-w1">
<td style="font-family: mplus1p;">100</td>
<td>Regular</td>
<td style="font-style: italic;">Italic</td>
<td style="font-style: oblique;">Oblique</td>
<td style="font-weight: 100;">Regular</td>
<td style="font-style: italic;font-weight: 100;">Italic</td>
<td style="font-style: oblique;font-weight: 100;">Oblique</td>
</tr>
<tr class="mplus-w2">
<td style="font-family: mplus1p;">200</td>
<td>Regular</td>
<td style="font-style: italic;">Italic</td>
<td style="font-style: oblique;">Oblique</td>
<td style="font-weight: 200;">Regular</td>
<td style="font-style: italic;font-weight: 200;">Italic</td>
<td style="font-style: oblique;font-weight: 200;">Oblique</td>
</tr>
<tr class="mplus-w3">
<td style="font-family: mplus1p;">300</td>
<td>Regular</td>
<td style="font-style: italic;">Italic</td>
<td style="font-style: oblique;">Oblique</td>
<td style="font-weight: 300;">Regular</td>
<td style="font-style: italic;font-weight: 300;">Italic</td>
<td style="font-style: oblique;font-weight: 300;">Oblique</td>
</tr>
<tr class="mplus-w4">
<td style="font-family: mplus1p;">400</td>
<td>Regular</td>
<td style="font-style: italic;">Italic</td>
<td style="font-style: oblique;">Oblique</td>
<td style="font-weight: 400;">Regular</td>
<td style="font-style: italic;font-weight: 400;">Italic</td>
<td style="font-style: oblique;font-weight: 400;">Oblique</td>
</tr>
<tr class="mplus-w5">
<td style="font-family: mplus1p;">500</td>
<td>Regular</td>
<td style="font-style: italic;">Italic</td>
<td style="font-style: oblique;">Oblique</td>
<td style="font-weight: 500;">Regular</td>
<td style="font-style: italic;font-weight: 500;">Italic</td>
<td style="font-style: oblique;font-weight: 500;">Oblique</td>
</tr>
<tr class="mplus-w6">
<td style="font-family: mplus1p;">600</td>
<td>Regular</td>
<td style="font-style: italic;">Italic</td>
<td style="font-style: oblique;">Oblique</td>
<td style="font-weight: 600;">Regular</td>
<td style="font-style: italic;font-weight: 600;">Italic</td>
<td style="font-style: oblique;font-weight: 600;">Oblique</td>
</tr>
<tr class="mplus-w7">
<td style="font-family: mplus1p;">700</td>
<td>Regular</td>
<td style="font-style: italic;">Italic</td>
<td style="font-style: oblique;">Oblique</td>
<td style="font-weight: 700;">Regular</td>
<td style="font-style: italic;font-weight: 700;">Italic</td>
<td style="font-style: oblique;font-weight: 700;">Oblique</td>
</tr>
<tr class="mplus-w8">
<td style="font-family: mplus1p;">800</td>
<td>Regular</td>
<td style="font-style: italic;">Italic</td>
<td style="font-style: oblique;">Oblique</td>
<td style="font-weight: 800;">Regular</td>
<td style="font-style: italic;font-weight: 800;">Italic</td>
<td style="font-style: oblique;font-weight: 800;">Oblique</td>
</tr>
<tr class="mplus-w9">
<td style="font-family: mplus1p;">900</td>
<td>Regular</td>
<td style="font-style: italic;">Italic</td>
<td style="font-style: oblique;">Oblique</td>
<td style="font-weight: 900;">Regular</td>
<td style="font-style: italic;font-weight: 900;">Italic</td>
<td style="font-style: oblique;font-weight: 900;">Oblique</td>
</tr>
</table>
</body>
</html>