GDI text testing

This commit is contained in:
Brad Parker 2017-01-05 22:17:48 -05:00
parent 49d7be9813
commit dd2778fb32
2 changed files with 19 additions and 18 deletions

View File

@ -515,26 +515,12 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message,
{
LRESULT ret;
bool quit = false;
PAINTSTRUCT ps;
HDC hdc;
RECT rc;
POINT aptStar[6] = {50,2, 2,98, 98,33, 2,33, 98,98, 50,2};
if (message == WM_NCLBUTTONDBLCLK)
doubleclick_on_titlebar = true;
switch (message)
{
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
//TextOut(hdc, 0, 0, "Hello, Windows!", 15);
GetClientRect(hwnd, &rc);
SetMapMode(hdc, MM_ANISOTROPIC);
SetWindowExtEx(hdc, 100, 100, NULL);
SetViewportExtEx(hdc, rc.right, rc.bottom, NULL);
Polyline(hdc, aptStar, 6);
EndPaint(hwnd, &ps);
return 0L;
case WM_DROPFILES:
case WM_SYSCOMMAND:
case WM_CHAR:

View File

@ -17,6 +17,7 @@
#include <stdlib.h>
#include <string/stdstring.h>
#include <encodings/utf.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
@ -26,6 +27,10 @@
#include "../../configuration.h"
#include "../../verbosity.h"
#include "../common/gdi_common.h"
#include "../common/win32_common.h"
#include <windows.h>
#include <wingdi.h>
typedef struct
{
@ -82,6 +87,8 @@ static void gdi_render_msg(void *data, const char *msg,
unsigned newX, newY;
settings_t *settings = config_get_ptr();
const struct font_params *params = (const struct font_params*)userdata;
HDC hdc;
HWND hwnd = win32_get_window();
if (!font || string_is_empty(msg))
return;
@ -100,15 +107,23 @@ static void gdi_render_msg(void *data, const char *msg,
if (!font->gdi)
return;
newX = x * width;
newY = height - (y * height);
newX = x;//x * width;
newY = y;//height - (y * height);
if (strlen(msg) + newX > width)
newX -= strlen(msg) + newX - width;
//if (strlen(msg) + newX > width)
// newX -= strlen(msg) + newX - width;
//gdi_put_str(*font->gdi->gdi_cv, newX, newY, msg);
//gdi_refresh_display(*font->gdi->gdi_display);
printf("drawing text: %s at %d x %d\n", msg, newX, newY);
hdc = GetDC(hwnd);
TextOut(hdc, newX, newY, msg, utf8len(msg));
ReleaseDC(hwnd, hdc);
UpdateWindow(hwnd);
}
static void gdi_font_flush_block(void* data)