aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xfaces.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 997f77c3507..7d142a48569 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -287,6 +287,10 @@ x_free_gc (f, gc)
287#define abs(X) ((X) < 0 ? -(X) : (X)) 287#define abs(X) ((X) < 0 ? -(X) : (X))
288#endif 288#endif
289 289
290/* Number of pt per inch (from the TeXbook). */
291
292#define PT_PER_INCH 72.27
293
290/* Non-zero if face attribute ATTR is unspecified. */ 294/* Non-zero if face attribute ATTR is unspecified. */
291 295
292#define UNSPECIFIEDP(ATTR) EQ ((ATTR), Qunspecified) 296#define UNSPECIFIEDP(ATTR) EQ ((ATTR), Qunspecified)
@@ -2105,14 +2109,13 @@ xlfd_point_size (f, font)
2105 struct font_name *font; 2109 struct font_name *font;
2106{ 2110{
2107 double resy = FRAME_X_DISPLAY_INFO (f)->resy; 2111 double resy = FRAME_X_DISPLAY_INFO (f)->resy;
2108 double font_resy = atoi (font->fields[XLFD_RESY]); 2112 double font_pixel = atoi (font->fields[XLFD_PIXEL_SIZE]);
2109 double font_pt = atoi (font->fields[XLFD_POINT_SIZE]);
2110 int real_pt; 2113 int real_pt;
2111 2114
2112 if (font_resy == 0 || font_pt == 0) 2115 if (font_pixel == 0)
2113 real_pt = 0; 2116 real_pt = 0;
2114 else 2117 else
2115 real_pt = (font_resy / resy) * font_pt + 0.5; 2118 real_pt = PT_PER_INCH * 10.0 * font_pixel / resy + 0.5;
2116 2119
2117 return real_pt; 2120 return real_pt;
2118} 2121}
@@ -2131,8 +2134,9 @@ pixel_point_size (f, pixel)
2131 double real_pt; 2134 double real_pt;
2132 int int_pt; 2135 int int_pt;
2133 2136
2134 /* As one inch is 72 points, 72/RESY gives the point size of one dot. */ 2137 /* As one inch is PT_PER_INCH points, PT_PER_INCH/RESY gives the
2135 real_pt = pixel * 72 / resy; 2138 point size of one dot. */
2139 real_pt = pixel * PT_PER_INCH / resy;
2136 int_pt = real_pt + 0.5; 2140 int_pt = real_pt + 0.5;
2137 2141
2138 return int_pt; 2142 return int_pt;
@@ -5774,12 +5778,12 @@ build_scalable_font_name (f, font, specified_pt)
5774 if (font->numeric[XLFD_RESY] != 0) 5778 if (font->numeric[XLFD_RESY] != 0)
5775 { 5779 {
5776 pt = resy / font->numeric[XLFD_RESY] * specified_pt + 0.5; 5780 pt = resy / font->numeric[XLFD_RESY] * specified_pt + 0.5;
5777 pixel_value = font->numeric[XLFD_RESY] / 720.0 * pt; 5781 pixel_value = font->numeric[XLFD_RESY] / (PT_PER_INCH * 10.0) * pt;
5778 } 5782 }
5779 else 5783 else
5780 { 5784 {
5781 pt = specified_pt; 5785 pt = specified_pt;
5782 pixel_value = resy / 720.0 * pt; 5786 pixel_value = resy / (PT_PER_INCH * 10.0) * pt;
5783 } 5787 }
5784 5788
5785 /* Set point size of the font. */ 5789 /* Set point size of the font. */