all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Protesilaos Stavrou <info@protesilaos.com>
Cc: philipk@posteo.net, emacs-devel@gnu.org
Subject: Re: [ELPA] Add new 'show-font' package?
Date: Fri, 06 Sep 2024 14:40:07 +0300	[thread overview]
Message-ID: <86ed5x104o.fsf@gnu.org> (raw)
In-Reply-To: <87plph6o9z.fsf@protesilaos.com> (message from Protesilaos Stavrou on Fri, 06 Sep 2024 13:59:36 +0300)

> From: Protesilaos Stavrou <info@protesilaos.com>
> Cc: philipk@posteo.net, emacs-devel@gnu.org
> Date: Fri, 06 Sep 2024 13:59:36 +0300
> 
> >> Imagine the user has just downloaded a font in "~/Downloads" and tries
> >> to visit it.
> >
> > That is only relevant to fonts that are not yet installed, which is a
> > separate use case, and IMO needs a different handling and perhaps also
> > different UI.  For now, AFAIU you are working on fonts that are
> > already installed, and for those most users will not know the file
> > names (nor will care about them).
> 
> This is not intended for fonts that are already installed on the system.
> It is for users who download a font from some website and then store it
> locally. We then want a major mode to preview the font instead of
> showing unreadable characters.

This seems to be in contradiction to what you said originally: that
you first want to handle installed fonts.  A font that is not yet
installed will not appear in x-family-fonts, so you need something
else entirely.

> If there is a function that can read FILE and infer the font name (or
> names) from it, then we can check if the font[s] are available and
> preview them accordingly. Else print a message that the fonts are not
> available on the system.

Emacs doesn't access font files directly, it uses system facilities
for that.  So the answer to your question is NO, not using Emacs APIs
related to fonts.

> > This concept surprises me, since the tools and commands which I've seen
> > that allow users to preview a font show the list of installed fonts,
> > and then allow selecting a font from that list.  In which case the
> > font's file name is not very relevant.  Moreover, some font files can
> > have several different font families, in which case a file name will
> > not unequivocally determine the font.
> 
>  I already have all the code ready in my local repository. There are two
> commands to work with installed fonts (per 'x-family-fonts'):
> 
> - show-font-select-preview :: Use minibuffer completion to select a
>   font family and then display a buffer rendered in that family.
> 
> - show-font-list :: Produce a buffer that has a short preview of each
>   installed font, accompanied by the name of the font.
> 
> Now all I am missing is the case with the file that I noted above. Then
> the prototype is feature complete and I can work on further refinements.

If you are now talking only about uninstalled fonts, the way to handle
them in Emacs will be quite complicated, I think, and will be
highly-dependent on the font back-end.  I'm not even sure this is
possible on all supported system (e.g., I don't know how to do that on
MS-Windows, I think it's impossible there).  You may need to tell
users to install a font temporarily for previewing it.



  reply	other threads:[~2024-09-06 11:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04  9:21 [ELPA] Add new 'show-font' package? Protesilaos Stavrou
2024-09-05 10:18 ` Philip Kaludercic
2024-09-05 10:24   ` Eli Zaretskii
2024-09-06  5:35     ` Protesilaos Stavrou
2024-09-06  6:12       ` Eli Zaretskii
2024-09-06  6:23         ` Protesilaos Stavrou
2024-09-06  7:16           ` Eli Zaretskii
2024-09-06  7:23             ` Protesilaos Stavrou
2024-09-06 10:47               ` Eli Zaretskii
2024-09-06 10:59                 ` Protesilaos Stavrou
2024-09-06 11:40                   ` Eli Zaretskii [this message]
2024-09-06 13:40                     ` Protesilaos Stavrou
2024-09-06 13:56                       ` Eli Zaretskii
2024-09-06  5:43   ` Protesilaos Stavrou
2024-09-06  6:15     ` Eli Zaretskii
2024-09-06  6:29       ` Protesilaos Stavrou
2024-09-06  7:17         ` Eli Zaretskii
2024-09-06  6:33     ` Philip Kaludercic
2024-09-06  6:45       ` Protesilaos Stavrou
2024-09-06  7:20         ` Eli Zaretskii
2024-09-06  7:31           ` Philip Kaludercic

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

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

  git send-email \
    --in-reply-to=86ed5x104o.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=info@protesilaos.com \
    --cc=philipk@posteo.net \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.