Commit 93c1389b authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Store the font stat information when loading it.

parent d0d269ab
...@@ -263,6 +263,8 @@ typedef struct tagFace { ...@@ -263,6 +263,8 @@ typedef struct tagFace {
WCHAR *StyleName; WCHAR *StyleName;
WCHAR *FullName; WCHAR *FullName;
WCHAR *file; WCHAR *file;
dev_t dev;
ino_t ino;
void *font_data_ptr; void *font_data_ptr;
DWORD font_data_size; DWORD font_data_size;
FT_Long face_index; FT_Long face_index;
...@@ -1761,6 +1763,7 @@ static inline void get_fontsig( FT_Face ft_face, FONTSIGNATURE *fs ) ...@@ -1761,6 +1763,7 @@ static inline void get_fontsig( FT_Face ft_face, FONTSIGNATURE *fs )
static Face *create_face( FT_Face ft_face, FT_Long face_index, const char *file, void *font_data_ptr, DWORD font_data_size, static Face *create_face( FT_Face ft_face, FT_Long face_index, const char *file, void *font_data_ptr, DWORD font_data_size,
DWORD flags ) DWORD flags )
{ {
struct stat st;
Face *face = HeapAlloc( GetProcessHeap(), 0, sizeof(*face) ); Face *face = HeapAlloc( GetProcessHeap(), 0, sizeof(*face) );
My_FT_Bitmap_Size *size = (My_FT_Bitmap_Size *)ft_face->available_sizes; My_FT_Bitmap_Size *size = (My_FT_Bitmap_Size *)ft_face->available_sizes;
...@@ -1779,11 +1782,18 @@ static Face *create_face( FT_Face ft_face, FT_Long face_index, const char *file, ...@@ -1779,11 +1782,18 @@ static Face *create_face( FT_Face ft_face, FT_Long face_index, const char *file,
if (flags & ADDFONT_VERTICAL_FONT) if (flags & ADDFONT_VERTICAL_FONT)
face->FullName = prepend_at( face->FullName ); face->FullName = prepend_at( face->FullName );
face->dev = 0;
face->ino = 0;
if (file) if (file)
{ {
face->file = towstr( CP_UNIXCP, file ); face->file = towstr( CP_UNIXCP, file );
face->font_data_ptr = NULL; face->font_data_ptr = NULL;
face->font_data_size = 0; face->font_data_size = 0;
if (!stat( file, &st ))
{
face->dev = st.st_dev;
face->ino = st.st_ino;
}
} }
else else
{ {
...@@ -1986,8 +1996,7 @@ static int remove_font_resource( const char *file, DWORD flags ) ...@@ -1986,8 +1996,7 @@ static int remove_font_resource( const char *file, DWORD flags )
{ {
Family *family, *family_next; Family *family, *family_next;
Face *face, *face_next; Face *face, *face_next;
char *filename; struct stat st;
struct stat st, st2;
int count = 0; int count = 0;
if (stat( file, &st ) == -1) return 0; if (stat( file, &st ) == -1) return 0;
...@@ -1998,14 +2007,12 @@ static int remove_font_resource( const char *file, DWORD flags ) ...@@ -1998,14 +2007,12 @@ static int remove_font_resource( const char *file, DWORD flags )
{ {
if (!face->file) continue; if (!face->file) continue;
if (LOWORD(face->flags) != LOWORD(flags)) continue; if (LOWORD(face->flags) != LOWORD(flags)) continue;
filename = strWtoA( CP_UNIXCP, face->file ); if (st.st_dev == face->dev && st.st_ino == face->ino)
if (!stat( filename, &st2 ) && st.st_dev == st2.st_dev && st.st_ino == st2.st_ino)
{ {
TRACE( "removing matching face %s\n", debugstr_w(face->file) ); TRACE( "removing matching face %s refcount %d\n", debugstr_w(face->file), face->refcount );
release_face( face ); release_face( face );
count++; count++;
} }
HeapFree( GetProcessHeap(), 0, filename );
} }
release_family( family ); release_family( family );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment