[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#880407: still occurs in xterm 352-1



Control: reopen -1
Control: found -1 352-1

On 2020-01-20 18:07:01 +0000, Sven Joachim wrote:
> Changes:
>  xterm (352-1) unstable; urgency=medium
>  .
>    * New upstream release.
>      - Adjust fontsize data to handle a minor inconsistency from recent Xft
>        versions (Closes: #880407, adapted from patch by Vincent Lefevre).

The bug still occurs with 352-1. Note that my patch was still
working with 351-1.

What has been done in fontutils.c is:

@@ -2912,6 +2921,17 @@
        ascent = font->ascent;
        descent = font->descent;
        if (height < ascent + descent) {
+           if ((ascent + descent) > (height + 1)) {
+               /* this happens less than 10% of the time */
+               --ascent;
+               --descent;
+           } else if (ascent > descent) {
+               /* this is the usual case */
+               --ascent;
+           } else {
+               /* this could happen, though rare... */
+               --descent;
+           }
            TRACE(("...increase height from %d to %d\n", height, ascent + descent));
            height = ascent + descent;
        }

I don't know why, but I needed to modify font->ascent, font->descent
and font->height too... well, at least the first two, i.e. using

		ascent = --font->ascent;

and

		descent = --font->descent;

solves the problem. Alternatively, add "font->" everywhere, and set

        ascent = font->ascent;
        descent = font->descent;
        height = ascent + descent;

only at the end.

Note: for easier readablility, I also suggest to change the test

        if (height < ascent + descent) {

to

        if ((ascent + descent) > height) {

in order to be similar to the test on the next line.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: