emacs-devel
[Top][All Lists]
Advanced

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

Re: Accessing rendered image data


From: Eli Zaretskii
Subject: Re: Accessing rendered image data
Date: Tue, 28 Jun 2016 21:48:07 +0300

> From: Lars Magne Ingebrigtsen <address@hidden>
> Cc: address@hidden
> Date: Tue, 28 Jun 2016 20:29:58 +0200
> 
> 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).

How do you know which fonts are used by SVG?  They use similar font
selection machinery as Emacs with similar fallbacks.  The font that is
stated in the SVG file will not necessarily be used.

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

I already know about that.  This all works, and you have also shown an
example that tells it worked for you.

> (insert (propertize "FOO" 'face (list :font (find-font (font-spec :name 
> "futura:size=40")))))
> 
> Does not work.

It does work, sort of.  Try describe-text-properties on :FOO, and see
for yourself.

What if you use just :font "font-name-as-a-string", does that do what
you want?



reply via email to

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