From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Protesilaos Stavrou Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] Add new 'show-font' package? Date: Fri, 06 Sep 2024 16:40:09 +0300 Message-ID: <87ed5w7veu.fsf@protesilaos.com> References: <87msknu635.fsf@protesilaos.com> <87jzfqjtdh.fsf@posteo.net> <867cbq4cun.fsf@gnu.org> <87zfol4a5t.fsf@protesilaos.com> <86ttet1fbe.fsf@gnu.org> <874j6tgv0w.fsf@protesilaos.com> <86plph1cc1.fsf@gnu.org> <87r09xfdoa.fsf@protesilaos.com> <86le0512kq.fsf@gnu.org> <87plph6o9z.fsf@protesilaos.com> <86ed5x104o.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30240"; mail-complaints-to="usenet@ciao.gmane.io" Cc: philipk@posteo.net, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 06 15:41:11 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1smZD5-0007ga-GO for ged-emacs-devel@m.gmane-mx.org; Fri, 06 Sep 2024 15:41:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smZCM-0002TQ-IG; Fri, 06 Sep 2024 09:40:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smZCG-0002TA-Fs for emacs-devel@gnu.org; Fri, 06 Sep 2024 09:40:21 -0400 Original-Received: from relay6-d.mail.gandi.net ([2001:4b98:dc4:8::226]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smZCD-0001M9-Tz; Fri, 06 Sep 2024 09:40:20 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 9EC81C0006; Fri, 6 Sep 2024 13:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protesilaos.com; s=gm1; t=1725630012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8SpNQCrx8EGzTB7cfe9osao6OAQhht+9/g8zz7EBjgo=; b=JDlwsv7xGVgcKc/FxIyLLTLT8b+wM+uadVHFSs+Oki5/sT4jlemeCZogAwvZjkOvnUiGf8 fvXdFNDZChPMp4hKn0nMTJFWgwd5XHOcR1KvWX+oFLeE1JFiUWt/gFQ4/5rfL23noJt3q/ i0/bBFhDTpdcfZETALvoP3+Fq/tObnE9y2qrXcNONBjc6dzHiScOfPosYqVurBmGf4S2ZB 49Lwcth1i2GiSDsc+HEfk/dzfXx8PlwieAZS/Lb27TD3SFuP0RKw8ibOWSlQ0+vNdSGMpo xJmtAI88IZxef+Svh4gGwijpHhWGwO4YBv/wHXxQePyLNtt3A97v/Rm+YWi4zQ== In-Reply-To: <86ed5x104o.fsf@gnu.org> X-GND-Sasl: info@protesilaos.com Received-SPF: pass client-ip=2001:4b98:dc4:8::226; envelope-from=info@protesilaos.com; helo=relay6-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323473 Archived-At: > From: Eli Zaretskii > Date: Fri, 6 Sep 2024 14:40:07 +0300 > [... 14 lines elided] >> 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. The "something else" is why I am relying on 'fc-list' and 'fc-scan'. I am keeping this dependency for the time being and will let users of other platforms tell me what the equivalent programs are on their system. >> 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. I see, thank you! I will keep using external programs then. >> > 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. These are for installed fonts that we find with 'x-family-fonts'. I followed your suggestion and have now built on top of that function. Indeed, it is hard to preview a font that is not installed on the system. For those cases, we show the relevant warning and then provide the means to install that file by copying to the OS-dependent path (I implemented this earlier). * * * @Philip I made lots of changes since our last exchange earlier today. I think the package is ready for the release of version 0.1.0. I just need to write a manual for it. Is there anything else left before I push to elpa.git (I completely rewrote the file handler and there is no external code now)? -- Protesilaos Stavrou https://protesilaos.com