[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Variable-width font indentation
From: |
Clément Pit-Claudel |
Subject: |
Re: Variable-width font indentation |
Date: |
Mon, 5 Mar 2018 15:28:05 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 2018-03-05 14:58, Eli Zaretskii wrote:
> How does it know that today, when we only support well the
> fixed-pitch fonts? Or are you talking about a different problem?
A different problem, IIUC. The problem is the following:
Assume you wrote the following C code, then changed to variable-pitch:
void pr () {
printf ("hello, world\n");
}
int main (int argc,
char** argv) {
pr ();
return 0;
}
Depending on which font you use (and the width of a space in that font), the
`char** argv' part will move right or left, instead of remaining aligned. The
usual solution is to proceed as Paul suggested:
> It assumes the input is fixed-width, and that leading white space is
> intended to indent with respect to previous lines.
IOW, you scale the spaces preceding `char** argv' to make the `c' of `char'
line up with the `i' of int.
Applying this strategy to all lines doesn't work, unfortunately: it indents the
`pr ()' and `printf (' lines differently, because the `in' of `int main' and
the `vo' of `void' occupy different widths.
I don't know of a good solution to this problem: in general, there's not enough
information to distinguish 'indentation' spaces (the two spaces before `printf
(', `pr ()', and `return 0') and 'line-up' spaces (the spaces before `char ()').
I hope I'm missing something.
Clément.
- Re: What improvements would be truly useful?, (continued)
- Re: Variable-width font indentation (was: What improvements would be truly useful?), Eli Zaretskii, 2018/03/05
- Re: Variable-width font indentation (was: What improvements would be truly useful?), dancol, 2018/03/05
- Re: Variable-width font indentation, Paul Eggert, 2018/03/05
- Re: Variable-width font indentation, Dmitry Gutov, 2018/03/06
- Re: Variable-width font indentation, Clément Pit-Claudel, 2018/03/06
- Re: Variable-width font indentation, Eli Zaretskii, 2018/03/06
- Re: Variable-width font indentation (was: What improvements would be truly useful?), Eli Zaretskii, 2018/03/05
- Re: Variable-width font indentation,
Clément Pit-Claudel <=
- Re: Variable-width font indentation, Paul Eggert, 2018/03/05
- Re: Variable-width font indentation, Daniel Colascione, 2018/03/05
- Re: Variable-width font indentation, Clément Pit-Claudel, 2018/03/05
- Re: Variable-width font indentation, Paul Eggert, 2018/03/05
- Re: Variable-width font indentation, Clément Pit-Claudel, 2018/03/05
- Re: Variable-width font indentation, Paul Eggert, 2018/03/05
- Re: Variable-width font indentation, Clément Pit-Claudel, 2018/03/05
- Re: Variable-width font indentation, Eli Zaretskii, 2018/03/06
- Re: Variable-width font indentation, Clément Pit-Claudel, 2018/03/06
- Re: Variable-width font indentation, Daniel Colascione, 2018/03/06