From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kai Ma Newsgroups: gmane.emacs.devel Subject: Re: Text shadows Date: Sun, 12 Mar 2023 16:24:17 +0800 Message-ID: References: <72650A07-DEC8-4E08-A524-5C7AF804F3CB@gmail.com> <83mt4iv3xa.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) 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="10413"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 12 09:25:17 2023 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 1pbH12-0002Sx-Qk for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Mar 2023 09:25:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbH0P-0004Os-HE; Sun, 12 Mar 2023 04:24:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbH0N-0004OT-Gd for emacs-devel@gnu.org; Sun, 12 Mar 2023 04:24:35 -0400 Original-Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbH0L-0004mB-UI; Sun, 12 Mar 2023 04:24:35 -0400 Original-Received: by mail-pl1-x642.google.com with SMTP id i5so9892586pla.2; Sun, 12 Mar 2023 00:24:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678609471; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1aXrTTuEnfmsQqm9evjqHwd+lGA/XI07l//IcP2PwQI=; b=S20k1Oqxh3fptZnzhhIa56KDxKrc+qtBto2i2tfeDaT0lbGloJaTGIE+pPAqOb5TDc IWKjhvPF6WM3rPdsyyN7XpeiOFbz5IoAO0Gd3ys1eEeVIDqFZZUacPdxjnWg0E72BeK9 KWojQp7h819hlfaTG756awdOzME6+L4uPqh9MkFBi4Rv4QuA0btiPAB8C3gt4/PJ9EgM sJSogIr3sYe1//JY/0ySx2KepWM5vevp0rx1ss8TpeB7J9dA246FCLgRJVOt5cUikqfK AiLt1zVAC2ZStyZbcuTjqEN9Qu1NmbSZWwb9JPgZHeansynxEWsT3EKEMXXUZGyhTQU3 1byQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678609471; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1aXrTTuEnfmsQqm9evjqHwd+lGA/XI07l//IcP2PwQI=; b=XCkVhftiVu4OmFUN2GflIzz9iKQmddzyNQIARZSfwhawV1IQG4DJVU7kRbfNc1QoE7 IYWd4y+qlrFrEV9gSyrxCS7Mz14ZhYqBt5h1dCAjrS0kWWFAmPcuKQskh9fMYkmvDhH0 uvNVVyKzTKeU5KHl4jDkiqyBOiDG1mmx+Nc726xG14TE/ub0WPGlFSohJAVkpA+JEiOS yNCDGQtBQZ8wAE5YT2k2zgNm5584HZUWYt3OyDCwQqjkv+a4LoR8GmSzde5t9ul9nxx9 uKtu/GrGRrCgIh5PmHwWp879j/4UIo8vbEYb5CjwISbOI1ojX4NFK57ReoH+ZX1g65C8 pJbw== X-Gm-Message-State: AO0yUKW3oZAhFk/Fi1KdPrFhJ4TrwSU6XY/vtMYUtPw1TUY4FnFfODtX vKn1T02Mn7SXix6B3HimJMNRHhxUPKb7hqdbccA= X-Google-Smtp-Source: AK7set8Va2JjZ2qnVzvccaFvEjyCRFvOmpSLeE/Fg5fqGvXUlqH4pcqb7pmlftG0vQMGSEW4SUgWzA== X-Received: by 2002:a05:6a20:3d05:b0:cc:5917:c4e3 with SMTP id y5-20020a056a203d0500b000cc5917c4e3mr37143340pzi.48.1678609471429; Sun, 12 Mar 2023 00:24:31 -0800 (PST) Original-Received: from smtpclient.apple ([134.209.106.31]) by smtp.gmail.com with ESMTPSA id c25-20020aa78e19000000b00592626fe48csm2416517pfr.122.2023.03.12.00.24.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Mar 2023 00:24:30 -0800 (PST) In-Reply-To: <83mt4iv3xa.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.400.51.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::642; envelope-from=justksqsf@gmail.com; helo=mail-pl1-x642.google.com 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_FROM=0.001, FROM_LOCAL_NOVOWEL=0.5, RCVD_IN_DNSWL_NONE=-0.0001, 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304354 Archived-At: > On Mar 12, 2023, at 15:12, Eli Zaretskii wrote: >=20 >> From: Kai Ma >> Date: Sun, 12 Mar 2023 12:06:28 +0800 >>=20 >> Recently, I implemented the =E2=80=9Ctext shadows=E2=80=9D feature = for Cairo-powered windowing systems, including X11 and Wayland. See [1] = if you wonder what that looks like. >=20 > Which parts of the feature implementation really require Cairo? IOW, > why cannot this be available to non-Cairo builds as well? Theoretically, nothing. I targeted Cairo because (I think) it is the = most popular option on GNU/Linux. Speaking of this specific implementation, gaussian_blur() relies on a = specific Cairo image format ARGB32, (this assumption could be easily = removed), and then it is used by ftcrfont_draw() to generate shadows. I don=E2=80=99t know whether non-Cairo builds (non-cairo X, win32) = can/should use gaussian_blur() though, since I=E2=80=99m not familiar = with them. >> This feature adds a new face attribute :shadow, and accepts values = like: >>=20 >> - FLOAT how much blurring? >> - (FLOAT . COLOR) additionally, specifies a color for the = shadow >> - (FLOAT COLOR OFFSET) additionally, specifies an offset (x . y) >=20 > I think at least in some GUI systems the offset is specified as radius > and angle. The shadow is generated by this process: - draw glyphs (in the shadow color) onto a blank canvas; - apply the blurring function; - copy the =E2=80=9Cshadow=E2=80=9D back to the original canvas at the = specified x-y coordinate. So I don=E2=80=99t think radius and angle is relevant here. >> I=E2=80=99m writing to ask if the community is interested in = accepting this feature into mainline Emacs? If so, I will improve = things and make a formal patch. >=20 > Yes, I think we'd like to support this feature. But it looks to me > like the current WIP is incomplete, as it doesn't handle the change in > glyph metrics due to the shadowing, see below. Thanks! > It is best to submit a feature-request bug report using > report-emacs-bug, and then continue the discussion on our issue > tracker. Will do after I fix the glyph metrics. >> 1. The shadows sometimes should be drawn outside the glyph extents, = but they aren=E2=80=99t drawn. >> 2. Previously drawn shadows are not cleared, and they even = accumulate. This can be observed with blink-cursor-mode enabled. >=20 > This probably means you need further changes in the layout part of the > display code, in xdisp.c, to account for the changes in the glyph > metrics due to the shadow attribute. See, for example, how the 'box' > face attribute is handled there. Thanks for this pointer. I will work this out first, and then let=E2=80=99= s continue the discussion on the bug tracker. =E2=80=94 Kai