From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Entering emojis Date: Fri, 05 Nov 2021 06:04:11 +0100 Message-ID: <87wnlnkxbo.fsf@gnus.org> References: <87cznths5j.fsf@gnus.org> <835ytiuvm9.fsf@gnu.org> <834k91vgie.fsf@gnu.org> <8ff3b131c5fa370d9eaf@heytings.org> <83mtmttsxz.fsf@gnu.org> <8ff3b131c56b7b2d1d6f@heytings.org> <83bl39tqnl.fsf@gnu.org> <8ff3b131c531f5254799@heytings.org> <83a6ittp5r.fsf@gnu.org> <8ff3b131c53b9df49236@heytings.org> <834k91th5c.fsf@gnu.org> <8ff3b131c5fe09753ca0@heytings.org> <83mtmtru6l.fsf@gnu.org> <8ff3b131c57f741d04e5@heytings.org> <83lf2drqx6.fsf@gnu.org> <87lf2c3k0z.fsf@gnus.org> <83wnlwqocq.fsf@gnu.org> <87wnlwyox9.fsf@gnus.org> <83lf2cq7n5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25451"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: mattiase@acm.org, raman@google.com, gregory@heytings.org, schwab@linux-m68k.org, stefankangas@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 05 06:06:28 2021 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 1mirQq-0006M7-K8 for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Nov 2021 06:06:28 +0100 Original-Received: from localhost ([::1]:39192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mirQo-00032J-FD for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Nov 2021 01:06:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mirP7-0002DJ-Hc for emacs-devel@gnu.org; Fri, 05 Nov 2021 01:04:41 -0400 Original-Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:53178) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mirP3-0000FC-6t; Fri, 05 Nov 2021 01:04:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=z0fxEzILDknJZ/x4OePbah3HnIcSrneq5U/e9H4Uvz8=; b=Xfcchuwe9bkmfLZn6L7ZD9d17h /DTm3Ru/9+Wt3aoC2ot55TwUvoy1u3cloOQOaLszoxXObA0BmjiBcOvU+Yl5EBKF5Ss3WSG8zk4z0 5P7s0FowtpMhOagRZKJmz8aeC37UlU51aP9s/R5JNzuyBXT7GLqzHnsv41Pc7mfq491Y=; Original-Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mirOg-0001TF-9F; Fri, 05 Nov 2021 06:04:17 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEWDe3BYU0yll4K9 oXnauo3gvo7gwZT///+NHmO0AAAAAWJLR0QHFmGI6wAAAAd0SU1FB+ULBQQ2MRWY2CEAAAG3SURB VDjLdZNNbqQwEIXd0WQPMxdApJV1NEazjgabA6SrvI4S7PsfYV65yuBoOg+1G/zh+sddxsFBF9fr Mo5uVGB6mEWTvDiOPqjWZfWLX+yhA00ciO+CWErJ94Cw9A2476MHEe6aFZKVBCDAyBCWgr/EEXc3 M4VbpRCecjbAQZ4D4YrIAuF+GrBXQyo7fqVwc67msZoOH0DRDpYsPzG16o6uhRE5fMgJDYoJoKSS iaRYCmJAEsFegDY1JTY0XckR9uVSEGEYLMIt58Qpa1TNBJmrCD+1iCfQm5Bh9DwRa+aBu7LX5xps /toP2U+v0+Oru/4HYlj9n7/TY64Z9uDlYXIf8/S87j5sEsZqCYbg5zeAp3fnniP62wDvbnqar9f9 uiy18c0U0W/v/fzjw/38tZuPoYKIRqF1exfVoPWz9qacKZ6AD2G37ImogRhqYdE6VJq2OtTD2SCZ AjFHp3O1XyzxA+h+THXumPpwq9c21tJPBTUcOioLk3Q7ANcia7Ig5wk5j0+A61TVuRq00dBWTu0C zFAd86ZbAzYEGKkOBJsdU52LdqLbly+Vws3K/kUba8/vaBjHf0usLVcfdy2oAAAAJXRFWHRkYXRl OmNyZWF0ZQAyMDIxLTExLTA1VDA0OjU0OjQ5KzAwOjAwer9JvQAAACV0RVh0ZGF0ZTptb2RpZnkA MjAyMS0xMS0wNVQwNDo1NDo0OSswMDowMAvi8QEAAAAASUVORK5CYII= X-Now-Playing: Hype Williams's _Junt-Deez Ruins You See_: "Infinity" In-Reply-To: <83lf2cq7n5.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 29 Oct 2021 16:31:58 +0300") Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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" Xref: news.gmane.io gmane.emacs.devel:278732 Archived-At: Eli Zaretskii writes: >> > And the definitions of those rules should be specific to the font you >> > are using, because different fonts support different ligatures. >>=20 >> Huh. Well, I know nothing about this, but... don't the fonts come with >> this metadata? > > Maybe they do, I don't know. If someone does know, please tell how to > get that meta-data. I don't know anything about this, but I'm just poking around. So, I've got a font called Jolie that has a very noticeable ligature -- it turns the string "#03" (1-3 are ligatures, the rest aren't) into a swoosh. I tried the hb-shape harfbuzz debug command: larsi@elva:~/src$ hb-shape -V ~/.fonts/Jolie\ Romantique.ttf "#03" trace: start table GSUB buffer: [numbersign=3D0|zero=3D1|three=3D2] trace: start lookup 0 buffer: [numbersign=3D0|zero=3D1|three=3D2] trace: end lookup 0 buffer: [end3.swsh=3D0] trace: end table GSUB buffer: [end3.swsh=3D0] trace: start table GPOS buffer: [end3.swsh=3D0+362] trace: start lookup 0 buffer: [end3.swsh=3D0+362] trace: end lookup 0 buffer: [end3.swsh=3D0+362] trace: end table GPOS buffer: [end3.swsh=3D0+362] [end3.swsh=3D0+362] And indeed, it finds the swoosh in the GSUB/GPOS ligature tables in the font file. If I try a combination that doesn't have a swoosh: larsi@elva:~/src$ hb-shape -V ~/.fonts/Jolie\ Romantique.ttf "#05" trace: start table GSUB buffer: [numbersign=3D0|zero=3D1|five=3D2] trace: start lookup 0 buffer: [numbersign=3D0|zero=3D1|five=3D2] trace: end lookup 0 buffer: [numbersign=3D0|zero=3D1|five=3D2] trace: end table GSUB buffer: [numbersign=3D0|zero=3D1|five=3D2] trace: start table GPOS buffer: [numbersign=3D0+407|zero=3D1+289|five=3D2+3= 13] trace: start lookup 0 buffer: [numbersign=3D0+407|zero=3D1+289|five=3D2+313] trace: end lookup 0 buffer: [numbersign=3D0+407|zero=3D1+289|five=3D2+313] trace: end table GPOS buffer: [numbersign=3D0+407|zero=3D1+289|five=3D2+313] [numbersign=3D0+407|zero=3D1+289|five=3D2+313] It returns three characters instead of a cluster, if I interpret this correctly. So apparently by traversing the GSUB/GPOS tables (whatever they are), this data can be found, and then we can feed it to font-shape-gstring and get ligatures? I've had a peek at the hb-shape source code, but it's unfortunately written in the C++ style "everything happens somewhere else", so it's a bit difficult to read. But apparently we already parse these tables in hbfont_otf_capability? So... we need... to parse them more to get all the ligature data out of them and then... put it in a ... char table range? How all this connects is very vague to me. =F0=9F=98=80 Does this have anything to do with anything: https://harfbuzz.github.io/harfbuzz-hb-ot-layout.html#hb-ot-layout-get-liga= ture-carets ? --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no