DirectWrite support #28
4 changed files with 3326 additions and 5 deletions
commit
9f89ce2e00
|
|
@ -13,8 +13,9 @@
|
||||||
#define WINBOOL int
|
#define WINBOOL int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dwrite_c.h"
|
/* dwrite is vendored because it's only mingw that gives us COBJMACRO */
|
||||||
#include "dwrite_3_c.h"
|
#include "dwrite.h"
|
||||||
|
#include "dwrite_3.h"
|
||||||
|
|
||||||
static struct dw {
|
static struct dw {
|
||||||
HMODULE d2d1_lib;
|
HMODULE d2d1_lib;
|
||||||
|
|
@ -195,11 +196,34 @@ fail:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dw_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwLLColor color) {
|
static int dw_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, MwLLColor color) {
|
||||||
return 0;
|
IDWriteBitmapRenderTarget *target;
|
||||||
|
RECT rc;
|
||||||
|
HDC memoryHDC;
|
||||||
|
DWRITE_GLYPH_RUN glyphRun;
|
||||||
|
DWRITE_FONT_METRICS metrics;
|
||||||
|
LONG width, height;
|
||||||
|
IDWriteFontFace_GetMetrics(ttf->font_face, &metrics);
|
||||||
|
|
||||||
|
GetClientRect(handle->lowlevel->gdi.hWnd, &rc);
|
||||||
|
MapWindowPoints(handle->lowlevel->gdi.hWnd, GetParent(handle->lowlevel->gdi.hWnd), (LPPOINT)&rc, 2);
|
||||||
|
|
||||||
|
width = rc.right - rc.left;
|
||||||
|
height = MwTextHeight(handle, ttf, text);
|
||||||
|
IDWriteGdiInterop_CreateBitmapRenderTarget(ttf->gdiInterop, handle->lowlevel->gdi.hDC, width, height, &target);
|
||||||
|
|
||||||
|
memoryHDC = IDWriteBitmapRenderTarget_GetMemoryDC(target);
|
||||||
|
|
||||||
|
BitBlt(handle->lowlevel->gdi.hDC, point->x , point->y, width, height, memoryHDC, 0, 0, SRCCOPY | NOMIRRORBITMAP);
|
||||||
|
|
||||||
|
IDWriteBitmapRenderTarget_Release(target);
|
||||||
|
|
||||||
|
/*SelectObject(handle->lowlevel->gdi.hDC, &ttf->logfont);
|
||||||
|
TextOut(handle->lowlevel->gdi.hDC, point->x, point->y, text, ttf->px);*/
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dw_MwTextWidth(MwFLFont ttf, const char* text) {
|
static int dw_MwTextWidth(MwFLFont ttf, const char* text) {
|
||||||
int tw = 15;
|
int tw = 1;
|
||||||
|
|
||||||
return tw + 1;
|
return tw + 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3297
src/text/dwrite_2.h
Normal file
3297
src/text/dwrite_2.h
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -406,7 +406,7 @@ interface IDWriteBitmapRenderTarget3;
|
||||||
|
|
||||||
/* Headers for imported files */
|
/* Headers for imported files */
|
||||||
|
|
||||||
#include <dwrite_2.h>
|
#include "dwrite_2.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
Loading…
Add table
Add a link
Reference in a new issue