[dev] [st][PATCH] Preserve pixelsize fractions in font defaultsize.

From: Matthew Wesley <weslem_AT_google.com>
Date: Fri, 12 Jun 2015 11:34:26 -0700

The font size is actually a double and can have non-integer values when
fonts are specified in point size instead of pixel size. Update zoom
functions to preserve the fractional component in a float. Some small
precision is lost, but the zoom reset function gets very close to the
original size and the Arg union remains 32 bits wide.

Added Google to the LICENSE to the copyright list to meet our legal
requirements.
---
 LICENSE | 1 +
 st.c    | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/LICENSE b/LICENSE
index 1be82da..69ede9a 100644
--- a/LICENSE
+++ b/LICENSE
_AT_@ -11,6 +11,7 @@ MIT/X Consortium License
 © 2013 Michael Forney <mforney at mforney dot org>
 © 2013-2014 Markus Teich <markus dot teich at stusta dot mhn dot de>
 © 2014 Laslo Hunhold <dev at frign dot de>
+© 2015 Google, Inc.
 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the "Software"),
diff --git a/st.c b/st.c
index c2da66b..18d3ec9 100644
--- a/st.c
+++ b/st.c
_AT_@ -3140,14 +3140,14 @@ void
 xzoom(const Arg *arg) {
        Arg larg;
-       larg.i = usedfontsize + arg->i;
+       larg.f = usedfontsize + arg->i;
        xzoomabs(&larg);
 }
 void
 xzoomabs(const Arg *arg) {
        xunloadfonts();
-       xloadfonts(usedfont, arg->i);
+       xloadfonts(usedfont, arg->f);
        cresize(0, 0);
        redraw();
        xhints();
_AT_@ -3158,7 +3158,7 @@ xzoomreset(const Arg *arg) {
        Arg larg;
        if(defaultfontsize > 0) {
-               larg.i = defaultfontsize;
+               larg.f = defaultfontsize;
                xzoomabs(&larg);
        }
 }
--
2.2.0.rc0.207.ga3a616c
Received on Fri Jun 12 2015 - 20:34:26 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:34:10 CEST