HDC dc = GetDC(0);
HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(dc, hfont));
WCHAR actual_font_name[LF_FACESIZE];
- DWORD size_ret = GetTextFace(dc, LF_FACESIZE, actual_font_name);
- actual_font_name[LF_FACESIZE - 1] = 0;
+ int size_ret = GetTextFace(dc, LF_FACESIZE, actual_font_name);
SelectObject(dc, oldFont);
DeleteObject(hfont);
ReleaseDC(0, dc);
// We don't have to worry about East Asian fonts with locale-dependent
// names here.
- return wcscmp(font_name, actual_font_name) == 0;
+ return (size_ret != 0) && wcscmp(font_name, actual_font_name) == 0;
}
class OverrideLocaleHolder {
}
void AdjustUIFont(LOGFONT* logfont) {
- double dpi_scale = gfx::GetDPIScale();
+ float dpi_scale = gfx::GetDPIScale();
if (gfx::Display::HasForceDeviceScaleFactor()) {
// If the scale is forced, we don't need to adjust it here.
- dpi_scale = 1.0;
+ dpi_scale = 1.0f;
}
AdjustUIFontForDIP(dpi_scale, logfont);
}