Lines Matching defs:lf

50 static void call_ensure_accessible(const LOGFONT& lf) {
52 gEnsureLOGFONTAccessibleProc(lf);
105 static void dcfontname_to_skstring(HDC deviceContext, const LOGFONT& lf, SkString* familyName) {
108 call_ensure_accessible(lf);
116 call_ensure_accessible(lf);
125 static void make_canonical(LOGFONT* lf) {
126 lf->lfHeight = -64;
127 lf->lfWidth = 0; // lfWidth is related to lfHeight, not to the OS/2::usWidthClass.
128 lf->lfQuality = CLEARTYPE_QUALITY;//PROOF_QUALITY;
129 lf->lfCharSet = DEFAULT_CHARSET;
130 // lf->lfClipPrecision = 64;
133 static SkFontStyle get_style(const LOGFONT& lf) {
134 return SkFontStyle(lf.lfWeight,
136 lf.lfItalic ? SkFontStyle::kItalic_Slant : SkFontStyle::kUpright_Slant);
154 static unsigned calculateGlyphCount(HDC hdc, const LOGFONT& lf) {
158 call_ensure_accessible(lf);
190 static unsigned calculateUPEM(HDC hdc, const LOGFONT& lf) {
194 call_ensure_accessible(lf);
205 call_ensure_accessible(lf);
214 explicit SkAutoHDC(const LOGFONT& lf)
216 , fFont(::CreateFontIndirect(&lf))
237 LogFontTypeface(const SkFontStyle& style, const LOGFONT& lf, bool serializeAsStream)
239 , fLogFont(lf)
245 call_ensure_accessible(lf);
266 static sk_sp<LogFontTypeface> Make(const LOGFONT& lf) {
267 return sk_sp<LogFontTypeface>(new LogFontTypeface(get_style(lf), lf, false));
311 static sk_sp<FontMemResourceTypeface> Make(const LOGFONT& lf, HANDLE fontMemResource) {
313 new FontMemResourceTypeface(get_style(lf), lf, fontMemResource));
326 FontMemResourceTypeface(const SkFontStyle& style, const LOGFONT& lf, HANDLE fontMemResource)
327 : LogFontTypeface(style, lf, true), fFontMemResource(fontMemResource)
342 const LOGFONT* lf = reinterpret_cast<const LOGFONT*>(ctx);
344 return !memcmp(&lface->fLogFont, lf, sizeof(LOGFONT));
352 LOGFONT lf = origLF;
353 make_canonical(&lf);
354 sk_sp<SkTypeface> face = SkTypefaceCache::FindByProcAndRef(FindByLogFont, &lf);
356 face = LogFontTypeface::Make(lf);
366 LOGFONT lf = origLF;
367 make_canonical(&lf);
369 return FontMemResourceTypeface::Make(lf, fontMemResource);
375 void SkLOGFONTFromTypeface(const SkTypeface* face, LOGFONT* lf) {
377 *lf = get_default_font();
379 *lf = static_cast<const LogFontTypeface*>(face)->fLogFont;
685 LOGFONT lf = typeface->fLogFont;
686 lf.lfHeight = -SkScalarTruncToInt(gdiTextSize);
687 lf.lfQuality = compute_quality(fRec);
688 fFont = CreateFontIndirect(&lf);
696 call_ensure_accessible(lf);
744 call_ensure_accessible(lf);
1584 static void logfont_for_name(const char* familyName, LOGFONT* lf) {
1585 sk_bzero(lf, sizeof(LOGFONT));
1596 ::wcsncpy(lf->lfFaceName, wideFamilyName, LF_FACESIZE - 1);
1598 lf->lfFaceName[LF_FACESIZE-1] = L'\0';
1600 ::strncpy(lf->lfFaceName, familyName, LF_FACESIZE - 1);
1601 lf->lfFaceName[LF_FACESIZE - 1] = '\0';
1627 LOGFONT lf = fLogFont;
1633 SkAutoHDC hdc(lf);
1644 call_ensure_accessible(lf);
1647 if (!otmRet || !GetTextFace(hdc, LF_FACESIZE, lf.lfFaceName)) {
1650 lf.lfHeight = -SkToS32(otm.otmEMSquare);
1651 designFont.reset(CreateFontIndirect(&lf));
1659 tchar_to_skstring(lf.lfFaceName, &info->fFontName);
1816 LOGFONT lf;
1817 logfont_for_name(familyName, &lf);
1819 return sk_sp<SkTypeface>(SkCreateFontMemResourceTypefaceFromLOGFONT(lf, fontReference));
1826 LOGFONT lf = fLogFont;
1828 SkAutoHDC hdc(lf);
1835 call_ensure_accessible(lf);
2039 LOGFONT lf = fLogFont;
2040 SkAutoHDC hdc(lf);
2048 call_ensure_accessible(lf);
2055 LOGFONT lf = fLogFont;
2056 SkAutoHDC hdc(lf);
2061 call_ensure_accessible(lf);
2154 static bool valid_logfont_for_enum(const LOGFONT& lf) {
2158 lf.lfFaceName[0] && lf.lfFaceName[0] != '@'
2162 && ANSI_CHARSET == lf.lfCharSet
2170 static int CALLBACK enum_family_proc(const LOGFONT* lf, const TEXTMETRIC*,
2172 if (valid_logfont_for_enum(*lf)) {
2174 *array->append() = *(ENUMLOGFONTEX*)lf;
2182 LOGFONT lf;
2183 sk_bzero(&lf, sizeof(lf));
2184 lf.lfCharSet = DEFAULT_CHARSET;
2185 _tcscpy_s(lf.lfFaceName, familyName);
2188 ::EnumFontFamiliesEx(hdc, &lf, enum_family_proc, (LPARAM)&fArray, 0);
2228 LOGFONT lf;
2229 sk_bzero(&lf, sizeof(lf));
2230 lf.lfCharSet = DEFAULT_CHARSET;
2233 ::EnumFontFamiliesEx(hdc, &lf, enum_family_proc, (LPARAM)&fLogFontArray, 0);
2256 LOGFONT lf;
2257 logfont_for_name(familyName, &lf);
2258 return new SkFontStyleSetGDI(lf.lfFaceName);
2300 LOGFONT lf;
2302 lf = get_default_font();
2304 logfont_for_name(familyName, &lf);
2307 lf.lfWeight = style.weight();
2308 lf.lfItalic = style.slant() == SkFontStyle::kUpright_Slant ? FALSE : TRUE;
2309 return sk_sp<SkTypeface>(SkCreateTypefaceFromLOGFONT(lf));