emacs-devel
[Top][All Lists]
Advanced

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

Re: Accessing rendered image data


From: Lars Magne Ingebrigtsen
Subject: Re: Accessing rendered image data
Date: Tue, 28 Jun 2016 20:29:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> And you should trust me that I don't like wasting my time on digging
> into problems whose purpose I don't fully understand ;-)

As I said earlier in this thread, I wanted to figure out how much space
text rendered in an SVG takes.  Since Emacs doesn't expose this data
back to Elisp land, I hit upon the idea of rendering the text in a
buffer instead (with the same fonts that would have been used in the
SVG).

This will give me approximate sizes that'll be good enough.

> How should I know?  This stuff is not documented at all, so you are
> asking me to step in a debugger through gobs of unfamiliar and
> complicated code, without ever understanding what is it that I'm
> trying to accomplish.  That's not in my job description.
>
> If you want my help, try telling more.

It is documented in

(info "(lisp)Low-Level Font")

In particular:

 -- Function: font-spec &rest arguments
     Return a new font spec using the specifications in ARGUMENTS,
     which should come in `property'-`value' pairs.  The possible
     specifications are as follows:

    `:name'
          The font name (a string), in either XLFD, Fontconfig, or GTK
          format.  *Note Fonts: (emacs)Fonts.

[...]

    `:size'
          The font size--either a non-negative integer that specifies
          the pixel size, or a floating-point number that specifies the
          point size.


An XLFD would look like "futura:size=40".

(insert (propertize "FOO" 'face (list :font (find-font (font-spec :name 
"futura:size=40")))))

Does not work.  Either this is a bug, or there are missing bits in the
manual that says what find-font and/or 'face wants here.  Or there's
something else I'm missing.

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