From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)) Date: Sat, 23 May 2020 12:36:56 +0000 Message-ID: References: <20200517165953.000044d2@web.de> <83lflqblp0.fsf@gnu.org> <83ftbybio3.fsf@gnu.org> <83zha69xs2.fsf@gnu.org> <83367x9qeq.fsf@gnu.org> <0ccae2a4-533b-d15c-2884-c2f00b067776@gmail.com> <83wo5987mk.fsf@gnu.org> <99d4beed-88ae-b5cd-3ecb-a44325c8a1dc@gmail.com> <20200518215908.GA57594@breton.holly.idiocy.org> <83mu6481v3.fsf@gnu.org> <75a90563-51b4-d3b8-4832-fc0e2542af0d@gmail.com> <83blmi7hys.fsf@gnu.org> <837dx55qff.fsf@gnu.org> <834ks95cmz.fsf@gnu.org> <4faa291f-f2df-36d1-73d5-332b93a9b6d8@gmail.com> <83wo544hx5.fsf@gnu.org> <831rnc43ih.fsf@gnu.org> <83ftbs2jr5.fsf@gnu.org> <83lflj16jn.fsf@gnu.org> <83eerb145r.fsf@gnu.org> <831rnb0zld.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="18028"; mail-complaints-to="usenet@ciao.gmane.io" Cc: cpitclaudel@gmail.com, alan@idiocy.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 23 14:38:07 2020 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 1jcTPj-0004cJ-4b for ged-emacs-devel@m.gmane-mx.org; Sat, 23 May 2020 14:38:07 +0200 Original-Received: from localhost ([::1]:56872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcTPi-000654-3T for ged-emacs-devel@m.gmane-mx.org; Sat, 23 May 2020 08:38:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcTPE-0005fT-95 for emacs-devel@gnu.org; Sat, 23 May 2020 08:37:36 -0400 Original-Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]:34050) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jcTPD-0006sA-FD; Sat, 23 May 2020 08:37:36 -0400 Original-Received: by mail-ot1-x333.google.com with SMTP id b18so10386420oti.1; Sat, 23 May 2020 05:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JYhkSrdeFDQsCovObUbP00wz+sUD613CLvgtJaCfNso=; b=tAo4tCbcxon16n884+/GEttG6QboS3VuIXIpkdAkiPu3hUCWM0tdIQzU/yvZLynNZ2 n02ld+Lckq+AC9pKytvobY30A7YDWsBL4xf0nMdxWsp13dPfKOXxfLjDbZ7NstPxm0By 6C2Z4nTAx32t+YCYSR+Q6hXenspHjo0LLkg5cG7BXS/s2H5nvx7kaonDq8/MglCvn1h6 RloYzvFC1kmd/YKmNnLu2+KegDKneL/XNv/u8Xm9dLZdVBPN+oBt9xlXLFRVLA+f8YAg cJMuK4y/hnJHj7M5gnlWjV0Ms5Zo3w/vBESBdEPheqPvHjRi5t4L7B89kMNtKo3hgxzs XFGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JYhkSrdeFDQsCovObUbP00wz+sUD613CLvgtJaCfNso=; b=jjjP/6yae0XC6HYwxodVArQA5ZqgD9/xXB8MtkfuSMPB2dEVqLT0azZBJuYla7mm+1 lbVs2zMHINwA0QqmuJh8+cCAp7IOXI36Kst4CuxA2ZEYmNdFnLOIRad415UvMtGPvN8I 5ja8gwE6ay6hPous/mCk2bTZMKIKz05eJ3CChv6DKiJrUqcz1UGksnnJy54nmIROIJXB xcJ1rEA5WiKu6VqdVO/iTyyMGE20lg5R90ny/JfVLgb3AaXcnDIdNQBpUAtDLnICCjzU PXiXXbqBimKtPcoXFCxJy06pl4XaCmvpYC0hXDlZTgt2Z6FsAWuUWEOWijPJrM/qppNF ZBwA== X-Gm-Message-State: AOAM532I8gntYUSB4s0jDghkAPPcDeu/s9SjUV1bE6OWp35amMXAlD4N S7fdwxIJQPTr8BNI7T3OaZHWovRpgtL2yajeo6myiD9C X-Google-Smtp-Source: ABdhPJwuSJgC5Fb3f3186GDQtso7roh412bYTbG5AcWHSMhq/TxKT8rAK+3pEylDkcaEWFRCKBPtDcLqORxda1zYq0k= X-Received: by 2002:a05:6830:61b:: with SMTP id w27mr12052886oti.154.1590237453044; Sat, 23 May 2020 05:37:33 -0700 (PDT) In-Reply-To: <831rnb0zld.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=pipcet@gmail.com; helo=mail-ot1-x333.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 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, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251267 Archived-At: On Sat, May 23, 2020 at 9:28 AM Eli Zaretskii wrote: > > From: Pip Cet > > Date: Sat, 23 May 2020 08:44:22 +0000 > > Cc: cpitclaudel@gmail.com, alan@idiocy.org, emacs-devel@gnu.org > > > > You write: "(b) is not really feasible without redesigning the entire > > Emacs display engine". I don't see how that's true at all. All we need > > is some limited look-ahead. > > We already have look-ahead: that's what the regexp part of the > composition rules are about. That is not the crucial problem. But it's the only problem I see! When you see an IT_CHARACTER, you get some context, hand it to HarfBuzz, slice up the relevant glyphs, and display them. This is not complicated or difficult, except for the "get some context" part. It doesn't involve composite.c at all, and that's good, because for those tricky special cases composite.c does a better job than standard shaping, and we need to keep that feature. It just shouldn't be the regular route. > The crucial problem is that we currently perform layout decisions one > grapheme cluster at a time, whereas what HarfBuzz people say is that > we should basically do that one screen line at a time. I think we're going to have to compromise: that's why my patch used a 32-character context rather than an entire line or just a single character. Ideally, of course, in most real cases we'd use whitespace-delimited words as chunks. That's mere optimization, though. > A secondary (but important) problem is that character composition > involves calls to Lisp, which is relatively slow. This precludes > calling the shaper for too many characters at once, too many times for > each redisplay cycle of a window. I agree we shouldn't go through Lisp. My patch didn't. Calling the shaper less often is an important optimization, too. For whitespace-delimited words, we only need to call it once. > > I think at the heart of it, it's about whether we treat fonts like > > pieces of software, to be given a specific task and fixed if they fail > > to perform it, or as bitmaps for simulating a TTY. Fonts are software: > > they're written in a weird limited language, but essentially they're > > programs to measure and display characters as glyphs. > > I don't think there's any disagreements on this high and abstract > level. I think there are: if we treat fonts as programs, we need to let them do their job, which involves kerning, substitutions, ligatures, and even crazy stuff like randomizing the glyph used for each character to get a more hand-written appearance. We don't need to know about ligatures, we just let the font do it. No Lisp callbacks, just a call to harfbuzz. > The problem is how to support that within the limits of the > current design of the display engine.