unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Nix <nix@esperi.org.uk>, Alexis <flexibeast@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: RE: Ping! Re: `font-spec` unable to retrieve :name of font
Date: Sat, 24 Oct 2015 11:04:42 -0700 (PDT)	[thread overview]
Message-ID: <e828cce3-5bac-4ac5-9b52-981faeb8792a@default> (raw)
In-Reply-To: <87611wcg97.fsf@esperi.org.uk>

> after all, the XLFD variant is never going to be displayed to the user,
> nor passed to Fontconfig: it's just an internal thing for parts of
> Emacs expecting XLFDs.

Just a comment on this part of what you wrote.

XLFD format _is_ visible to users.  And it can be used by them.

I use it, for example, to transform a font to another of a
different size, resulting also in a frame of a different size.
This use case is quite important to my use of Emacs, FWIW.

----

(defun frcmds-enlarged-font-name (fontname frame increment)
  "FONTNAME, after enlarging font size of FRAME by INCREMENT.
FONTNAME is the font of FRAME."
  (when (query-fontset fontname)
    (let ((ascii  (assq 'ascii (aref (fontset-info fontname frame) 2))))
      (when ascii (setq fontname  (nth 2 ascii)))))
  (let ((xlfd-fields  (x-decompose-font-name fontname)))
    (unless xlfd-fields (error "Cannot decompose font name"))
    (let ((new-size  (+ (string-to-number
                          (aref xlfd-fields
                                xlfd-regexp-pixelsize-subnum))
                        increment)))
      (unless (> new-size 0) (signal 'font-too-small (list new-size)))
      (aset xlfd-fields xlfd-regexp-pixelsize-subnum
            (number-to-string new-size)))
    ;; Set point size & width to "*", so frame width will adjust to
    ;; new font size
    (aset xlfd-fields xlfd-regexp-pointsize-subnum "*")
    (aset xlfd-fields xlfd-regexp-avgwidth-subnum "*")
    (x-compose-font-name xlfd-fields)))



  parent reply	other threads:[~2015-10-24 18:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13  2:13 `font-spec` unable to retrieve :name of font Alexis
2015-10-22  8:48 ` Ping! " Alexis
2015-10-22 14:59   ` Eli Zaretskii
2015-10-23  9:55     ` Alexis
2015-10-24 17:45       ` Nix
2015-10-24 17:57         ` Eli Zaretskii
2015-10-24 18:04         ` Drew Adams [this message]
2015-10-26 14:10           ` Nix
2015-10-27  2:32             ` Stephen J. Turnbull

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=e828cce3-5bac-4ac5-9b52-981faeb8792a@default \
    --to=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=flexibeast@gmail.com \
    --cc=nix@esperi.org.uk \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).