emacs-devel
[Top][All Lists]
Advanced

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

RE: Ping! Re: `font-spec` unable to retrieve :name of font


From: Drew Adams
Subject: RE: Ping! Re: `font-spec` unable to retrieve :name of font
Date: Sat, 24 Oct 2015 11:04:42 -0700 (PDT)

> 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)))



reply via email to

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