[FONTSUB] Import from Wine Staging 1.9.13. CORE-11219
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 9 Jul 2016 17:18:33 +0000 (17:18 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 9 Jul 2016 17:18:33 +0000 (17:18 +0000)
svn path=/trunk/; revision=71873

reactos/dll/win32/CMakeLists.txt
reactos/dll/win32/fontsub/CMakeLists.txt [new file with mode: 0644]
reactos/dll/win32/fontsub/fontsub.spec [new file with mode: 0644]
reactos/dll/win32/fontsub/main.c [new file with mode: 0644]
reactos/media/doc/README.WINE
reactos/sdk/include/psdk/fontsub.h [new file with mode: 0644]

index 6afeb60..1dc7f51 100644 (file)
@@ -41,6 +41,7 @@ add_subdirectory(esent)
 add_subdirectory(faultrep)
 add_subdirectory(fltlib)
 add_subdirectory(fmifs)
 add_subdirectory(faultrep)
 add_subdirectory(fltlib)
 add_subdirectory(fmifs)
+add_subdirectory(fontsub)
 add_subdirectory(framedyn)
 add_subdirectory(fusion)
 add_subdirectory(gdiplus)
 add_subdirectory(framedyn)
 add_subdirectory(fusion)
 add_subdirectory(gdiplus)
diff --git a/reactos/dll/win32/fontsub/CMakeLists.txt b/reactos/dll/win32/fontsub/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3adf7c4
--- /dev/null
@@ -0,0 +1,14 @@
+
+add_definitions(-D__WINESRC__)
+include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
+spec2def(fontsub.dll fontsub.spec)
+
+add_library(fontsub SHARED
+    main.c
+    ${CMAKE_CURRENT_BINARY_DIR}/fontsub_stubs.c
+    ${CMAKE_CURRENT_BINARY_DIR}/fontsub.def)
+
+set_module_type(fontsub win32dll)
+target_link_libraries(fontsub wine)
+add_importlibs(fontsub msvcrt kernel32 ntdll)
+add_cd_file(TARGET fontsub DESTINATION reactos/system32 FOR all)
diff --git a/reactos/dll/win32/fontsub/fontsub.spec b/reactos/dll/win32/fontsub/fontsub.spec
new file mode 100644 (file)
index 0000000..61b7fd3
--- /dev/null
@@ -0,0 +1,2 @@
+@ cdecl CreateFontPackage(ptr long ptr ptr ptr long long long long long long ptr long ptr ptr ptr ptr)
+@ stub MergeFontPackage
diff --git a/reactos/dll/win32/fontsub/main.c b/reactos/dll/win32/fontsub/main.c
new file mode 100644 (file)
index 0000000..a0a6032
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2014 Nikolay Sivov for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+#include "windef.h"
+#include "winbase.h"
+#include "fontsub.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(fontsub);
+
+BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+    TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
+
+    switch (fdwReason) {
+        case DLL_WINE_PREATTACH:
+            return FALSE;  /* prefer native version */
+        case DLL_PROCESS_ATTACH:
+            DisableThreadLibraryCalls(hinstDLL);
+            break;
+    }
+
+    return TRUE;
+}
+
+ULONG __cdecl CreateFontPackage(const unsigned char *src, const ULONG src_len, unsigned char **dest,
+    ULONG *dest_len, ULONG *written, const unsigned short flags, const unsigned short face_index,
+    const unsigned short format, const unsigned short lang, const unsigned short platform, const unsigned short encoding,
+    const unsigned short *keep_list, const unsigned short keep_len, CFP_ALLOCPROC allocproc,
+    CFP_REALLOCPROC reallocproc, CFP_FREEPROC freeproc, void *reserved)
+{
+    FIXME("(%p %u %p %p %p %#x %u %u %u %u %u %p %u %p %p %p %p): stub\n", src, src_len, dest, dest_len,
+        written, flags, face_index, format, lang, platform, encoding, keep_list, keep_len, allocproc,
+        reallocproc, freeproc, reserved);
+
+    if (format != TTFCFP_SUBSET)
+        return ERR_GENERIC;
+
+    *dest = allocproc(src_len);
+    if (!*dest)
+        return ERR_MEM;
+
+    memcpy(*dest, src, src_len);
+    *dest_len = src_len;
+    *written = src_len;
+
+    return NO_ERROR;
+}
index c31fdf6..f146e1d 100644 (file)
@@ -67,6 +67,7 @@ reactos/dll/win32/dbghelp             # Synced to WineStaging-1.9.11
 reactos/dll/win32/dciman32            # Synced to WineStaging-1.9.11
 reactos/dll/win32/faultrep            # Synced to WineStaging-1.9.11
 reactos/dll/win32/fltlib              # Synced to WineStaging-1.9.11
 reactos/dll/win32/dciman32            # Synced to WineStaging-1.9.11
 reactos/dll/win32/faultrep            # Synced to WineStaging-1.9.11
 reactos/dll/win32/fltlib              # Synced to WineStaging-1.9.11
+reactos/dll/win32/fontsub             # Synced to WineStaging-1.9.13
 reactos/dll/win32/fusion              # Synced to WineStaging-1.9.11
 reactos/dll/win32/gdiplus             # Synced to WineStaging-1.9.11
 reactos/dll/win32/hhctrl.ocx          # Synced to WineStaging-1.9.11
 reactos/dll/win32/fusion              # Synced to WineStaging-1.9.11
 reactos/dll/win32/gdiplus             # Synced to WineStaging-1.9.11
 reactos/dll/win32/hhctrl.ocx          # Synced to WineStaging-1.9.11
diff --git a/reactos/sdk/include/psdk/fontsub.h b/reactos/sdk/include/psdk/fontsub.h
new file mode 100644 (file)
index 0000000..aa83f03
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2016 Nikolay Sivov for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_FONTSUB_H
+#define __WINE_FONTSUB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(__cdecl *CFP_ALLOCPROC)(size_t);
+typedef void *(__cdecl *CFP_REALLOCPROC)(void *, size_t);
+typedef void (__cdecl *CFP_FREEPROC)(void *);
+
+#define TTFCFP_SUBSET  0
+#define TTFCFP_SUBSET1 1
+#define TTFCFP_DELTA   2
+
+#define TTFCFP_UNICODE_PLATFORMID 0
+#define TTFCFP_APPLE_PLATFORMID   1
+#define TTFCFP_ISO_PLATFORMID     2
+#define TTFCFP_MS_PLATFORMID      3
+
+#define TTFCFP_STD_MAC_CHAR_SET   0
+#define TTFCFP_SYMBOL_CHAR_SET    0
+#define TTFCFP_UNICODE_CHAR_SET   1
+#define TTFCFP_DONT_CARE          0xffff
+
+#define TTFCFP_LANG_KEEP_ALL      0
+
+#define TTFCFP_FLAGS_SUBSET       0x0001
+#define TTFCFP_FLAGS_COMPRESS     0x0002
+#define TTFCFP_FLAGS_TTC          0x0004
+#define TTFCFP_FLAGS_GLYPHLIST    0x0008
+
+#define ERR_GENERIC 1000
+#define ERR_MEM     1005
+
+ULONG __cdecl CreateFontPackage(const unsigned char *src, const ULONG src_len, unsigned char **dest,
+    ULONG *dest_len, ULONG *written, const unsigned short flags, const unsigned short face_index,
+    const unsigned short format, const unsigned short lang, const unsigned short platform,
+    const unsigned short encoding, const unsigned short *keep_list, const unsigned short keep_len,
+    CFP_ALLOCPROC allocproc, CFP_REALLOCPROC reallocproc, CFP_FREEPROC freeproc, void *reserved);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif