Commit 275a2d71 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Switch to unixlib syscall interface.

parent 0b3d65f8
MODULE = dwrite.dll
IMPORTLIB = dwrite
UNIXLIB = dwrite.so
IMPORTS = user32 gdi32 advapi32
EXTRAINCL = $(FREETYPE_CFLAGS)
......
......@@ -223,8 +223,7 @@ extern HRESULT opentype_cmap_get_unicode_ranges(const struct dwrite_cmap *cmap,
DWRITE_UNICODE_RANGE *ranges, unsigned int *count) DECLSPEC_HIDDEN;
struct dwrite_fontface;
typedef void * font_object_handle;
typedef font_object_handle (*p_dwrite_fontface_get_font_object)(struct dwrite_fontface *fontface);
typedef UINT64 (*p_dwrite_fontface_get_font_object)(struct dwrite_fontface *fontface);
struct dwrite_fontface
{
......@@ -238,7 +237,7 @@ struct dwrite_fontface
IDWriteFactory7 *factory;
struct fontfacecached *cached;
font_object_handle font_object;
UINT64 font_object;
void *data_context;
p_dwrite_fontface_get_font_object get_font_object;
struct
......@@ -717,22 +716,4 @@ extern HRESULT shape_check_typographic_feature(struct scriptshaping_context *con
struct font_data_context;
extern HMODULE dwrite_module DECLSPEC_HIDDEN;
struct font_backend_funcs
{
font_object_handle (CDECL *create_font_object)(const void *data_ptr, UINT64 data_size, unsigned int index);
void (CDECL *release_font_object)(font_object_handle object);
int (CDECL *get_glyph_outline)(font_object_handle object, float emsize, unsigned int simulations, UINT16 glyph,
struct dwrite_outline *outline);
UINT16 (CDECL *get_glyph_count)(font_object_handle object);
INT32 (CDECL *get_glyph_advance)(font_object_handle object, float em_size, UINT16 glyph,
DWRITE_MEASURING_MODE measuring_mode, BOOL *has_contours);
void (CDECL *get_glyph_bbox)(font_object_handle object, struct dwrite_glyphbitmap *bitmap_desc);
BOOL (CDECL *get_glyph_bitmap)(font_object_handle object, struct dwrite_glyphbitmap *bitmap_desc);
void (CDECL *get_design_glyph_metrics)(font_object_handle object, UINT16 upem, UINT16 ascent, unsigned int simulations,
UINT16 glyph, DWRITE_GLYPH_METRICS *metrics);
};
extern void init_font_backend(void) DECLSPEC_HIDDEN;
extern void release_font_backend(void) DECLSPEC_HIDDEN;
extern void dwrite_fontface_get_glyph_bbox(IDWriteFontFace *fontface, struct dwrite_glyphbitmap *bitmap) DECLSPEC_HIDDEN;
......@@ -30,11 +30,13 @@
#include "initguid.h"
#include "dwrite_private.h"
#include "unixlib.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
HMODULE dwrite_module = 0;
unixlib_handle_t unixlib_handle = 0;
static IDWriteFactory7 *shared_factory;
static void release_shared_factory(IDWriteFactory7 *factory);
......@@ -45,13 +47,15 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
case DLL_PROCESS_ATTACH:
dwrite_module = hinstDLL;
DisableThreadLibraryCalls( hinstDLL );
init_font_backend();
if (!NtQueryVirtualMemory(GetCurrentProcess(), hinstDLL, MemoryWineUnixFuncs,
&unixlib_handle, sizeof(unixlib_handle), NULL))
UNIX_CALL(process_attach, NULL);
init_local_fontfile_loader();
break;
case DLL_PROCESS_DETACH:
if (reserved) break;
release_shared_factory(shared_factory);
release_font_backend();
if (unixlib_handle) UNIX_CALL(process_detach, NULL);
}
return TRUE;
}
......
/*
* Copyright 2021 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 "winternl.h"
#include "dwrite.h"
#include "wine/unixlib.h"
struct create_font_object_params
{
const void *data;
UINT64 size;
unsigned int index;
UINT64 *object;
};
struct release_font_object_params
{
UINT64 object;
};
struct get_glyph_outline_params
{
UINT64 object;
unsigned int simulations;
unsigned int glyph;
float emsize;
struct dwrite_outline *outline;
};
struct get_glyph_count_params
{
UINT64 object;
unsigned int *count;
};
struct get_glyph_advance_params
{
UINT64 object;
unsigned int glyph;
unsigned int mode;
float emsize;
int *advance;
unsigned int *has_contours;
};
struct get_glyph_bbox_params
{
UINT64 object;
unsigned int simulations;
unsigned int glyph;
float emsize;
DWRITE_MATRIX m;
RECT *bbox;
};
struct get_glyph_bitmap_params
{
UINT64 object;
unsigned int simulations;
unsigned int glyph;
unsigned int mode;
float emsize;
DWRITE_MATRIX m;
RECT bbox;
int pitch;
BYTE *bitmap;
unsigned int *is_1bpp;
};
struct get_design_glyph_metrics_params
{
UINT64 object;
unsigned int simulations;
unsigned int glyph;
unsigned int upem;
unsigned int ascent;
DWRITE_GLYPH_METRICS *metrics;
};
enum font_backend_funcs
{
unix_process_attach,
unix_process_detach,
unix_create_font_object,
unix_release_font_object,
unix_get_glyph_outline,
unix_get_glyph_count,
unix_get_glyph_advance,
unix_get_glyph_bbox,
unix_get_glyph_bitmap,
unix_get_design_glyph_metrics,
};
extern unixlib_handle_t unixlib_handle DECLSPEC_HIDDEN;
#define UNIX_CALL( func, params ) __wine_unix_call( unixlib_handle, unix_ ## func, params )
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