emacs-devel
[Top][All Lists]
Advanced

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

Variable pitch text filling


From: Lars Ingebrigtsen
Subject: Variable pitch text filling
Date: Fri, 26 Nov 2021 15:45:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

I've we're going to grow variable pitch usage, we should probably have a
little library for doing variable pitch filling.

This is already implemented in shr.el, so it's mostly just a matter of
extracting it from there -- if that's all we want.  (It just does simple
filling -- i.e., breaking the lines after a given pixel width.)

But I'm wondering to what degree (if any) we'd want to support the more
advanced (and seldom used) features from our normal filling machinery.
For instance -- justification (i.e., having straight borders on both
sides).

To do this with a variable pitch text, you'd have to first fill a line
normally, and then go over the line and distribute some space pixels
everywhere (or just on spaces in the line).  (This can (conveniently
enough) probably be done with the new `min-width' spec (if we're
distributing the extra pixels on all characters and not just the
spaces).)

But...  is that too niche?  Perhaps?  Perhaps not?  I mean, if you have
a HiDPI screen, then having a straight right margin might be cool?  (Or
left, in an r2l language.)

Our normal filling machinery also has a bunch of support for various
modes, with auto-filling and paragraphs etc, and my feeling is that this
library doesn't have to -- it'll only be used for displaying
natural-language text.  So that should simplify things quite a bit.

I.e., it might only have a single entry point and not a lot of knobs to
twiddle:

  (fill-region-to-pixel-width start end (- (window-pixel-width) 100) 'justify)

Has anybody pondered these deep and eternal questions before?  If so,
please chime in before I start typing away at this library.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




reply via email to

[Prev in Thread] Current Thread [Next in Thread]