emacs-devel
[Top][All Lists]
Advanced

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

Re: Pixel-based display functions


From: martin rudalics
Subject: Re: Pixel-based display functions
Date: Sat, 07 Feb 2015 12:45:27 +0100

> The torture test part of the page isn't shown by default.  It's the bit
> at the end that says "Extant Carnivora species [Show]".

So IIUC you want to lay out text in cells like this

Nandiniidae   Nandinia   African palm civet (N. binotata)

              Atilax     Marsh mongoose (A. paludinosus)

              Bdeogale   Bushy-tailed mongoose (B. crassicauda) Jackson's 
mongoose (B. jacksoni)
                         Black-footed mongoose (B. nigripes)

Then we could proceed as follows:

(1) Turn on word wrap.

(2) For each cell put the text in a buffer and show the buffer in a
    window.  Arrange that the text width of the window is as wide as the
    desired with of the the cell (you can split the window or adjust its
    fringes for that).

(3) Run `window-text-pixel-size' or `vertical-motion' over it to get the
    maximum height of the text in the cell.

Proceed with the next cell in the same row.

"All" that's missing is one thing: The word wrap algorithm would have to
inform you where each visual line in step (3) ends, either by inserting
something like a CR or a text property into the buffer or by returning a
list of all buffer positions where it broke the line.  This should be
manageable with God's and Eli's help.

Using these indications you could add the necessary inter-cell
whitespaces.  Then make each cell as high as the maximum value returned
by the (3) steps in one "row" and continue with the next row.

And before I forget: We don't support different line heights with this
approach.  Actually this means that in

              Bdeogale   Bushy-tailed mongoose (B. crassicauda) Jackson's 
mongoose (B. jacksoni)
                         Black-footed mongoose (B. nigripes)

Bdeogale would have to appear on the same of either of the two lines on
the right.  Firefox can do better - it centers the line here.  I suppose
Linné wouldn't complain, though ...

martin




reply via email to

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