mirror of
https://github.com/reactos/reactos.git
synced 2025-06-12 14:18:29 +00:00
added support for the FR_PRIVATE and FR_NOT_ENUM flags for AddFontResourceEx()
svn path=/trunk/; revision=6983
This commit is contained in:
parent
c3fedb7f0b
commit
0d6a146059
4 changed files with 62 additions and 14 deletions
|
@ -143,6 +143,11 @@ extern "C" {
|
||||||
#define KLF_REPLACELANG (16)
|
#define KLF_REPLACELANG (16)
|
||||||
#define KLF_SUBSTITUTE_OK (2)
|
#define KLF_SUBSTITUTE_OK (2)
|
||||||
|
|
||||||
|
/* AddFontResourceEx */
|
||||||
|
#define FR_PRIVATE (0x10)
|
||||||
|
#define FR_NOT_ENUM (0x20)
|
||||||
|
|
||||||
|
|
||||||
/* AppendMenu */
|
/* AppendMenu */
|
||||||
#define MF_BITMAP (0x4L)
|
#define MF_BITMAP (0x4L)
|
||||||
#define MF_DISABLED (0x2L)
|
#define MF_DISABLED (0x2L)
|
||||||
|
|
|
@ -17,6 +17,8 @@ typedef struct _W32PROCESS
|
||||||
LIST_ENTRY ClassListHead;
|
LIST_ENTRY ClassListHead;
|
||||||
FAST_MUTEX MenuListLock;
|
FAST_MUTEX MenuListLock;
|
||||||
LIST_ENTRY MenuListHead;
|
LIST_ENTRY MenuListHead;
|
||||||
|
FAST_MUTEX PrivateFontListLock;
|
||||||
|
LIST_ENTRY PrivateFontListHead;
|
||||||
struct _KBDTABLES* KeyboardLayout;
|
struct _KBDTABLES* KeyboardLayout;
|
||||||
struct _WINSTATION_OBJECT* WindowStation;
|
struct _WINSTATION_OBJECT* WindowStation;
|
||||||
WORD GDIObjects;
|
WORD GDIObjects;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dllmain.c,v 1.60 2003/12/12 14:22:37 gvg Exp $
|
/* $Id: dllmain.c,v 1.61 2003/12/12 23:49:48 weiden Exp $
|
||||||
*
|
*
|
||||||
* Entry Point for win32k.sys
|
* Entry Point for win32k.sys
|
||||||
*/
|
*/
|
||||||
|
@ -76,6 +76,9 @@ Win32kProcessCallback (struct _EPROCESS *Process,
|
||||||
InitializeListHead(&Win32Process->MenuListHead);
|
InitializeListHead(&Win32Process->MenuListHead);
|
||||||
ExInitializeFastMutex(&Win32Process->MenuListLock);
|
ExInitializeFastMutex(&Win32Process->MenuListLock);
|
||||||
|
|
||||||
|
InitializeListHead(&Win32Process->PrivateFontListHead);
|
||||||
|
ExInitializeFastMutex(&Win32Process->PrivateFontListLock);
|
||||||
|
|
||||||
Win32Process->KeyboardLayout = W32kGetDefaultKeyLayout();
|
Win32Process->KeyboardLayout = W32kGetDefaultKeyLayout();
|
||||||
Win32Process->WindowStation = NULL;
|
Win32Process->WindowStation = NULL;
|
||||||
if (Process->Win32WindowStation != NULL)
|
if (Process->Win32WindowStation != NULL)
|
||||||
|
|
|
@ -16,12 +16,13 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: text.c,v 1.59 2003/12/12 22:57:26 weiden Exp $ */
|
/* $Id: text.c,v 1.60 2003/12/12 23:49:48 weiden Exp $ */
|
||||||
|
|
||||||
|
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
#include <napi/win32.h>
|
||||||
#include <internal/safe.h>
|
#include <internal/safe.h>
|
||||||
#include <win32k/brush.h>
|
#include <win32k/brush.h>
|
||||||
#include <win32k/dc.h>
|
#include <win32k/dc.h>
|
||||||
|
@ -48,12 +49,12 @@ typedef struct _FONT_ENTRY {
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
HFONT hFont;
|
HFONT hFont;
|
||||||
UNICODE_STRING FaceName;
|
UNICODE_STRING FaceName;
|
||||||
BYTE CanEnum;
|
BYTE NotEnum;
|
||||||
} FONT_ENTRY, *PFONT_ENTRY;
|
} FONT_ENTRY, *PFONT_ENTRY;
|
||||||
|
|
||||||
static LIST_ENTRY FontListHead;
|
static LIST_ENTRY FontListHead;
|
||||||
static FAST_MUTEX FontListLock;
|
static FAST_MUTEX FontListLock;
|
||||||
static INT FontsLoaded = 0;
|
static INT FontsLoaded = 0; /* number of all fonts loaded (including private fonts */
|
||||||
|
|
||||||
int FASTCALL
|
int FASTCALL
|
||||||
IntGdiAddFontResource(PUNICODE_STRING Filename, DWORD fl)
|
IntGdiAddFontResource(PUNICODE_STRING Filename, DWORD fl)
|
||||||
|
@ -163,14 +164,26 @@ IntGdiAddFontResource(PUNICODE_STRING Filename, DWORD fl)
|
||||||
|
|
||||||
// Add this font resource to the font table
|
// Add this font resource to the font table
|
||||||
entry->hFont = NewFont;
|
entry->hFont = NewFont;
|
||||||
|
entry->NotEnum = (fl & FR_NOT_ENUM);
|
||||||
RtlInitAnsiString(&StringA, (LPSTR)face->family_name);
|
RtlInitAnsiString(&StringA, (LPSTR)face->family_name);
|
||||||
RtlAnsiStringToUnicodeString(&entry->FaceName, &StringA, TRUE);
|
RtlAnsiStringToUnicodeString(&entry->FaceName, &StringA, TRUE);
|
||||||
|
|
||||||
|
if(fl & FR_PRIVATE)
|
||||||
|
{
|
||||||
|
PW32PROCESS Win32Process = PsGetWin32Process();
|
||||||
|
|
||||||
|
ExAcquireFastMutex(&Win32Process->PrivateFontListLock);
|
||||||
|
InsertTailList(&Win32Process->PrivateFontListHead, &entry->ListEntry);
|
||||||
|
FontsLoaded++;
|
||||||
|
ExReleaseFastMutex(&Win32Process->PrivateFontListLock);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ExAcquireFastMutex(&FontListLock);
|
ExAcquireFastMutex(&FontListLock);
|
||||||
InsertTailList(&FontListHead, &entry->ListEntry);
|
InsertTailList(&FontListHead, &entry->ListEntry);
|
||||||
FontsLoaded++;
|
FontsLoaded++;
|
||||||
ExReleaseFastMutex(&FontListLock);
|
ExReleaseFastMutex(&FontListLock);
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1361,8 +1374,10 @@ TextIntRealizeFont(HFONT FontHandle)
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
PTEXTOBJ TextObj;
|
PTEXTOBJ TextObj;
|
||||||
UNICODE_STRING FaceName;
|
UNICODE_STRING FaceName;
|
||||||
PLIST_ENTRY Entry;
|
PLIST_ENTRY Entry, List;
|
||||||
PFONT_ENTRY CurrentEntry;
|
PFONT_ENTRY CurrentEntry;
|
||||||
|
PW32PROCESS Win32Process;
|
||||||
|
BOOL Private = FALSE;
|
||||||
|
|
||||||
TextObj = TEXTOBJ_LockText(FontHandle);
|
TextObj = TEXTOBJ_LockText(FontHandle);
|
||||||
ASSERT(TextObj);
|
ASSERT(TextObj);
|
||||||
|
@ -1370,10 +1385,32 @@ TextIntRealizeFont(HFONT FontHandle)
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&FaceName, TextObj->logfont.lfFaceName);
|
RtlInitUnicodeString(&FaceName, TextObj->logfont.lfFaceName);
|
||||||
|
|
||||||
|
/* find font in private fonts */
|
||||||
|
Win32Process = PsGetWin32Process();
|
||||||
|
|
||||||
|
ExAcquireFastMutex(&Win32Process->PrivateFontListLock);
|
||||||
|
|
||||||
|
Entry = Win32Process->PrivateFontListHead.Flink;
|
||||||
|
while(Entry != &Win32Process->PrivateFontListHead)
|
||||||
|
{
|
||||||
|
CurrentEntry = (PFONT_ENTRY)CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry);
|
||||||
|
|
||||||
|
if (0 == RtlCompareUnicodeString(&CurrentEntry->FaceName, &FaceName, TRUE))
|
||||||
|
{
|
||||||
|
TextObj->GDIFontHandle = CurrentEntry->hFont;
|
||||||
|
Private = TRUE;
|
||||||
|
goto check;
|
||||||
|
}
|
||||||
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
ExReleaseFastMutex(&Win32Process->PrivateFontListLock);
|
||||||
|
|
||||||
|
/* find font in system fonts */
|
||||||
ExAcquireFastMutex(&FontListLock);
|
ExAcquireFastMutex(&FontListLock);
|
||||||
|
|
||||||
Entry = FontListHead.Flink;
|
Entry = (Private ? Win32Process->PrivateFontListHead.Flink : FontListHead.Flink);
|
||||||
while(Entry != &FontListHead)
|
List = (Private ? &Win32Process->PrivateFontListHead : &FontListHead);
|
||||||
|
while(Entry != List)
|
||||||
{
|
{
|
||||||
CurrentEntry = (PFONT_ENTRY)CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry);
|
CurrentEntry = (PFONT_ENTRY)CONTAINING_RECORD(Entry, FONT_ENTRY, ListEntry);
|
||||||
|
|
||||||
|
@ -1385,6 +1422,7 @@ TextIntRealizeFont(HFONT FontHandle)
|
||||||
Entry = Entry->Flink;
|
Entry = Entry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check:
|
||||||
if (NULL == TextObj->GDIFontHandle)
|
if (NULL == TextObj->GDIFontHandle)
|
||||||
{
|
{
|
||||||
Entry = FontListHead.Flink;
|
Entry = FontListHead.Flink;
|
||||||
|
@ -1404,7 +1442,7 @@ TextIntRealizeFont(HFONT FontHandle)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExReleaseFastMutex(&FontListLock);
|
ExReleaseFastMutex((Private ? &Win32Process->PrivateFontListLock : &FontListLock));
|
||||||
|
|
||||||
ASSERT(! NT_SUCCESS(Status) || NULL != TextObj->GDIFontHandle);
|
ASSERT(! NT_SUCCESS(Status) || NULL != TextObj->GDIFontHandle);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue