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: Fri, 22 May 2020 12:52:41 +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> 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="83873"; 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 Fri May 22 14:53:50 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 1jc7BO-000LiZ-0e for ged-emacs-devel@m.gmane-mx.org; Fri, 22 May 2020 14:53:50 +0200 Original-Received: from localhost ([::1]:44466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jc7BN-0004ta-3l for ged-emacs-devel@m.gmane-mx.org; Fri, 22 May 2020 08:53:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jc7Au-0004T2-SZ for emacs-devel@gnu.org; Fri, 22 May 2020 08:53:20 -0400 Original-Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]:45444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jc7Au-0008Ph-3F; Fri, 22 May 2020 08:53:20 -0400 Original-Received: by mail-ot1-x32b.google.com with SMTP id c3so8096908otr.12; Fri, 22 May 2020 05:53:19 -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=5g709onO1LC2VhfrgKDqqdsoSYTVTc2rPc9P72pD8lU=; b=p2YQhm77oEV3J3jYilvbocZ9fpHCGXcKyxCEkmXveC+ZGNwaauEGY6DEh8xRxRm8HB PDbcUkko0iOyJf0qOCots/aBNxWNDBtU/tDPvneXX7ycgXow9jJylrG3uRJZYDm/KUiM 09AQ4wadH4FsYMzYG8diYj+nBjxq2IkH5JKR/Kk+jJepMnqWxIfPBV80tOZhPz1yFo6K nNYA/0xp0rB5kqpu6G5GY3B4iHJoZ8n8/g2I89Zi1EOmQT6eEamr7ixjsNd7pid+RUOq YOqEbPtkHoEcBvl67WsueSIrNj7xnARAN/47eoshxcXa+8ZnjtUXimdnvi8r554QRr2S x7Mw== 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=5g709onO1LC2VhfrgKDqqdsoSYTVTc2rPc9P72pD8lU=; b=p1vdv6XpD5xRPsKcOOIOG4HmEN9uk0gEFf+ZtPXMV6jLba/RqsxVIseXKx3hfMf1Zr HLoZ2yiZqHTAUu0IN7BBMM+oPWq35e8G0jHQYBbwhRhg+X5O8bAoQ4ULNmZq4RUiaDtp bDBywqVvg0QsstGQG3eE+Uzr1gk5FiB9jhkQi4lLCxmCHZnhEbRXd+7mhwFNSWM+82WK CLPIVYDasC8zUWJNnlPbIQArw5Ghyc4G6oXAWPSZi/gd2MTVsoMSwh2NHND/nEZ9MK3y rgJmB7fxb7JZkQbSjbgIQWoZFc1DgL+Sde40XNYbtFF0WT4G/WIQ4ODhNY5/Rm4RotEe K8DA== X-Gm-Message-State: AOAM533X7mU1wpnF5KYUV6jZceGwjpi3rK9Vcy7yN4tsTsoAz0vH0uTg 4cPASvp5tvdKEAhQaVKLvBVihR5u3iSAh6rBUyZ3e558 X-Google-Smtp-Source: ABdhPJyTG1GviCNfFU0AaoMla8m4nUI7a/TNa7uNSUgypRKPXZzgIftVE6P8YwGzakx3/yoL+c22p1yUmpInJuxzSk8= X-Received: by 2002:a9d:7a50:: with SMTP id z16mr11511722otm.292.1590151998092; Fri, 22 May 2020 05:53:18 -0700 (PDT) In-Reply-To: <831rnc43ih.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=pipcet@gmail.com; helo=mail-ot1-x32b.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:251219 Archived-At: On Fri, May 22, 2020 at 11:23 AM Eli Zaretskii wrote: > > From: Pip Cet > > Date: Fri, 22 May 2020 09:25:31 +0000 > > Cc: cpitclaudel@gmail.com, alan@idiocy.org, emacs-devel@gnu.org > > > > > > should work, but it has weird side effects that I'm pretty sure aren't > > > > intended (paren highlighting is broken, for example). > > > > > > This is not the right way. > > > > What is the right way, then? I want all ligatures my font supports. > > You can request all the ligatures that _can_ be supported; How do I do that? Opentype fonts can support arbitrary ligatures, such as "Zapfino" being a seven-letter ligature. > those which > aren't available in the font you use will not be ligated (if you use > font-shape-gstring in the composition-function-table slot). > Or you can request only those ligatures that make sense for the > particular use case. My use case is English text, and all ligatures supported by the font make sense for that. > For example, when displaying program source code > you'd probably want the various symbols, like -> etc., to produce > ligatures, but you most probably won't want "ffi" in a variable name > to produce a ligature. Why not? > Or you can provide your own function to use in the > composition-function-table, and that function can do more complex > stuff, like refuse to ligate under some complicated conditions. If that kind of thing turns out to be necessary, we can find ways of doing it, such as setting a text property with harfbuzz feature strings to be applied when rendering. > Therefore, I think letting Lisp programs (and thus users) control what > gets composed into ligatures and what doesn't is an important feature > to have. Okay, I can accept that requirement. But it should be possible to get "all ligatures", rather than a finite set you know about in advance. > We should develop it more, because currently it lacks some > features we'd need for better ligature support (see the TODO item > about that), but I think the basic design is valid. The TODO item is confusing and, I believe, confused. "For the list of typographical ligatures, see https://en.wikipedia.org/wiki/Orthographic_ligature#Ligatures_in_Unicode_(Latin_alphabets)" That's very wrong: typographical ligatures generally aren't assigned Unicode codepoints; those that have them usually do so for historical reasons. There's no finite "the" list of typographical ligatures, it's up to each font to define glyphs covering codepoint clusters as it sees fit. I disagree with pretty much every statement in the rest of the TODO item. > At least I didn't yet see any evidence that it isn't valid; But how do I make it work? For English/Western text with ligatures that I don't know about in advance? Please treat this as a dumb end-user question. What lines of Lisp do I enter to get all the ligatures my font supports, most of which do not have individual Unicode codepoints? > > Also, even if it is the wrong thing to do, why does it break seemingly > > unrelated things? > > I don't know. Can you show how to reproduce that in the current > codebase on master? Then I'll look into it. bug#41454 > > > (set-char-table-range > > > composition-function-table '(?f . ?f) > > > (list (vector "ffi" 0 'compose-gstring-for-graphic))) > > > > > This shows how to do this only for the "ffi" ligature, but I think it > > > makes the idea clear. > > > > I'm afraid it doesn't, to me. > > Doesn't make the idea clear or doesn't produce the ligature? It doesn't make the idea clear, because I simply see no practical way we're going to know about the ligatures the font provides in advance.