[Top][All Lists]

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

Re: HTML-Info design

From: Eli Zaretskii
Subject: Re: HTML-Info design
Date: Mon, 29 Dec 2014 19:44:35 +0200

> From: Lars Ingebrigtsen <address@hidden>
> Cc: address@hidden
> Date: Mon, 29 Dec 2014 17:32:52 +0100
> Eli Zaretskii <address@hidden> writes:
> > Fortunately, such a capability already exists, I think: see the
> > function 'font-get-glyphs'.  Does it solve your problem?  If not, what
> > API would you like to have?
> I've just looked at the doc string of that function briefly, and I'm not
> sure how I would use that to do filling.  I need to know the width a
> text will take in the buffer, so that I know when to break the line and
> start a new one.  Is it now possible to write a function like
> `pixel-region-width' that would say how much space the text will occupy?

Either make a string of the text you want to display, or insert that
text in a temporary buffer, then use this function to find the width
of that text by summing the widths of all the glyphs.  Find the
largest substring whose glyphs' summary width fits into the portion of
the window width you allotted to the left pane, and insert that
substring.  Loop around.

Should work, no?

> Given that the font used for that text is variable-width (and the region
> possibly uses many fonts).

The function returns a vector of glyphs, where each glyph is described
using its attributes, including its pixel width.

You have font-at function to tell you which font is used to display
what buffer/string position.


reply via email to

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