emacs-devel
[Top][All Lists]
Advanced

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

Re: HTML-Info design


From: Lars Ingebrigtsen
Subject: Re: HTML-Info design
Date: Sun, 25 Jan 2015 11:01:43 +1100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> 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.

I haven't played much with fonts before, so I'm afraid I don't know how
to do this.  I've played around with buffer-setting font code for half
an hour, and I'm still not able to get to a font object from text in a
buffer.

So, starting with (say)

(with-temp-buffer
  (buffer-face-set '(:family "Symbola" :height 150 :width semi-condensed))
  (insert "This is a text"))

how do I get the font object for each character there so that I can feed
it to `font-get-glyphs'?

`buffer-face-set' is probably the wrong thing here, though, since we
would have many fonts in a buffer, but it's a start, perhaps...

-- 
(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]