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.bugs Subject: bug#40845: SVG rendering issues Date: Sat, 25 Apr 2020 19:41:31 +0000 Message-ID: References: <72ebf5eb-6b00-ebb4-dab3-a047e35ae1ae@gmail.com> <83o8rf7fc0.fsf@gnu.org> <83lfmj7dh7.fsf@gnu.org> <83eesb7833.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0000000000005fc4d905a422ad7c" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="23064"; mail-complaints-to="usenet@ciao.gmane.io" Cc: cpitclaudel@gmail.com, 40845@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 25 21:43:16 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jSQhl-0005pj-Mf for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Apr 2020 21:43:13 +0200 Original-Received: from localhost ([::1]:46408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSQhk-0001LE-Nh for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Apr 2020 15:43:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34512) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSQhb-0001L4-KD for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 15:43:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSQha-0002I8-WD for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 15:43:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48843) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jSQha-0002FW-16 for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 15:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jSQhZ-0005G5-VN for bug-gnu-emacs@gnu.org; Sat, 25 Apr 2020 15:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Apr 2020 19:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40845 X-GNU-PR-Package: emacs Original-Received: via spool by 40845-submit@debbugs.gnu.org id=B40845.158784373520156 (code B ref 40845); Sat, 25 Apr 2020 19:43:01 +0000 Original-Received: (at 40845) by debbugs.gnu.org; 25 Apr 2020 19:42:15 +0000 Original-Received: from localhost ([127.0.0.1]:60389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jSQgp-0005F2-Eu for submit@debbugs.gnu.org; Sat, 25 Apr 2020 15:42:15 -0400 Original-Received: from mail-ot1-f50.google.com ([209.85.210.50]:44839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jSQgn-0005Ep-Vo for 40845@debbugs.gnu.org; Sat, 25 Apr 2020 15:42:14 -0400 Original-Received: by mail-ot1-f50.google.com with SMTP id j4so18946625otr.11 for <40845@debbugs.gnu.org>; Sat, 25 Apr 2020 12:42:13 -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=v/1sdJpdo+rknc/7ecZ7/L+FrfSDOUK/tGUj4XiGSDE=; b=EiVGQ2Qtz7LCWc6SfCIb75X8lqlj9RLp08r8veofLqVY2hmhBiQbTU1UY65N5gA3Hg Ux2Hhu5N88qrHf9mx02l8DxYgRjZemF2wwUst2zBNy0RiM3JVLj46p7G5PQkk6yeiQSc fevs8sYQTShuvrFgWc0AQj7KtClSTfbe4R1wlGR7Jb77rMwNR3AUu/Wv0hq+gfNZeivN jKXhcwNsEgEyTRorzlmFKmbajoA6uouaGp5fNrjqoEUB59WyUjeVEtiB6Jo+PfqDlAOk V3wHQ8v0PH631jX42fpw8b/PgUgOEXo4+GX8hsnwm2BtJFooap/Sq919ulrN+HchebtU tbCw== 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=v/1sdJpdo+rknc/7ecZ7/L+FrfSDOUK/tGUj4XiGSDE=; b=Hi1kPN2DxajeivCHIZJmCMpoC4Ekg2Bm8uAU+CiaLKr1swzS9iDKXjv3Frn18/lUdh /2XA7RMSNy58167ux4Gfq795LbVVFlUFFL3QrU85spg+j61KjSiKGcAEHItsHJE7h4CZ HcVhw2/iU85qSskvat7Aili/JqGimacNg2m7v8JvMZXMXOqZy+PnFXNC4nKt8tZ6B1Ht f7xDpecnFcIF+/MmQLEWao2HA5XoSYAmmAOQujgQ03ZSYgCG4pw9jvHitNb54AmJY7Ur 1js93EkO1DmPQkbdvnRpItmFgblutCVpyR9e+AWDLZUyxU+jDWJqhGF5c3Ssw2mWZmm5 PDsg== X-Gm-Message-State: AGi0Pual9UgiXDcAJmeigSzgg+gNRQ2H1Ow3A28VqxRxlezN8zNT98Sg /CbPo7PxWjw6ZHh2Zfp/vDUn63Y97LAjzZxGlVY= X-Google-Smtp-Source: APiQypLVzRbO4h2rruY8WQh4KxR5gzuX9H+mk/Fv2B8EksbkA74+5zQp+rn11O1M9mnv+pLSvBG10TT3Kj09f17gqsY= X-Received: by 2002:a9d:5a04:: with SMTP id v4mr13496941oth.292.1587843728120; Sat, 25 Apr 2020 12:42:08 -0700 (PDT) In-Reply-To: <83eesb7833.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179029 Archived-At: --0000000000005fc4d905a422ad7c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Apr 25, 2020 at 6:07 PM Eli Zaretskii wrote: or these > Then I guess I don't understand your implementation at all. My use case is to include a glyph which is supposed to look like a character, but doesn't actually have a unicode codepoint. (I'm sorry if this differs from the use cases you're exclusively concerned with, but it appeared to be relevant enough to Cl=C3=A9ment's problem that I assumed he was having a similar issue). That means that we want to use an image spec, not a character in a font; but that image spec depends on face/font properties, because we want to blend in with surrounding text. The most obvious ones are foreground and background color and size, but slant and weight would also affect properly-rendered character-like images. It seems fairly obvious to me that it's a bad idea to do all the work in the display engine or in C code: sub-pixel rendering and anti-aliasing are hard to get right. A character-like glyph might need a third color which provides sufficient contrast to the foreground and background colors, and that color space calculation is complicated enough to be moved to Lisp. So I moved it to Lisp: there's Lisp code which is passed the font/face properties, and returns an image spec that's appropriate for that. The attached patch actually applies to and works with master, and includes an example. It can no longer easily be demonstrated to do the right thing when the same buffer is displayed in different frames, because Emacs currently applies text scaling per buffer rather than per frame (IMHO, that's a bug). It also doesn't properly display the cursor as a block cursor when it's over the glyph, because I can no longer find the code which allowed me to tell, from Lisp, whether that was the case. And of course it doesn't use the right font metrics, because these currently aren't exposed to Lisp. But all these limitations are fixable. --0000000000005fc4d905a422ad7c Content-Type: text/x-patch; charset="US-ASCII"; name="0001-support-generated-display-specs.patch" Content-Disposition: attachment; filename="0001-support-generated-display-specs.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k9g10frs0 RnJvbSA4ZTdhYTM4ZTA5OGJkMDQ0YTcxZmEyMGRmMTU5M2QyYjM3MzQ3ZjFjIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQaXAgQ2V0IDxwaXBjZXRAZ21haWwuY29tPgpEYXRlOiBTYXQs IDI1IEFwciAyMDIwIDE4OjQxOjAyICswMDAwClN1YmplY3Q6IFtQQVRDSF0gc3VwcG9ydCBnZW5l cmF0ZWQgZGlzcGxheSBzcGVjcwoKLS0tCiBnZW5lcmF0ZWQtaW1hZ2Utc3BlY3MuZWwgfCAzMSAr KysrKysrKysrKysrKysrKysrKysrKysrKysrCiBzcmMvY2FsbGludC5jICAgICAgICAgICAgfCAg MSArCiBzcmMveGRpc3AuYyAgICAgICAgICAgICAgfCA0NCArKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrCiBzcmMveGZhY2VzLmMgICAgICAgICAgICAgfCAgMiArLQogNCBm aWxlcyBjaGFuZ2VkLCA3NyBpbnNlcnRpb25zKCspLCAxIGRlbGV0aW9uKC0pCiBjcmVhdGUgbW9k ZSAxMDA2NDQgZ2VuZXJhdGVkLWltYWdlLXNwZWNzLmVsCgpkaWZmIC0tZ2l0IGEvZ2VuZXJhdGVk LWltYWdlLXNwZWNzLmVsIGIvZ2VuZXJhdGVkLWltYWdlLXNwZWNzLmVsCm5ldyBmaWxlIG1vZGUg MTAwNjQ0CmluZGV4IDAwMDAwMDAwMDAuLmI3NjRkMTk5OWQKLS0tIC9kZXYvbnVsbAorKysgYi9n ZW5lcmF0ZWQtaW1hZ2Utc3BlY3MuZWwKQEAgLTAsMCArMSwzMSBAQAorKHJlcXVpcmUgJ3N2ZykK KworKGRlZnVuIGdlbmVyYXRlLWNpcmNsZS1pbWFnZSAoYWxpc3QpCisgIChsZXQqICgodnNpemUg KGZvbnQtZ2V0IChhbGlzdC1nZXQgOmZvbnQgYWxpc3QpIDpzaXplKSkKKyAgICAgICAgIChmb3Jl Z3JvdW5kIChhcHBseSAjJ2NvbG9yLXJnYi10by1oZXggKG5jb25jIChjb2xvci1uYW1lLXRvLXJn YiAoYWxpc3QtZ2V0IDpmb3JlZ3JvdW5kIGFsaXN0KSkgKGxpc3QgMikpKSkKKyAgICAgICAgIChi YWNrZ3JvdW5kIChhcHBseSAjJ2NvbG9yLXJnYi10by1oZXggKG5jb25jIChjb2xvci1uYW1lLXRv LXJnYiAoYWxpc3QtZ2V0IDpiYWNrZ3JvdW5kIGFsaXN0KSkgKGxpc3QgMikpKSkKKyAgICAgICAg IChoc2l6ZSAoKiB2c2l6ZSAuOCkpCisgICAgICAgICAoc3ZnIChzdmctY3JlYXRlIGhzaXplIHZz aXplKSkKKyAgICAgICAgIChzdyAoKiAuMSBoc2l6ZSkpKQorICAgIChzdmctcmVjdGFuZ2xlIHN2 ZyAwIDAgaHNpemUgdnNpemUgOmZpbGwgYmFja2dyb3VuZCkKKyAgICAoc3ZnLWNpcmNsZSBzdmcg KCogaHNpemUgLjUpCisgICAgICAgICAgICAgICAgKC0gKCogLjggdnNpemUpICgqIC41IGhzaXpl KSkKKyAgICAgICAgICAgICAgICAoLSAoKiBoc2l6ZSAuNSkgc3cpCisgICAgICAgICAgICAgICAg OmZpbGwgIm5vbmUiCisgICAgICAgICAgICAgICAgOnN0cm9rZSBmb3JlZ3JvdW5kCisgICAgICAg ICAgICAgICAgOnN0cm9rZS13aWR0aCBzdykKKyAgICAoc3ZnLWxpbmUgc3ZnCisgICAgICAgICAg ICAgICgqIGhzaXplIC41KSAoLSAoKiAuOCB2c2l6ZSkgKCogLjUgaHNpemUpKQorICAgICAgICAg ICAgICAoKiBoc2l6ZSAuNSkgKC0gKCogLjggdnNpemUpIHN3KQorICAgICAgICAgICAgICA6c3Ry b2tlIGZvcmVncm91bmQKKyAgICAgICAgICAgICAgOnN0cm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