From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Accessing rendered image data Date: Tue, 28 Jun 2016 21:48:07 +0300 Message-ID: <83h9cdw3o8.fsf@gnu.org> References: <83r3bhw7km.fsf@gnu.org> <83mvm5w5fi.fsf@gnu.org> <83k2h9w4wn.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1467139760 23266 80.91.229.3 (28 Jun 2016 18:49:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Jun 2016 18:49:20 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lars Magne Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 28 20:49:10 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bHy4H-0000da-I1 for ged-emacs-devel@m.gmane.org; Tue, 28 Jun 2016 20:49:05 +0200 Original-Received: from localhost ([::1]:38847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHy4G-0005xC-I0 for ged-emacs-devel@m.gmane.org; Tue, 28 Jun 2016 14:49:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHy44-0005nk-Cl for emacs-devel@gnu.org; Tue, 28 Jun 2016 14:48:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHy3z-0000jM-1Y for emacs-devel@gnu.org; Tue, 28 Jun 2016 14:48:52 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHy3y-0000hy-VO; Tue, 28 Jun 2016 14:48:46 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4519 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bHy3v-0007fC-24; Tue, 28 Jun 2016 14:48:45 -0400 In-reply-to: (message from Lars Magne Ingebrigtsen on Tue, 28 Jun 2016 20:29:58 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204889 Archived-At: > From: Lars Magne Ingebrigtsen > Cc: emacs-devel@gnu.org > Date: Tue, 28 Jun 2016 20:29:58 +0200 > > Eli Zaretskii 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?