From a823468b902592d4cee5e27ae4ef492110fbb372 Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Sat, 1 Mar 2008 23:04:20 +0000 Subject: [PATCH] (w32font_full_name): Report point size for scalable fonts. --- src/ChangeLog | 4 ++++ src/w32font.c | 31 +++++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 02d1626893c..0a087cbc85e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2008-03-01 Jason Rumney + + * w32font.c (w32font_full_name): Report point size for scalable fonts. + 2008-03-01 Kim F. Storm * dispextern.h (CHAR_GLYPH_SPACE_P): Check for default face. diff --git a/src/w32font.c b/src/w32font.c index ff0344c7912..fad3960180e 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -1553,11 +1553,20 @@ w32font_full_name (font, font_obj, pixel_size, name, nbytes) char *name; int nbytes; { - int len; + int len, height, outline; char *p; Lisp_Object antialiasing, weight = Qnil; - len = strlen (font->lfFaceName) + 21; /* :pixelsize=SIZE */ + len = strlen (font->lfFaceName); + + outline = EQ (AREF (font_obj, FONT_FOUNDRY_INDEX), Qoutline); + + /* Represent size of scalable fonts by point size. But use pixelsize for + raster fonts to indicate that they are exactly that size. */ + if (outline) + len += 11; /* -SIZE */ + else + len = strlen (font->lfFaceName) + 21; if (font->lfItalic) len += 7; /* :italic */ @@ -1579,10 +1588,20 @@ w32font_full_name (font, font_obj, pixel_size, name, nbytes) p = name; p += sprintf (p, "%s", font->lfFaceName); - if (font->lfHeight) - p += sprintf (p, ":pixelsize=%d", eabs (font->lfHeight)); - else if (pixel_size > 0) - p += sprintf (p, ":pixelsize=%d", pixel_size); + height = font->lfHeight ? eabs (font->lfHeight) : pixel_size; + + if (height > 0) + { + if (outline) + { + float pointsize = height * 72.0 / one_w32_display_info.resy; + /* Round to nearest half point. */ + pointsize = round (pointsize * 2) / 2; + p += sprintf (p, "-%1.1f", pointsize); + } + else + p += sprintf (p, ":pixelsize=%d", height); + } if (font->lfItalic) p += sprintf (p, ":italic"); -- 2.39.2