From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?B?7KGw7ISx67mI?= Newsgroups: gmane.emacs.devel Subject: Re: Ligatures Date: Sat, 23 May 2020 22:36:21 +0900 Message-ID: References: <20200517165953.000044d2@web.de> <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 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Content-Type: text/plain; charset=utf-8; delsp=yes; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="130298"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , cpitclaudel@gmail.com, alan@idiocy.org, Pip Cet , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 23 15:37:01 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 1jcUKj-000Xmu-K3 for ged-emacs-devel@m.gmane-mx.org; Sat, 23 May 2020 15:37:01 +0200 Original-Received: from localhost ([::1]:38268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcUKi-00055t-Mv for ged-emacs-devel@m.gmane-mx.org; Sat, 23 May 2020 09:37:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcUKH-0004bt-3h for emacs-devel@gnu.org; Sat, 23 May 2020 09:36:33 -0400 Original-Received: from pv50p00im-zteg10021301.me.com ([17.58.6.46]:59390) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcUKG-0007E3-1D for emacs-devel@gnu.org; Sat, 23 May 2020 09:36:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1590240986; bh=pxCW9iWHjkp0l0iri6A2e2uoe3iYk05SJfH+LMiiV3k=; h=Content-Type:Subject:From:Date:Message-Id:To; b=QRbseAIbZRNAXBM7BxN5wZUj6PBEezeF4Iqd6y3R+eJyzBjgnGaRfenm7PmvFiS7E W4oEloisRiSgtr6lUBuerOSVdYPIgz6K81j/y9v2K5vD2TY4Bj8GlksH9oCm4x7q2G oEAKzZ2KkXKE1U9Qv5mZX5J17TnO+OI4utRjzc9PhZo10xsaXIRxJZzOK7dA5O88v9 tz1bzQ9gVhslUYG8+kLUSBSDy4wIjH4ispsJxTxyeEqfr0QP77/vr6TmAuCdEGwJjf llGuc79TqoYbbAXgqcf5YgswcDOmxhxpz92hOsYBoccL1QsFlV3blH87huH1DsPlaK c1Tubb39UODEQ== Original-Received: from [192.168.0.2] (unknown [1.230.108.64]) by pv50p00im-zteg10021301.me.com (Postfix) with ESMTPSA id 2C657580536; Sat, 23 May 2020 13:36:23 +0000 (UTC) In-Reply-To: X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676 definitions=2020-05-23_07:2020-05-22, 2020-05-23 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=603 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2002250000 definitions=main-2005230112 Received-SPF: pass client-ip=17.58.6.46; envelope-from=pcr910303@icloud.com; helo=pv50p00im-zteg10021301.me.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/23 09:36:26 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, FROM_EXCESS_BASE64=0.979, KHOP_DYNAMIC=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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:251271 Archived-At: Stefan Monnier 작성: >> 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 wonder how it is supposed to work and it works in other applications: I don’t know how much you know about text rendering, (I’m fairly confident that a previous Emacs maintainer to know more about this than me) but for people who are curious about this, I found the ’Text Rendering Hates You’[0] article which was very helpful for understanding the problem. [0]: https://gankra.github.io/blah/text-hates-you/ > Disregarding the theoretical question of whether a font can use > ligatures that involve the LF character (and hence affect the definition > of what is a line), I still see a chicken-and-egg problems: > How do you know where the current "screen line" ends if you don't know > how narrow/wide the font and its ligatures will render the text? > > Do current applications use a heuristic like "ligatures won't reduce the > size by more than a factor 2, so estimate the lower bound on the final > size to be at most half of what the font metrics say", so they will send > up to twice as much text to be shaped as needed, and then they throw > away the left overs? According to the article I mentioned, it’s just passing the total text repeatedly until it runs out of space. > You have to assume that your text fits on a single line and shape it > until you run out of space. At that point you can perform layout > operations and figure out where to break the text and start the next > line. Repeat until everything is shaped and laid out. > > Stefan