73 return ((
width *
bpp + 31) >> 3) & ~3;
85 memset(bmi, 0,
sizeof(bmibuf));
135 ID2D1SimplifiedGeometrySink_AddRef(iface);
149 return IDWriteBitmapRenderTarget1_AddRef(&
target->IDWriteBitmapRenderTarget1_iface);
155 return IDWriteBitmapRenderTarget1_Release(&
target->IDWriteBitmapRenderTarget1_iface);
238 IDWriteBitmapRenderTarget1_AddRef(iface);
268 IDWriteFactory7_Release(
target->factory);
306 for (
x = 0;
x < src_width;
x++) {
307 if (!
src[
x])
continue;
308 if (
src[
x] == DWRITE_ALPHA_MAX)
309 dst_ptr[
x] = text_pixel;
311 dst_ptr[
x] =
blend_pixel(dst_ptr[
x] >> 16, dst_ptr[
x] >> 8, dst_ptr[
x], text_pixel,
src[
x]);
315 dst_ptr +=
dib->stride / 4;
326 for (
x = 0;
x < src_width;
x++) {
327 if (
src[3*
x] == 0 &&
src[3*
x+1] == 0 &&
src[3*
x+2] == 0)
continue;
330 dst_ptr +=
dib->stride / 4;
331 src += src_width * 3;
337 return (((
color >> 16) & 0xff) | (
color & 0xff00) | ((
color << 16) & 0xff0000));
351 IDWriteFontFace3 *fontface;
352 RECT target_rect, bounds;
355 TRACE(
"%p, %.8e, %.8e, %d, %p, %p, 0x%08lx, %p.\n", iface, originX, originY,
366 if (
FAILED(
hr = IDWriteFontFace_QueryInterface(run->
fontFace, &IID_IDWriteFontFace3, (
void **)&fontface))) {
367 WARN(
"Failed to get IDWriteFontFace2 interface, hr %#lx.\n",
hr);
371 hr = IDWriteFontFace3_GetRecommendedRenderingMode(fontface, run->
fontEmSize,
target->ppdip * 96.0f,
373 params, &rendermode, &gridfitmode);
374 IDWriteFontFace3_Release(fontface);
382 static const XFORM identity = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f };
387 if (
m->m11 *
m->m22 ==
m->m12 *
m->m21) {
399 xform.
eDx =
m->m11 * originX +
m->m21 * originY +
m->dx;
400 xform.
eDy =
m->m12 * originX +
m->m22 * originY +
m->dy;
422 *bbox_ret = target_rect;
435 hr = IDWriteFactory7_CreateGlyphRunAnalysis(
target->factory, run, &
m, rendermode, measuring_mode,
436 gridfitmode,
target->antialiasmode, originX, originY, &analysis);
439 WARN(
"failed to create analysis instance, 0x%08lx\n",
hr);
449 WARN(
"GetAlphaTextureBounds() failed, 0x%08lx\n",
hr);
450 IDWriteGlyphRunAnalysis_Release(analysis);
466 IDWriteGlyphRunAnalysis_Release(analysis);
470 hr = IDWriteGlyphRunAnalysis_CreateAlphaTexture(analysis, texturetype, &target_rect,
bitmap,
size);
478 if (bbox_ret) *bbox_ret = target_rect;
488 IDWriteGlyphRunAnalysis_Release(analysis);
497 TRACE(
"%p.\n", iface);
506 TRACE(
"%p.\n", iface);
570 TRACE(
"%p.\n", iface);
572 return target->antialiasmode;
581 if ((
DWORD)
mode > DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE)
624 IDWriteBitmapRenderTarget1_Release(&
target->IDWriteBitmapRenderTarget1_iface);
630 target->antialiasmode = DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE;
632 IDWriteFactory7_AddRef(
factory);
648 IDWriteGdiInterop1_AddRef(iface);
688 TRACE(
"%p, %p, %p.\n", iface, logfont,
font);
690 return IDWriteGdiInterop1_CreateFontFromLOGFONT(iface, logfont,
NULL,
font);
700 TRACE(
"%p, %p, %p, %p.\n", iface,
font, logfont, is_systemfont);
702 *is_systemfont =
FALSE;
704 memset(logfont, 0,
sizeof(*logfont));
709 hr = IDWriteFont_GetFontFamily(
font, &family);
713 hr = IDWriteFontFamily_GetFontCollection(family, &
collection);
714 IDWriteFontFamily_Release(family);
731 TRACE(
"%p, %p, %p.\n", iface, fontface, logfont);
733 memset(logfont, 0,
sizeof(*logfont));
782 TRACE(
"%p, %p, %p.\n", iface,
hdc, fontface);
792 WARN(
"failed to get selected font id\n");
799 WARN(
"failed to get font file info size\n");
815 hr = IDWriteFactory7_CreateCustomFontFileReference(interop->
factory, &
info.instance_id,
822 is_supported =
FALSE;
823 hr = IDWriteFontFile_Analyze(
file, &is_supported, &
filetype, &facetype, &facenum);
827 hr = IDWriteFactory7_CreateFontFace(interop->
factory, facetype, 1, &
file,
info.face_index,
828 info.simulations, fontface);
833 IDWriteFontFile_Release(
file);
868 ERR(
"failed to get system font collection: 0x%08lx.\n",
hr);
888 IDWriteFontFamily_Release(family);
898 TRACE(
"%p, %p, %p.\n", iface, fontface, fontsig);
905 TRACE(
"%p, %p, %p.\n", iface,
font, fontsig);
918 TRACE(
"%p, %p, %p, %p.\n", iface, logfont, fontset, subset);
920 if (!logfont || !fontset)
925 property.localeName =
L"";
927 return IDWriteFontSet_GetMatchingFonts(fontset, &
property, 1, subset);
952 IDWriteFontFileStream_AddRef(iface);
994 *fragment_context =
NULL;
995 *fragment_start =
NULL;
1003 if (!(fragment =
malloc(fragment_size)))
1009 *fragment_start = *fragment_context = fragment;
1015 TRACE(
"%p, %p.\n", iface, fragment_context);
1017 free(fragment_context);
1037 TRACE(
"%p, %p.\n", iface, last_writetime);
1059 IDWriteFontFileLoader_AddRef(iface);
1083 TRACE(
"%p, %p, %u, %p.\n", iface,
key, key_size,
ret);
1087 if (!
key || key_size !=
sizeof(
DWORD))
1097 *
ret = &
stream->IDWriteFontFileStream_iface;
1116 if (!(interop =
malloc(
sizeof(*interop))))
1123 IDWriteFactory7_AddRef(interop->
factory);
COMPILER_DEPENDENT_UINT64 UINT64
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
@ D2D1_FILL_MODE_ALTERNATE
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
@ DWRITE_FONT_STYLE_NORMAL
@ DWRITE_FONT_STYLE_ITALIC
@ DWRITE_TEXTURE_ALIASED_1x1
@ DWRITE_TEXTURE_CLEARTYPE_3x1
@ DWRITE_FONT_STRETCH_NORMAL
@ DWRITE_OUTLINE_THRESHOLD_ALIASED
struct FONTSIGNATURE FONTSIGNATURE
@ DWRITE_RENDERING_MODE1_OUTLINE
@ DWRITE_FONT_PROPERTY_ID_WIN32_FAMILY_NAME
HRESULT get_fontsig_from_fontface(IDWriteFontFace *, FONTSIGNATURE *)
BOOL is_system_collection(IDWriteFontCollection *)
void get_logfont_from_fontface(IDWriteFontFace *, LOGFONTW *)
HRESULT get_fontsig_from_font(IDWriteFont *, FONTSIGNATURE *)
void factory_detach_gdiinterop(IDWriteFactory7 *factory, IDWriteGdiInterop1 *interop)
static void dwrite_matrix_multiply(DWRITE_MATRIX *a, const DWRITE_MATRIX *b)
void get_logfont_from_font(IDWriteFont *, LOGFONTW *)
static HRESULT WINAPI gdiinterop_ConvertFontToLOGFONT(IDWriteGdiInterop1 *iface, IDWriteFont *font, LOGFONTW *logfont, BOOL *is_systemfont)
static HRESULT WINAPI gdiinterop1_GetFontSignature_(IDWriteGdiInterop1 *iface, IDWriteFontFace *fontface, FONTSIGNATURE *fontsig)
static ULONG WINAPI rendertarget_sink_Release(ID2D1SimplifiedGeometrySink *iface)
static HRESULT WINAPI gdiinterop1_CreateFontFromLOGFONT(IDWriteGdiInterop1 *iface, LOGFONTW const *logfont, IDWriteFontCollection *collection, IDWriteFont **font)
static HRESULT WINAPI gdiinterop_CreateFontFromLOGFONT(IDWriteGdiInterop1 *iface, LOGFONTW const *logfont, IDWriteFont **font)
static int get_dib_stride(int width, int bpp)
static HRESULT WINAPI memresourcestream_GetLastWriteTime(IDWriteFontFileStream *iface, UINT64 *last_writetime)
static DWORD colorref_to_pixel_888(COLORREF color)
static HRESULT create_rendertarget(IDWriteFactory7 *factory, HDC hdc, UINT32 width, UINT32 height, IDWriteBitmapRenderTarget **ret)
static HRESULT WINAPI memresourcestream_GetFileSize(IDWriteFontFileStream *iface, UINT64 *size)
static HRESULT WINAPI rendertarget_SetPixelsPerDip(IDWriteBitmapRenderTarget1 *iface, float ppdip)
static ULONG WINAPI rendertarget_Release(IDWriteBitmapRenderTarget1 *iface)
static HRESULT WINAPI memresourcestream_QueryInterface(IDWriteFontFileStream *iface, REFIID riid, void **out)
static void WINAPI rendertarget_sink_EndFigure(ID2D1SimplifiedGeometrySink *iface, D2D1_FIGURE_END figureEnd)
static ULONG WINAPI rendertarget_AddRef(IDWriteBitmapRenderTarget1 *iface)
static const IDWriteFontFileStreamVtbl memresourcestreamvtbl
static HRESULT WINAPI memresourceloader_QueryInterface(IDWriteFontFileLoader *iface, REFIID riid, void **out)
static HDC WINAPI rendertarget_GetMemoryDC(IDWriteBitmapRenderTarget1 *iface)
static ULONG WINAPI memresourceloader_Release(IDWriteFontFileLoader *iface)
static HRESULT WINAPI rendertarget_DrawGlyphRun(IDWriteBitmapRenderTarget1 *iface, FLOAT originX, FLOAT originY, DWRITE_MEASURING_MODE measuring_mode, DWRITE_GLYPH_RUN const *run, IDWriteRenderingParams *params, COLORREF color, RECT *bbox_ret)
static struct memresource_stream * impl_from_IDWriteFontFileStream(IDWriteFontFileStream *iface)
static struct rendertarget * impl_from_ID2D1SimplifiedGeometrySink(ID2D1SimplifiedGeometrySink *iface)
static HRESULT WINAPI gdiinterop1_GetFontSignature(IDWriteGdiInterop1 *iface, IDWriteFont *font, FONTSIGNATURE *fontsig)
static void WINAPI rendertarget_sink_BeginFigure(ID2D1SimplifiedGeometrySink *iface, D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin)
static void WINAPI memresourcestream_ReleaseFileFragment(IDWriteFontFileStream *iface, void *fragment_context)
static DWORD blend_pixel(BYTE r, BYTE g, BYTE b, DWORD text, BYTE alpha)
static const IDWriteBitmapRenderTarget1Vtbl rendertargetvtbl
static HRESULT WINAPI gdiinterop_CreateBitmapRenderTarget(IDWriteGdiInterop1 *iface, HDC hdc, UINT32 width, UINT32 height, IDWriteBitmapRenderTarget **target)
static DWRITE_TEXT_ANTIALIAS_MODE WINAPI rendertarget_GetTextAntialiasMode(IDWriteBitmapRenderTarget1 *iface)
static HRESULT WINAPI gdiinterop_ConvertFontFaceToLOGFONT(IDWriteGdiInterop1 *iface, IDWriteFontFace *fontface, LOGFONTW *logfont)
static ULONG WINAPI rendertarget_sink_AddRef(ID2D1SimplifiedGeometrySink *iface)
static const IDWriteFontFileLoaderVtbl memresourceloadervtbl
HRESULT create_gdiinterop(IDWriteFactory7 *factory, IDWriteGdiInterop1 **ret)
BOOL WINAPI GetFontRealizationInfo(HDC hdc, struct font_realization_info *info)
static ULONG WINAPI memresourcestream_Release(IDWriteFontFileStream *iface)
static DWORD blend_subpixel(BYTE r, BYTE g, BYTE b, DWORD text, const BYTE *alpha)
static HRESULT WINAPI memresourceloader_CreateStreamFromKey(IDWriteFontFileLoader *iface, void const *key, UINT32 key_size, IDWriteFontFileStream **ret)
static HRESULT WINAPI rendertarget_sink_QueryInterface(ID2D1SimplifiedGeometrySink *iface, REFIID riid, void **obj)
static ULONG WINAPI memresourcestream_AddRef(IDWriteFontFileStream *iface)
BOOL WINAPI GetFontFileInfo(DWORD instance_id, DWORD file_index, struct font_fileinfo *info, SIZE_T size, SIZE_T *needed)
static HRESULT WINAPI gdiinterop1_GetMatchingFontsByLOGFONT(IDWriteGdiInterop1 *iface, LOGFONTW const *logfont, IDWriteFontSet *fontset, IDWriteFontSet **subset)
static DWORD * get_pixel_ptr_32(struct dib_data *dib, int x, int y)
static void WINAPI rendertarget_sink_AddBeziers(ID2D1SimplifiedGeometrySink *iface, const D2D1_BEZIER_SEGMENT *beziers, UINT32 count)
static HRESULT WINAPI memresourcestream_ReadFileFragment(IDWriteFontFileStream *iface, void const **fragment_start, UINT64 offset, UINT64 fragment_size, void **fragment_context)
static HRESULT WINAPI gdiinterop_CreateFontFaceFromHdc(IDWriteGdiInterop1 *iface, HDC hdc, IDWriteFontFace **fontface)
static ULONG WINAPI gdiinterop_AddRef(IDWriteGdiInterop1 *iface)
static void WINAPI rendertarget_sink_SetFillMode(ID2D1SimplifiedGeometrySink *iface, D2D1_FILL_MODE mode)
static HRESULT create_target_dibsection(struct rendertarget *target, UINT32 width, UINT32 height)
static HRESULT WINAPI rendertarget_GetSize(IDWriteBitmapRenderTarget1 *iface, SIZE *size)
static void blit_subpixel_888(struct dib_data *dib, int dib_width, const BYTE *src, const RECT *rect, DWORD text_pixel)
static HRESULT WINAPI rendertarget_SetCurrentTransform(IDWriteBitmapRenderTarget1 *iface, DWRITE_MATRIX const *transform)
static HRESULT WINAPI rendertarget_GetCurrentTransform(IDWriteBitmapRenderTarget1 *iface, DWRITE_MATRIX *transform)
static const IDWriteGdiInterop1Vtbl gdiinteropvtbl
static HRESULT WINAPI rendertarget_SetTextAntialiasMode(IDWriteBitmapRenderTarget1 *iface, DWRITE_TEXT_ANTIALIAS_MODE mode)
static void blit_8(struct dib_data *dib, const BYTE *src, const RECT *rect, DWORD text_pixel)
static struct rendertarget * impl_from_IDWriteBitmapRenderTarget1(IDWriteBitmapRenderTarget1 *iface)
static HRESULT WINAPI rendertarget_QueryInterface(IDWriteBitmapRenderTarget1 *iface, REFIID riid, void **obj)
static float WINAPI rendertarget_GetPixelsPerDip(IDWriteBitmapRenderTarget1 *iface)
BOOL WINAPI GetFontFileData(DWORD instance_id, DWORD file_index, UINT64 offset, void *buff, SIZE_T buff_size)
static ULONG WINAPI gdiinterop_Release(IDWriteGdiInterop1 *iface)
static const ID2D1SimplifiedGeometrySinkVtbl rendertargetsinkvtbl
static struct gdiinterop * impl_from_IDWriteGdiInterop1(IDWriteGdiInterop1 *iface)
static HRESULT WINAPI rendertarget_Resize(IDWriteBitmapRenderTarget1 *iface, UINT32 width, UINT32 height)
static BYTE blend_color(BYTE dst, BYTE src, BYTE alpha)
static ULONG WINAPI memresourceloader_AddRef(IDWriteFontFileLoader *iface)
static HRESULT WINAPI gdiinterop_QueryInterface(IDWriteGdiInterop1 *iface, REFIID riid, void **obj)
static HRESULT WINAPI rendertarget_sink_Close(ID2D1SimplifiedGeometrySink *iface)
static void WINAPI rendertarget_sink_AddLines(ID2D1SimplifiedGeometrySink *iface, const D2D1_POINT_2F *points, UINT32 count)
static void WINAPI rendertarget_sink_SetSegmentFlags(ID2D1SimplifiedGeometrySink *iface, D2D1_PATH_SEGMENT vertexFlags)
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
GLint GLint GLsizei GLsizei height
GLclampf GLclampf GLclampf alpha
GLint GLint GLint GLint GLint GLint y
GLdouble GLdouble GLdouble r
GLint GLint GLsizei width
GLuint GLenum GLenum transform
GLenum GLenum GLenum GLenum GLenum scale
GLboolean GLboolean GLboolean b
GLenum const GLfloat * params
GLsizei const GLfloat * points
#define memcpy(s1, s2, n)
#define IsEqualIID(riid1, riid2)
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
static const char *static const char const char DWORD void DWORD *static const char const char DWORD void DWORD *static const char DWORD DWORD void * buff
IDWriteFontFace * fontFace
DWRITE_GLYPH_OFFSET const * glyphOffsets
UINT16 const * glyphIndices
FLOAT const * glyphAdvances
WCHAR lfFaceName[LF_FACESIZE]
IDWriteFontFileLoader IDWriteFontFileLoader_iface
IDWriteFactory7 * factory
IDWriteGdiInterop1 IDWriteGdiInterop1_iface
IDWriteFontFileStream IDWriteFontFileStream_iface
DWRITE_TEXT_ANTIALIAS_MODE antialiasmode
IDWriteFactory7 * factory
ID2D1SimplifiedGeometrySink ID2D1SimplifiedGeometrySink_iface
IDWriteBitmapRenderTarget1 IDWriteBitmapRenderTarget1_iface
BITMAPINFOHEADER bmiHeader
#define FIELD_OFFSET(t, f)
#define CONTAINING_RECORD(address, type, field)
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
#define DWRITE_E_FILEFORMAT
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
int WINAPI SetGraphicsMode(_In_ HDC, _In_ int)
BOOL WINAPI PolyBezierTo(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI FillPath(_In_ HDC)
BOOL WINAPI SetWorldTransform(_In_ HDC, _In_ const XFORM *)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI EndPath(_In_ HDC)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
BOOL WINAPI BeginPath(_In_ HDC hdc)
BOOL WINAPI CloseFigure(_In_ HDC hdc)
int WINAPI SetPolyFillMode(_In_ HDC, _In_ int)
#define OUT_OUTLINE_PRECIS