More sample work. Ugh this is a mess I should just use Direct2D after all.
This commit is contained in:
parent
351fc59b9f
commit
ecbdddb703
|
@ -362,6 +362,7 @@ STDMETHODIMP gdiRenderer::DrawUnderline(void *clientDrawingContext, FLOAT baseli
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO rename this function
|
||||||
// TODO consider using Direct2D instead
|
// TODO consider using Direct2D instead
|
||||||
static void doPaint(struct fontDialog *f)
|
static void doPaint(struct fontDialog *f)
|
||||||
{
|
{
|
||||||
|
@ -369,6 +370,12 @@ static void doPaint(struct fontDialog *f)
|
||||||
HDC dc;
|
HDC dc;
|
||||||
IDWriteBitmapRenderTarget *target;
|
IDWriteBitmapRenderTarget *target;
|
||||||
gdiRenderer *renderer;
|
gdiRenderer *renderer;
|
||||||
|
LRESULT i;
|
||||||
|
IDWriteFont *font;
|
||||||
|
IDWriteLocalizedStrings *sampleStrings;
|
||||||
|
WCHAR *sample;
|
||||||
|
IDWriteTextFormat *format;
|
||||||
|
IDWriteTextLayout *layout;
|
||||||
HDC memoryDC;
|
HDC memoryDC;
|
||||||
RECT memoryRect;
|
RECT memoryRect;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -386,6 +393,19 @@ static void doPaint(struct fontDialog *f)
|
||||||
renderer = new gdiRenderer;
|
renderer = new gdiRenderer;
|
||||||
renderer->refcount = 1;
|
renderer->refcount = 1;
|
||||||
|
|
||||||
|
i = SendMessageW(f->familyCombobox, CB_GETCURSEL, 0, 0);
|
||||||
|
if (i == (LRESULT) CB_ERR)
|
||||||
|
return; // TODO something more appropriate
|
||||||
|
font = (IDWriteFont *) SendMessageW(f->styleCombobox, CB_GETITEMDATA, (WPARAM) i, 0);
|
||||||
|
if (font == (IDWriteFont *) CB_ERR)
|
||||||
|
logLastError("error getting font to draw font dialog sample in doPaint()");
|
||||||
|
// TOOD allow for a fallback
|
||||||
|
hr = font->GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT, &sampleStrings);
|
||||||
|
if (hr != S_OK)
|
||||||
|
logHRESULT("error getting sample sring to draw in font dialog in doPaint()");
|
||||||
|
sample = fontCollectionCorrectString(f->fc, sampleStrings);
|
||||||
|
sampleStrings->Release();
|
||||||
|
|
||||||
// TODO actually draw
|
// TODO actually draw
|
||||||
|
|
||||||
memoryDC = target->GetMemoryDC();
|
memoryDC = target->GetMemoryDC();
|
||||||
|
@ -399,6 +419,7 @@ static void doPaint(struct fontDialog *f)
|
||||||
SRCCOPY | NOMIRRORBITMAP) == 0)
|
SRCCOPY | NOMIRRORBITMAP) == 0)
|
||||||
logLastError("error blitting sample text to font dialog in doPaint()");
|
logLastError("error blitting sample text to font dialog in doPaint()");
|
||||||
|
|
||||||
|
uiFree(sample);
|
||||||
renderer->Release();
|
renderer->Release();
|
||||||
target->Release();
|
target->Release();
|
||||||
EndPaint(f->hwnd, &ps);
|
EndPaint(f->hwnd, &ps);
|
||||||
|
|
Loading…
Reference in New Issue