Cleanup
This commit is contained in:
parent
9561e87d49
commit
0b14022655
|
@ -218,7 +218,7 @@ void uiDrawLoadDefaultFont(uiFontDescriptor *f)
|
||||||
CTFontRef ctfont;
|
CTFontRef ctfont;
|
||||||
CTFontDescriptorRef ctdesc;
|
CTFontDescriptorRef ctdesc;
|
||||||
|
|
||||||
ctfont = (CTFontRef) [NSFont systemFontOfSize:0];
|
ctfont = (CTFontRef) [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSControlSizeRegular]];
|
||||||
ctdesc = CTFontCopyFontDescriptor(ctfont);
|
ctdesc = CTFontCopyFontDescriptor(ctfont);
|
||||||
uiprivFontDescriptorFromCTFontDescriptor(ctdesc, f);
|
uiprivFontDescriptorFromCTFontDescriptor(ctdesc, f);
|
||||||
CFRelease(ctdesc);
|
CFRelease(ctdesc);
|
||||||
|
|
|
@ -101,11 +101,10 @@ static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *p)
|
||||||
int useSystemFont = uiCheckboxChecked(systemFont);
|
int useSystemFont = uiCheckboxChecked(systemFont);
|
||||||
|
|
||||||
params.String = attrstr;
|
params.String = attrstr;
|
||||||
if(useSystemFont) {
|
if (useSystemFont)
|
||||||
uiDrawLoadDefaultFont(&defaultFont);
|
uiDrawLoadDefaultFont(&defaultFont);
|
||||||
} else {
|
else
|
||||||
uiFontButtonFont(fontButton, &defaultFont);
|
uiFontButtonFont(fontButton, &defaultFont);
|
||||||
}
|
|
||||||
params.DefaultFont = &defaultFont;
|
params.DefaultFont = &defaultFont;
|
||||||
params.Width = p->AreaWidth;
|
params.Width = p->AreaWidth;
|
||||||
params.Align = (uiDrawTextAlign) uiComboboxSelected(alignment);
|
params.Align = (uiDrawTextAlign) uiComboboxSelected(alignment);
|
||||||
|
|
|
@ -86,7 +86,7 @@ void uiDrawLoadDefaultFont(uiFontDescriptor *f)
|
||||||
GtkStyleContext *style;
|
GtkStyleContext *style;
|
||||||
PangoFontDescription *fontdesc;
|
PangoFontDescription *fontdesc;
|
||||||
|
|
||||||
widget = g_object_ref_sink(gtk_drawing_area_new());
|
widget = g_object_ref_sink(gtk_label_new(""));
|
||||||
style = gtk_widget_get_style_context(widget);
|
style = gtk_widget_get_style_context(widget);
|
||||||
gtk_style_context_get(style, GTK_STATE_FLAG_NORMAL,
|
gtk_style_context_get(style, GTK_STATE_FLAG_NORMAL,
|
||||||
"font", &fontdesc, NULL);
|
"font", &fontdesc, NULL);
|
||||||
|
|
|
@ -541,14 +541,15 @@ void uiDrawLoadDefaultFont(uiFontDescriptor *f)
|
||||||
IDWriteGdiInterop *gdi;
|
IDWriteGdiInterop *gdi;
|
||||||
IDWriteFont *dwfont;
|
IDWriteFont *dwfont;
|
||||||
IDWriteFontFamily *dwfamily;
|
IDWriteFontFamily *dwfamily;
|
||||||
NONCLIENTMETRICS metrics;
|
NONCLIENTMETRICSW metrics;
|
||||||
|
HDC dc;
|
||||||
WCHAR *family;
|
WCHAR *family;
|
||||||
double size;
|
double size;
|
||||||
int pixels;
|
int pixels;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
metrics.cbSize = sizeof(metrics);
|
metrics.cbSize = sizeof(metrics);
|
||||||
if (!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0))
|
if (!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0))
|
||||||
logLastError(L"error getting non-client metrics");
|
logLastError(L"error getting non-client metrics");
|
||||||
hr = dwfactory->GetGdiInterop(&gdi);
|
hr = dwfactory->GetGdiInterop(&gdi);
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
|
@ -564,7 +565,10 @@ void uiDrawLoadDefaultFont(uiFontDescriptor *f)
|
||||||
collection = uiprivLoadFontCollection();
|
collection = uiprivLoadFontCollection();
|
||||||
family = uiprivFontCollectionFamilyName(collection, dwfamily);
|
family = uiprivFontCollectionFamilyName(collection, dwfamily);
|
||||||
|
|
||||||
pixels = GetDeviceCaps(GetDC(NULL), LOGPIXELSY);
|
dc = GetDC(NULL);
|
||||||
|
if (dc == NULL)
|
||||||
|
logLastError(L"error getting DC");
|
||||||
|
pixels = GetDeviceCaps(dc, LOGPIXELSY);
|
||||||
if (pixels == 0)
|
if (pixels == 0)
|
||||||
logLastError(L"error getting device caps");
|
logLastError(L"error getting device caps");
|
||||||
size = abs(metrics.lfMessageFont.lfHeight) * 72 / pixels;
|
size = abs(metrics.lfMessageFont.lfHeight) * 72 / pixels;
|
||||||
|
@ -577,4 +581,6 @@ void uiDrawLoadDefaultFont(uiFontDescriptor *f)
|
||||||
uiprivFontCollectionFree(collection);
|
uiprivFontCollectionFree(collection);
|
||||||
dwfamily->Release();
|
dwfamily->Release();
|
||||||
gdi->Release();
|
gdi->Release();
|
||||||
|
if (ReleaseDC(NULL, dc) == 0)
|
||||||
|
logLastError(L"error releasing DC");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue