73 return ((
width *
bpp + 31) >> 3) & ~3;
89 memset(bmi, 0,
sizeof(bmibuf));
139 ID2D1SimplifiedGeometrySink_AddRef(iface);
153 return IDWriteBitmapRenderTarget1_AddRef(&
target->IDWriteBitmapRenderTarget1_iface);
159 return IDWriteBitmapRenderTarget1_Release(&
target->IDWriteBitmapRenderTarget1_iface);
242 IDWriteBitmapRenderTarget1_AddRef(iface);
272 IDWriteFactory7_Release(
target->factory);
310 for (
x = 0;
x < src_width;
x++) {
311 if (!
src[
x])
continue;
312 if (
src[
x] == DWRITE_ALPHA_MAX)
313 dst_ptr[
x] = text_pixel;
315 dst_ptr[
x] =
blend_pixel(dst_ptr[
x] >> 16, dst_ptr[
x] >> 8, dst_ptr[
x], text_pixel,
src[
x]);
319 dst_ptr +=
dib->stride / 4;
330 for (
x = 0;
x < src_width;
x++) {
331 if (
src[3*
x] == 0 &&
src[3*
x+1] == 0 &&
src[3*
x+2] == 0)
continue;
334 dst_ptr +=
dib->stride / 4;
335 src += src_width * 3;
341 return (((
color >> 16) & 0xff) | (
color & 0xff00) | ((
color << 16) & 0xff0000));
355 IDWriteFontFace3 *fontface;
356 RECT target_rect, bounds;
359 TRACE(
"%p, %.8e, %.8e, %d, %p, %p, 0x%08lx, %p.\n", iface, originX, originY,
370 if (
FAILED(
hr = IDWriteFontFace_QueryInterface(run->
fontFace, &IID_IDWriteFontFace3, (
void **)&fontface))) {
371 WARN(
"Failed to get IDWriteFontFace2 interface, hr %#lx.\n",
hr);
375 hr = IDWriteFontFace3_GetRecommendedRenderingMode(fontface, run->
fontEmSize,
target->ppdip * 96.0f,
377 params, &rendermode, &gridfitmode);
378 IDWriteFontFace3_Release(fontface);
386 static const XFORM identity = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f };
391 if (
m->m11 *
m->m22 ==
m->m12 *
m->m21) {
403 xform.
eDx =
m->m11 * originX +
m->m21 * originY +
m->dx;
404 xform.
eDy =
m->m12 * originX +
m->m22 * originY +
m->dy;
426 *bbox_ret = target_rect;
439 hr = IDWriteFactory7_CreateGlyphRunAnalysis(
target->factory, run, &
m, rendermode, measuring_mode,
440 gridfitmode,
target->antialiasmode, originX, originY, &analysis);
443 WARN(
"failed to create analysis instance, 0x%08lx\n",
hr);
453 WARN(
"GetAlphaTextureBounds() failed, 0x%08lx\n",
hr);
454 IDWriteGlyphRunAnalysis_Release(analysis);
470 IDWriteGlyphRunAnalysis_Release(analysis);
474 hr = IDWriteGlyphRunAnalysis_CreateAlphaTexture(analysis, texturetype, &target_rect,
bitmap,
size);
482 if (bbox_ret) *bbox_ret = target_rect;
492 IDWriteGlyphRunAnalysis_Release(analysis);
501 TRACE(
"%p.\n", iface);
510 TRACE(
"%p.\n", iface);
574 TRACE(
"%p.\n", iface);
576 return target->antialiasmode;
585 if ((
DWORD)
mode > DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE)
628 IDWriteBitmapRenderTarget1_Release(&
target->IDWriteBitmapRenderTarget1_iface);
634 target->antialiasmode = DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE;
636 IDWriteFactory7_AddRef(
factory);
652 IDWriteGdiInterop1_AddRef(iface);
692 TRACE(
"%p, %p, %p.\n", iface, logfont,
font);
694 return IDWriteGdiInterop1_CreateFontFromLOGFONT(iface, logfont,
NULL,
font);
704 TRACE(
"%p, %p, %p, %p.\n", iface,
font, logfont, is_systemfont);
706 *is_systemfont =
FALSE;
708 memset(logfont, 0,
sizeof(*logfont));
713 hr = IDWriteFont_GetFontFamily(
font, &family);
717 hr = IDWriteFontFamily_GetFontCollection(family, &
collection);
718 IDWriteFontFamily_Release(family);
735 TRACE(
"%p, %p, %p.\n", iface, fontface, logfont);
737 memset(logfont, 0,
sizeof(*logfont));
786 TRACE(
"%p, %p, %p.\n", iface,
hdc, fontface);
796 WARN(
"failed to get selected font id\n");
803 WARN(
"failed to get font file info size\n");
819 hr = IDWriteFactory7_CreateCustomFontFileReference(interop->
factory, &
info.instance_id,
826 is_supported =
FALSE;
827 hr = IDWriteFontFile_Analyze(
file, &is_supported, &
filetype, &facetype, &facenum);
831 hr = IDWriteFactory7_CreateFontFace(interop->
factory, facetype, 1, &
file,
info.face_index,
832 info.simulations, fontface);
837 IDWriteFontFile_Release(
file);
872 ERR(
"failed to get system font collection: 0x%08lx.\n",
hr);
892 IDWriteFontFamily_Release(family);
902 TRACE(
"%p, %p, %p.\n", iface, fontface, fontsig);
909 TRACE(
"%p, %p, %p.\n", iface,
font, fontsig);
922 TRACE(
"%p, %p, %p, %p.\n", iface, logfont, fontset, subset);
924 if (!logfont || !fontset)
929 property.localeName =
L"";
931 return IDWriteFontSet_GetMatchingFonts(fontset, &
property, 1, subset);
956 IDWriteFontFileStream_AddRef(iface);
998 *fragment_context =
NULL;
999 *fragment_start =
NULL;
1007 if (!(fragment =
malloc(fragment_size)))
1013 *fragment_start = *fragment_context = fragment;
1019 TRACE(
"%p, %p.\n", iface, fragment_context);
1021 free(fragment_context);
1041 TRACE(
"%p, %p.\n", iface, last_writetime);
1063 IDWriteFontFileLoader_AddRef(iface);
1087 TRACE(
"%p, %p, %u, %p.\n", iface,
key, key_size,
ret);
1091 if (!
key || key_size !=
sizeof(
DWORD))
1101 *
ret = &
stream->IDWriteFontFileStream_iface;
1120 if (!(interop =
malloc(
sizeof(*interop))))
1127 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