gfxFontEntry* gfxGDIFontList::GetDefaultFont(const gfxFontStyle* aStyle, PRBool& aNeedsBold) { // this really shouldn't fail to find a font.... HGDIOBJ hGDI = ::GetStockObject(DEFAULT_GUI_FONT); LOGFONTW logFont; if (hGDI && ::GetObjectW(hGDI, sizeof(logFont), &logFont)) { nsAutoString resolvedName; if (ResolveFontName(nsDependentString(logFont.lfFaceName), resolvedName)) { return FindFontForFamily(resolvedName, aStyle, aNeedsBold); } } // ...but just in case, try another approach as well NONCLIENTMETRICSW ncm; ncm.cbSize = sizeof(ncm); BOOL status = ::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0); if (status) { nsAutoString resolvedName; if (ResolveFontName(nsDependentString(ncm.lfMessageFont.lfFaceName), resolvedName)) { return FindFontForFamily(resolvedName, aStyle, aNeedsBold); } } return nsnull; }
PRBool gfxPlatformFontList::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) { aFamilyName.Truncate(); ResolveFontName(aFontName, aFamilyName); return !aFamilyName.IsEmpty(); }
gfxFontEntry* gfxFT2FontList::GetDefaultFont(const gfxFontStyle* aStyle, PRBool& aNeedsBold) { #ifdef XP_WIN HGDIOBJ hGDI = ::GetStockObject(SYSTEM_FONT); LOGFONTW logFont; if (hGDI && ::GetObjectW(hGDI, sizeof(logFont), &logFont)) { nsAutoString resolvedName; if (ResolveFontName(nsDependentString(logFont.lfFaceName), resolvedName)) { return FindFontForFamily(resolvedName, aStyle, aNeedsBold); } } #elif defined(ANDROID) nsAutoString resolvedName; if (ResolveFontName(NS_LITERAL_STRING("Droid Sans"), resolvedName)) return FindFontForFamily(resolvedName, aStyle, aNeedsBold); #endif /* TODO: what about Qt or other platforms that may use this? */ return nsnull; }