gppi (sesskey, "FontIsBold", 0, &cfg->fontisbold);
gppi (sesskey, "FontCharSet", ANSI_CHARSET, &cfg->fontcharset);
gppi (sesskey, "FontHeight", 10, &cfg->fontheight);
+ if (cfg->fontheight < 0) {
+ int oldh, newh;
+ HDC hdc = GetDC(NULL);
+ int logpix = GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(NULL, hdc);
+
+ oldh = -cfg->fontheight;
+ newh = MulDiv(oldh, 72, logpix) + 1;
+ if (MulDiv(newh, logpix, 72) > oldh)
+ newh--;
+ cfg->fontheight = newh;
+ }
gppi (sesskey, "FontVTMode", VT_OEMANSI, (int *)&cfg->vtmode);
gppi (sesskey, "TryPalette", 0, &cfg->try_palette);
gppi (sesskey, "BoldAsColour", 1, &cfg->bold_colour);
if (cfg.fontheight == 0)
strcat (buf, "default height");
else
- sprintf (buf+strlen(buf), "%d-%s",
- (cfg.fontheight < 0 ? -cfg.fontheight : cfg.fontheight),
- (cfg.fontheight < 0 ? "pixel" : "point"));
+ sprintf (buf+strlen(buf), "%d-point",
+ (cfg.fontheight < 0 ? -cfg.fontheight : cfg.fontheight));
}
static void init_dlg_ctrls(HWND hwnd) {
cfg.font[sizeof(cfg.font)-1] = '\0';
cfg.fontisbold = (lf.lfWeight == FW_BOLD);
cfg.fontcharset = lf.lfCharSet;
- cfg.fontheight = lf.lfHeight;
+ cfg.fontheight = cf.iPointSize / 10;
fmtfont (fontstatic);
SetDlgItemText (hwnd, IDC_FONTSTATIC, fontstatic);
}
hdc = GetDC(hwnd);
font_height = cfg.fontheight;
+ if (font_height > 0) {
+ font_height = -MulDiv(font_height, GetDeviceCaps(hdc, LOGPIXELSY), 72);
+ }
font_width = pick_width;
#define f(i,c,w,u) \