all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Magne Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Accessing rendered image data
Date: Tue, 28 Jun 2016 20:29:58 +0200	[thread overview]
Message-ID: <m3r3bh88ux.fsf@gnus.org> (raw)
In-Reply-To: <83k2h9w4wn.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 28 Jun 2016 21:21:28 +0300")

Eli Zaretskii <eliz@gnu.org> 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	other threads:[~2016-06-28 18:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28 13:52 Accessing rendered image data Lars Magne Ingebrigtsen
2016-06-28 15:37 ` Lars Magne Ingebrigtsen
2016-06-28 16:36   ` Eli Zaretskii
2016-06-28 16:46     ` Lars Magne Ingebrigtsen
2016-06-28 17:23   ` Eli Zaretskii
2016-06-28 17:37     ` Lars Magne Ingebrigtsen
2016-06-28 18:10       ` Eli Zaretskii
2016-06-28 18:15         ` Lars Magne Ingebrigtsen
2016-06-28 18:21           ` Eli Zaretskii
2016-06-28 18:29             ` Lars Magne Ingebrigtsen [this message]
2016-06-28 18:48               ` Eli Zaretskii
2016-06-28 18:58                 ` Lars Magne Ingebrigtsen
2016-06-28 19:06                   ` Lars Magne Ingebrigtsen
2016-06-28 19:38                     ` Lars Magne Ingebrigtsen
2016-06-28 20:17                       ` Lars Magne Ingebrigtsen
2016-06-28 20:26                         ` Robert Weiner
2016-06-30 15:08                       ` Eli Zaretskii
2016-06-30 15:12               ` Ted Zlatanov
2016-06-30 15:38                 ` Lars Magne Ingebrigtsen
2016-06-30 16:11                   ` Ted Zlatanov
2016-06-28 18:35             ` Lars Magne Ingebrigtsen
2016-06-28 18:51               ` Eli Zaretskii
2016-06-28 16:25 ` Eli Zaretskii
2016-06-28 16:30   ` Lars Magne Ingebrigtsen
2016-06-28 17:03     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3r3bh88ux.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.