From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: When and how to register various font backends Date: Fri, 07 Jun 2019 22:40:45 +0300 Message-ID: <83tvd1p4jm.fsf@gnu.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="168640"; mail-complaints-to="usenet@blaine.gmane.org" Cc: YAMAMOTO Mitsuharu To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 07 22:04:02 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hZL5m-000gq7-Kt for ged-emacs-devel@m.gmane.org; Fri, 07 Jun 2019 22:04:02 +0200 Original-Received: from localhost ([::1]:52324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZKqa-0002M7-Md for ged-emacs-devel@m.gmane.org; Fri, 07 Jun 2019 15:48:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42509) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZKjR-0006e3-Af for emacs-devel@gnu.org; Fri, 07 Jun 2019 15:40:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:54463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hZKjQ-0007kg-Fl; Fri, 07 Jun 2019 15:40:56 -0400 Original-Received: from [176.228.60.248] (port=2584 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hZKjP-0005zl-8Y; Fri, 07 Jun 2019 15:40:56 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:237311 Archived-At: With HarfBuzz now available on master, we basically have 3 font backends on almost every supported platform: the basic backend (Xfont on Posix systems, GDI on Windows), a backend capable of shaping complex scripts (ftfont/xftfont with FLT on X, Uniscribe on Windows), and HarfBuzz. Having too many active font backends is not a good idea, because when there's no fonts on your system that can display some character, Emacs tries to find a font with each of the active backends, so having 3 backends instead of 2 will make such failed searches significantly longer (approximately by 50%). Since HarfBuzz can do everything FLT can do, and more, I think it makes sense to register HarfBuzz in preference to FLT backends when both are available. That is, by default each frame will only register the basic backend and HarfBuzz; the FLT/Uniscribe backends will only be registered if HarfBuzz is not available or if the user or the code that creates the frame explicitly requested the other backends. The question is how to implement this preference. In the code that is currently on master, you will see one way of implementing it in w32fns.c, where the Windows code creates GUI frames (look in x-create-frame). Basically, after determining whether Uniscribe was explicitly requested, this implementation registers or doesn't register Uniscribe for each new frame. This means the backends to be available to a frame must be specified at frame creation time, or be known by that time. Yamamoto-san suggested a slightly different way of implementing the same idea; I will let him explain his proposal in more detail. Each implementation produces a slightly different behavior. Since I believe we should have the same behavior on all platforms, I would like people to express their opinions on the two implementation, so that we could eventually decide with which one to go, and implement it for all platforms. Thanks.