From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Enclosing text in a box Date: Wed, 16 Nov 2022 22:06:22 +0700 Message-ID: References: <_AODCZ2cNjiSAkIvdrGzDgeSNSWqJoJ9xfXn-zFenyY-yTUYx-Ijx0k4-Lq46rN4CjdkyIrzIBD1h4YY23BAP089R0Tg0kzM9MOUnaEOFrs=@protonmail.com> <835yffgfwp.fsf@gnu.org> <83y1sbez2r.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="24144"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 16 16:07:13 2022 Return-path: Envelope-to: geh-help-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 1ovK0P-000658-QP for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Nov 2022 16:07:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovJzx-0007S0-9e; Wed, 16 Nov 2022 10:06:49 -0500 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 1ovJzs-0007N0-2w for help-gnu-emacs@gnu.org; Wed, 16 Nov 2022 10:06:41 -0500 Original-Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovJzq-00065g-9g; Wed, 16 Nov 2022 10:06:39 -0500 Original-Received: by mail-wm1-x32b.google.com with SMTP id v7so12114183wmn.0; Wed, 16 Nov 2022 07:06:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MPtxgcR7CKy1U15wsccE0QMiV6kaF1P4Msso3EA+cI8=; b=REtf2rlPygDp5KgXE4FZkWmw+x/Ag/g8llbwVwpERHn6m/DEhIWFZA9vm97mMBFQAd yqZny2wdBiYwEHe8JZOuqHpynxE4B/8PMS0xdD+P4nNkxUHSW7kfGopV/BqfW15oc5+g 1ZOH4MHv3YazW46P4Q4XQXxdFJ7wvxgGCOokmCc6hMovOwxqipyPB4ZqVC0Y1gU9vhMD jM1G+yhO3i0wrGdcQSuihF5BdMOXX9G53quX4O4pPWN590TBswYREAPRC8w8sKgIf20O +Ci/MoCFfdeYwBiOpiRm3fidcptmWuGURrLzXWsrHQcAS2j/jYkLOTLRw7HV11N+CUIO mauA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MPtxgcR7CKy1U15wsccE0QMiV6kaF1P4Msso3EA+cI8=; b=Hhyh1tyR5ivRnbWSOcSMZU8t8DRxPSv83j9gb66ubCntpadNBAUgxmrONwmdb+CeUz S4kaUnUQ9qjrfmc3mtJ+HMSoL61+YLEOF4yBD92fHCaNrg1lNHcgs2wh/zsroKDPN7bS g5DcKK+7XsP0weHHpx4hxfDcFsKXSx4RXREKLWivpeYQbC/janSkZ41Blm6QRMat9Qi2 QVDVSXlXUzroX7y+eWJgaJtIX4JmumPsI71VSD2MzMz0ZfVxc7EiDED8G+HxaVa8pYq6 +YO0TCq8QWWSebHfXUzcgAUz2+l4mRIrhM976xHEj1ZbhGm/4aoYIcgTAgPPCR9VphXp eXoA== X-Gm-Message-State: ANoB5pn9gCpvO0IBUPqYEMPTHWCYOibMmeg985uL3tjekX9CInCytKRF kBG/QNrlAS9B6WhP4QVKb/00jFiwxFtEOV3ZrcNAf9mzpmg= X-Google-Smtp-Source: AA0mqf6Lpiq2OCXjsy87tWEc3yV6MwMtymS7sqRHxAYcnTjmas6eDBWWQbD8EEIbybLj0/F9z1gXZ7YOqdKMEuivBDA= X-Received: by 2002:a05:600c:4b17:b0:3cf:8b22:b567 with SMTP id i23-20020a05600c4b1700b003cf8b22b567mr2384366wmp.144.1668611194026; Wed, 16 Nov 2022 07:06:34 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=yurivkhan@gmail.com; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:141005 Archived-At: On Wed, 16 Nov 2022 at 21:55, Yuri Khan wrote: > * OP uses =E2=80=98length=E2=80=99 to measure the text, and =E2=80=98make= -string=E2=80=99 to build a box. > * You point out that this fails for non-monospace fonts, and suggest > measuring with =E2=80=98string-width=E2=80=99 or =E2=80=98string-pixel-wi= dth=E2=80=99. > * OP tries to measure in pixels, realizes one has to divide by the > width of a box drawing character. The division result turns out > fractional. A more-or-less complete solution would probably involve: * Measuring pixel width of the enclosed text. * Measuring pixel width of the box drawing character. * Dividing one by the other, rounding up. * Appending to the enclosed text a space with a display property giving it a pixel width that pads the text to an integer number of box drawing characters. * (if the enclosed text is editable) Arrange for the above to be re-done on change. No, I=E2=80=99m not going to do a prototype.