emacs-devel
[Top][All Lists]
Advanced

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

Re: [ELPA] Add new 'show-font' package?


From: Protesilaos Stavrou
Subject: Re: [ELPA] Add new 'show-font' package?
Date: Fri, 06 Sep 2024 13:59:36 +0300

> From: Eli Zaretskii <eliz@gnu.org>
> Date: Fri,  6 Sep 2024 13:47:17 +0300
>
>> From: Protesilaos Stavrou <info@protesilaos.com>
>> Cc: philipk@posteo.net, emacs-devel@gnu.org
>> Date: Fri, 06 Sep 2024 10:23:49 +0300
>> 
>> > From: Eli Zaretskii <eliz@gnu.org>
>> > Date: Fri,  6 Sep 2024 10:16:30 +0300
>> 
>> > [... 11 lines elided]
>> 
>> >> All I need is to figure out how to get/guess the name of a font
>> >> based on the file name (ideally without depending on an external program
>> >> that may not be installed on the user's end).
>> >
>> > Why do you need that?  IME, users don't care about file names of the
>> > fonts.
>> 
>> 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.

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.

>> The idea is to get the font family out of this file and check if it
>> exists on the system. If it exists, then we perform the preview of
>> the font, otherwise we inform the user that the font called FONT is
>> not installed (and then suggest to install it, but I will do that
>> later).
>
> 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.

-- 
Protesilaos Stavrou
https://protesilaos.com



reply via email to

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