From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)) Date: Mon, 18 May 2020 15:01:49 -0400 Message-ID: <99d4beed-88ae-b5cd-3ecb-a44325c8a1dc@gmail.com> References: <20200517124125.000013a4@web.de> <97C7EAB7-10AB-4702-ABC8-EB6C1C50ABDB@gnu.org> <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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="73472"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 18 21:02:40 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 1jal28-000J0A-K6 for ged-emacs-devel@m.gmane-mx.org; Mon, 18 May 2020 21:02:40 +0200 Original-Received: from localhost ([::1]:58222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jal27-0000rt-NH for ged-emacs-devel@m.gmane-mx.org; Mon, 18 May 2020 15:02:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jal1P-0000Po-SZ for emacs-devel@gnu.org; Mon, 18 May 2020 15:01:55 -0400 Original-Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733]:42831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jal1O-00024C-Tc; Mon, 18 May 2020 15:01:55 -0400 Original-Received: by mail-qk1-x733.google.com with SMTP id s1so11410091qkf.9; Mon, 18 May 2020 12:01:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=oJWKIhGM9ueWn+ytmH13ZpLbzIxoazLVEnb60SHNtdM=; b=A9c4EeYr+8uW8kN5QIVCI+OPJmIHJL3I4Dw8mJVgO3i2FbXZ820iX2Y/+8NfuHWjAQ fOqthIKXvolgdMhl0rsqCCrJ5VHnuQ58EBrEtwMbWOLk8CTxTjLUVvGXsGs0w3w93KVD hGGJJYCjo0o5cHaIN3hf7NYuLKLrVZmCELLSJ6QbkhUGMwzX3ZK8PlHym5vYuYGefAxE jksM+HuK5nB9QLZzIvuMuoZe8/nIj27bKc6vxB2nUMiiDZebtvkx5T5MGqbYgs7453XK O97/bDGSJ0KuGRBheyhz5lmW4YtEa+ThtuQzB8GUGwiwIvaxcy8L0Id2tmENyd3utpsT 0sSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oJWKIhGM9ueWn+ytmH13ZpLbzIxoazLVEnb60SHNtdM=; b=hNXpnq7TiewfLKYJdzdX943C3aSylKBvu/iEpawmq7aSd5kTIAdfrk9mtuOOerlCZg aLJ+lXif7Eyk2klNhOlenjXG0+vF92nDNOGETWlHwO9x5REzpFPkIZORtBrh/kPmI7hZ Cn45gyfl2bC97TnXPxbMuBIrrovTCUdV22HHvjviqzXSaeN+rYJ0iOO1wJKrSGRc4Iwl wEtRUTaE2kPcJkE0hGIIOtmIT217HJVAk3oGMRhwX7kCU8aHv6MwwhAUjdJ3tODlDq8x sWnO3cp8GTPmBKTAb49jfs7bKUujebx3DIGFgNFc+dO6xeJSQNxU9306i3cK1i6b3Lez oxvw== X-Gm-Message-State: AOAM533Gi6zZbEeW0GJLxfKJUqZ2rvq7t4301r2GCsE/AOF4uYkuSfXI ynezluDZTV3YRMxIaaE1zZH8M0rc X-Google-Smtp-Source: ABdhPJw2gJz/5x0ExVgj6UyBds2vp9B2l71bnK0KqJgM4R7W/4QYZiau7Rz1CRarvhiD5WKMVWbO2A== X-Received: by 2002:ae9:ef89:: with SMTP id d131mr17909702qkg.82.1589828513299; Mon, 18 May 2020 12:01:53 -0700 (PDT) Original-Received: from ?IPv6:2601:184:4180:66e7:bda5:ac5c:1de0:b677? ([2601:184:4180:66e7:bda5:ac5c:1de0:b677]) by smtp.googlemail.com with ESMTPSA id g19sm7641946qke.32.2020.05.18.12.01.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2020 12:01:51 -0700 (PDT) In-Reply-To: <83wo5987mk.fsf@gnu.org> Content-Language: en-GB Received-SPF: pass client-ip=2607:f8b0:4864:20::733; envelope-from=cpitclaudel@gmail.com; helo=mail-qk1-x733.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-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:250800 Archived-At: On 18/05/2020 13.39, Eli Zaretskii wrote: >> From: Clément Pit-Claudel >> Date: Mon, 18 May 2020 13:31:30 -0400 >> >> I've attached a screenshot with a few examples, though I couldn't find a font that displays ae as æ. > > Thanks. Once again, I wonder how they decide where each parts starts > and ends. The examples show very simple cases, so it's hard to know > where this ends. Hi Eli, I asked on Firefox' Matrix server. Here is a lightly edited transcript: cpitclaudel> Hi all. I noticed that Firefox has this nifty feature that makes it possible to move the cursor within a ligature (for example, with the right font config, "ffi" can be rendered as "ffi" while allowing the cursor to move between the individual glyphs that make up that composition). Is the extraction of ligature information and the rendering done by Firefox itself, or by a lower-level library? Most font shaping libraries I've seen don't seem to return glyph-decomposition information for ligatures, so I'm curious to understand how Firefox does it ^^ jfkthame> Firefox uses harfbuzz to handle the font shaping (ligature rules, etc). I'd expect what you describe to work pretty much the same in other browsers too, fwiw. krosylight cpitclaudel> Thanks! But Harfbuzz doesn't give sub-glyph information for ligatures, does it? So how does Firefox know where to put the caret when it moves through a ligature? jfkthame> it doesn't, really - it just knows how many underlying characters are represented by the ligature glyph, and divides the advance width up into that many slices (usually that works pretty reasonably, but it's possible to come up with fonts where the inaccuracy becomes obvious) jfkthame> In principle, OpenType fonts can provide specific positions for the caret within a ligature (see the LigatureCaretList subtable within the GDEF table), but in practice that's rarely supported or used (harfbuzz can provide this information if it's present, see the hb_ot_layout_get_ligature_carets function, but currently firefox doesn't use it anyhow) cpitclaudel> Thanks, that's very useful! How does that work for glyphs like "fs" displayed as ẞ or "fz" displayed as ß? Does Firefox move in that single glyph? (I couldn't find a font that does that, otherwise I'd have tested it ^^) Thanks a lot for your help :) jfkthame> Yes, it'd be the same - doesn't matter what the specific characters are, if there's a ligature of two characters Firefox would put the caret half-way through the ligature glyph when it is between the component characters in the underlying text jfkthame> btw, if you're on a mac (or have access to one), you can see an extreme case if you try the word "Zapfino" in the font Zapfino .... the entire word is a single 7-character ligature, and the seven equal slices that Firefox treats it as for selection/editing purposes don't match up to the visual shapes of the sub-glyphs at all well HTH, Clément.