From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#44655: 28.0.50; Oversized SVG margin Date: Sat, 6 Nov 2021 12:55:49 +0000 Message-ID: References: <757bb5f2e5c43762717c5b1f8a0d3083c6e01607.camel@gmail.com> <201c26ed-10bb-40ac-b8a9-c0dcbd85e6f0@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19888"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44655@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 06 13:57:55 2021 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 1mjLGd-0004xb-4b for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Nov 2021 13:57:55 +0100 Original-Received: from localhost ([::1]:36104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjLGb-0008Qh-Gm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Nov 2021 08:57:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjLFm-0008QU-LI for bug-gnu-emacs@gnu.org; Sat, 06 Nov 2021 08:57:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37144) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mjLFm-0006Hq-0j for bug-gnu-emacs@gnu.org; Sat, 06 Nov 2021 08:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mjLFl-0003gv-TQ for bug-gnu-emacs@gnu.org; Sat, 06 Nov 2021 08:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Nov 2021 12:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44655 X-GNU-PR-Package: emacs Original-Received: via spool by 44655-submit@debbugs.gnu.org id=B44655.163620336314112 (code B ref 44655); Sat, 06 Nov 2021 12:57:01 +0000 Original-Received: (at 44655) by debbugs.gnu.org; 6 Nov 2021 12:56:03 +0000 Original-Received: from localhost ([127.0.0.1]:48690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mjLEp-0003fX-Hj for submit@debbugs.gnu.org; Sat, 06 Nov 2021 08:56:03 -0400 Original-Received: from outbound.soverin.net ([116.202.126.228]:41457) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mjLEl-0003fA-1y for 44655@debbugs.gnu.org; Sat, 06 Nov 2021 08:56:02 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 247894D3; Sat, 6 Nov 2021 12:55:52 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1636203351; bh=jirT7hZzRZXiVeJraRGgK2op45dz1KMIu31zYQ7oCOg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Gay5keS+aPQCBXyiXP9iOTaix1a2CiJFPct+mDX/vkZrjiZv9B/yaw7QYAcEuyXfD BBdFTZQe1TOcNUJ1Zfw3Isll+wS/z3MRQot+Xlsp8OQBgPsLx5DOwC3gQYuY/IaY7v Fg5Y8ic2TefNb7fBSE+7CfYqYjw6D3Hg4gcEhAwxZpxjIk4ru1etGcbVIaMS9Cy5Do o/7fXLVQ/mSSB7+XviN2LvxiB7Ely6cY6av060y7l+kQ6bL2Qw4VoCG25fwqxorLDL Adwh3QUdFDmSg17tPrnT2ZlvVZhbnIP/G3zEo7cdQWxz5J0Y7LMLBFlv2PveRCa4AH wDzy5xNmVBHDQ== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.95-RC2) (envelope-from ) id 1mjLEb-000CHJ-6n; Sat, 06 Nov 2021 12:55:49 +0000 Mail-Followup-To: Alan Third , Paul Eggert , 44655@debbugs.gnu.org Content-Disposition: inline In-Reply-To: <201c26ed-10bb-40ac-b8a9-c0dcbd85e6f0@cs.ucla.edu> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:219103 Archived-At: On Fri, Nov 05, 2021 at 12:28:37PM -0700, Paul Eggert wrote: > I ran into a problem building Emacs with Fedora 35 (released 3 days ago) > related to the fix for bug#44655, and installed the attached to try to work > around the issue (which is due to the deprecation of > rsvg_handle_get_dimensions in librsvg 2.52.0 (2021-09-15)). There seems to be a lot of churn in the librsvg API at the moment, and their documentation isn't keeping up as it still doesn't mark rsvg_handle_get_dimensions as deprecated. It appears they've introduced rsvg_handle_get_intrinsic_size_in_pixels which does the same thing (but better) than my sizing code, but anyone using librsvg 2.46-2.52, which is probably most people for now, can't use it and probably don't want to use the old scheme, so I expect there's no point replacing my code at the moment. > - if (viewbox_width == 0 || viewbox_height == 0) > +#else > + /* In librsvg before 2.46.0, guess the viewbox from the image dimensions. */ > + RsvgDimensionData dimension_data; > + rsvg_handle_get_dimensions (rsvg_handle, &dimension_data); > + viewbox_width = dimension_data.width; > + viewbox_height = dimension_data.height; > #endif > - { > - /* The functions used above to get the geometry of the visible > - area of the SVG are only available in librsvg 2.46 and above, > - so in certain circumstances this code path can result in some > - parts of the SVG being cropped. */ > - RsvgDimensionData dimension_data; > - > - rsvg_handle_get_dimensions (rsvg_handle, &dimension_data); > - > - viewbox_width = dimension_data.width; > - viewbox_height = dimension_data.height; > - } > > compute_image_size (viewbox_width, viewbox_height, img, > &width, &height); The fall through is in place because if the image size is defined in units we don't know (e.g. % or ex) then we end up with no idea what size it should be. Perhaps what we should do is move the final "else" section of the previous code block (where rsvg_handle_get_geometry_for_layer is called) into its own block which is executed if (viewbox_width == 0 || viewbox_height == 0) instead of only in the case where rsvg_handle_get_intrinsic_dimensions fails to return any dimensions. That way we should have *some* dimensions without having to call rsvg_handle_get_dimensions. -- Alan Third