gdi32: Increment the face refcount when loading the same font file multiple times.
This commit is contained in:
parent
93c1389b7c
commit
591a31ba67
|
@ -1304,6 +1304,13 @@ static BOOL insert_face_in_family_list( Face *face, Family *family )
|
||||||
debugstr_w(family->FamilyName), debugstr_w(face->StyleName),
|
debugstr_w(family->FamilyName), debugstr_w(face->StyleName),
|
||||||
cursor->font_version, face->font_version);
|
cursor->font_version, face->font_version);
|
||||||
|
|
||||||
|
if (face->file && face->dev == cursor->dev && face->ino == cursor->ino)
|
||||||
|
{
|
||||||
|
cursor->refcount++;
|
||||||
|
TRACE("Font %s already in list, refcount now %d\n",
|
||||||
|
debugstr_w(face->file), cursor->refcount);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
if (face->font_version <= cursor->font_version)
|
if (face->font_version <= cursor->font_version)
|
||||||
{
|
{
|
||||||
TRACE("Original font %s is newer so skipping %s\n",
|
TRACE("Original font %s is newer so skipping %s\n",
|
||||||
|
|
|
@ -4567,6 +4567,7 @@ static void test_CreateScalableFontResource(void)
|
||||||
char fot_name[MAX_PATH];
|
char fot_name[MAX_PATH];
|
||||||
char *file_part;
|
char *file_part;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (!pAddFontResourceExA || !pRemoveFontResourceExA)
|
if (!pAddFontResourceExA || !pRemoveFontResourceExA)
|
||||||
{
|
{
|
||||||
|
@ -4655,6 +4656,22 @@ static void test_CreateScalableFontResource(void)
|
||||||
ret = pRemoveFontResourceExA(fot_name, 0, 0);
|
ret = pRemoveFontResourceExA(fot_name, 0, 0);
|
||||||
ok(!ret, "RemoveFontResourceEx() should fail\n");
|
ok(!ret, "RemoveFontResourceEx() should fail\n");
|
||||||
|
|
||||||
|
/* test refcounting */
|
||||||
|
for (i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = pAddFontResourceExA(fot_name, 0, 0);
|
||||||
|
ok(ret, "AddFontResourceEx() error %d\n", GetLastError());
|
||||||
|
}
|
||||||
|
for (i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = pRemoveFontResourceExA(fot_name, 0, 0);
|
||||||
|
ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
|
||||||
|
}
|
||||||
|
ret = pRemoveFontResourceExA(fot_name, 0, 0);
|
||||||
|
ok(!ret, "RemoveFontResourceEx() should fail\n");
|
||||||
|
|
||||||
DeleteFile(fot_name);
|
DeleteFile(fot_name);
|
||||||
|
|
||||||
/* test hidden font resource */
|
/* test hidden font resource */
|
||||||
|
|
Loading…
Reference in New Issue