From: Heime <heimeborgia@protonmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Changing font weight with buffer-face-mode-invoke
Date: Wed, 26 Jun 2024 19:32:35 +0000 [thread overview]
Message-ID: <lT8sTU8gF3ALqtFDb5I79GdO-c_CGms1rbZQ2BUrb7s8dDT_RwVTfuqTpfm8DIdi49iIHbxYqlfJqobb_kcvZWuJ8V17TFMLiM1xFf-TQ_E=@protonmail.com> (raw)
In-Reply-To: <86r0cj7dmh.fsf@gnu.org>
On Wednesday, June 26th, 2024 at 6:39 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Wed, 26 Jun 2024 17:08:40 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> >
> > > Use standard weights: regular, medium, bold. Some font families have
> > > also additional weights: light, semi-light, semi-bold, extra-bold.
> > > The full list of weight values is in the ELisp manual, in the node
> > > "Face Attributes".
> >
> > Some faces, e.g. "URW Chancery L" have "Medium Italic" and "Bold Italic".
> > And not all faces have the weights declared in the list. Could there be
> > an elisp function that returns a list of the available weights and styles
> > for each entry in the list of font families ?
>
>
> I think you want list-fonts. See the node "Low-Level Font" in the
> ELisp manual, it describes this stuff.
Have done the following tools. But am getting
Debugger entered--Lisp error: (wrong-type-argument stringp #<font-entity ftcrhb urw URW\ Chancery\ L nil iso10646-1 medium italic normal 0 nil nil 0 ((:font-entity "/usr/share/fonts/X11/Type1/z003034l.pfb" . 0))>)
string-match("-" #<font-entity ftcrhb urw URW\ Chancery\ L nil iso10646-1 medium italic normal 0 nil nil 0 ((:font-entity "/usr/share/fonts/X11/Type1/z003034l.pfb" . 0))> 0)
split-string(#<f
(defun mon-font-info (font)
"Get font attributes for FONT."
(let ((attrs (split-string font "-")))
(vector (nth 1 attrs) ; Weight
(nth 2 attrs) ; Slant
(nth 3 attrs)))) ; Width
(defun mon-list-font-family (font-family)
"List all fonts for the specified FONT-FAMILY."
(interactive
(list
(completing-read "Family: " (font-family-list) nil t)))
(let ( (font-spec (font-spec :family font-family))
(fonts (list-fonts (font-spec :family font-family))) )
(if fonts
(progn
(switch-to-buffer "*Font List*")
(erase-buffer)
(insert (format "Fonts for family: %s\n\n" font-family))
(dolist (font fonts)
(let* ( (font-info (mon-font-info font))
(weight (aref font-info 1))
(slant (aref font-info 2))
(width (aref font-info 3)) )
(insert (format
"Weight: %-10s Slant: %-10s Width: %-10s Full: %s\n"
weight slant width font))))
(goto-char (point-min)))
(message "No fonts found for family: %s" font-family))))
next prev parent reply other threads:[~2024-06-26 19:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 21:58 Changing font weight with buffer-face-mode-invoke Heime
2024-06-26 12:55 ` Eli Zaretskii
2024-06-26 17:08 ` Heime
2024-06-26 18:39 ` Eli Zaretskii
2024-06-26 19:32 ` Heime [this message]
2024-06-27 4:56 ` Eli Zaretskii
2024-06-26 20:54 ` Heime
2024-06-27 5:23 ` Eli Zaretskii
2024-06-27 8:48 ` Heime
2024-06-27 9:30 ` Yuri Khan
2024-06-27 10:24 ` Eli Zaretskii
2024-06-27 10:59 ` Heime
2024-06-27 12:31 ` Eli Zaretskii
2024-06-27 16:49 ` Heime
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='lT8sTU8gF3ALqtFDb5I79GdO-c_CGms1rbZQ2BUrb7s8dDT_RwVTfuqTpfm8DIdi49iIHbxYqlfJqobb_kcvZWuJ8V17TFMLiM1xFf-TQ_E=@protonmail.com' \
--to=heimeborgia@protonmail.com \
--cc=eliz@gnu.org \
--cc=help-gnu-emacs@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.
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).