emacs-devel
[Top][All Lists]
Advanced

[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: Sun, 25 Jan 2015 18:06:18 +0200

> From: Lars Ingebrigtsen <address@hidden>
> Cc: address@hidden
> Date: Sun, 25 Jan 2015 11:01:43 +1100
> 
> >> 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'?

The function 'font-at' will give you the font object you can feed to
'font-get-glyphs'.

Does this solve your problem?



reply via email to

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