Correctly handle lfWidth in GDI.

The LOGFONT::lfWidth field is related to the LOGFONT::lfHeight field,
it is not related in any way to the OS/2::usWidthClass (unlike
LOGFONT::lfWeight, which mirrors the OS/2::usWeightClass). Be sure to
canonicalize this field to 0 (default) and not use it as a style value.

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1819973003

Review URL: https://codereview.chromium.org/1819973003
This commit is contained in:
bungeman 2016-03-22 10:59:09 -07:00 committed by Commit bot
parent d053ce9c54
commit 59f093d5d8

View File

@ -120,6 +120,7 @@ static void dcfontname_to_skstring(HDC deviceContext, const LOGFONT& lf, SkStrin
static void make_canonical(LOGFONT* lf) {
lf->lfHeight = -64;
lf->lfWidth = 0; // lfWidth is related to lfHeight, not to the OS/2::usWidthClass.
lf->lfQuality = CLEARTYPE_QUALITY;//PROOF_QUALITY;
lf->lfCharSet = DEFAULT_CHARSET;
// lf->lfClipPrecision = 64;
@ -127,7 +128,7 @@ static void make_canonical(LOGFONT* lf) {
static SkFontStyle get_style(const LOGFONT& lf) {
return SkFontStyle(lf.lfWeight,
lf.lfWidth,
SkFontStyle::kNormal_Width,
lf.lfItalic ? SkFontStyle::kItalic_Slant : SkFontStyle::kUpright_Slant);
}