From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Anand Tamariya Newsgroups: gmane.emacs.devel Subject: Re: Pixel padding with variable pitch font Date: Tue, 8 Jun 2021 10:34:03 +0530 Message-ID: References: <831r9dhk6s.fsf@gnu.org> <87sg1tm57w.fsf@localhost> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000df628805c43a1649" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31517"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 08 07:05:08 2021 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 1lqTvI-0007xx-4G for ged-emacs-devel@m.gmane-mx.org; Tue, 08 Jun 2021 07:05:08 +0200 Original-Received: from localhost ([::1]:51326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqTvG-0001Zg-8z for ged-emacs-devel@m.gmane-mx.org; Tue, 08 Jun 2021 01:05:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqTuT-0000tD-R2 for emacs-devel@gnu.org; Tue, 08 Jun 2021 01:04:17 -0400 Original-Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]:35484) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqTuS-0002py-2c; Tue, 08 Jun 2021 01:04:17 -0400 Original-Received: by mail-il1-x12b.google.com with SMTP id b9so18460211ilr.2; Mon, 07 Jun 2021 22:04:15 -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=Gj3GVdDkwNRnnmjEABXwasw2LYmiP24WtpHcNVtBOcE=; b=ssoI8i2U+BjVk/nF6SFiK6FhoKtdb5ELvnoBgoZJ2qE9BNRstFhZSbKrSgBYADKoNp UWjcMmRIFuJoJ8bQ+4ZY5JDTUP4gf/WmWm5XK3pERq0VCjscPP/iq+PNVG/5icDP0Kk9 CMdlcrtuGvyzBm4TKlteGzcfNVkf1EoijNke44yagO88QhTjUm4q/2XdoIuiVPJSAQ59 oP/Bev/aMr0IMP6NRqJwzvjH50tsfAOzVo6wJ14+uC6S+poDYxT5dCDWSciSS4vuiCVj kqWnyVT5R7pi99vFZY6PCUGpY41AaKegZ61CY0/MlZRwtj3wMLklpQMUrgPlaAUc7V6h 1ocw== 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=Gj3GVdDkwNRnnmjEABXwasw2LYmiP24WtpHcNVtBOcE=; b=FjISPsBtm7DUm63jdDus4ws2L1kGeTP+IJZyGOb0m9STsq7tTTCs4Hwu4Xg4U+pTou J0lBC3MRXd4wobC3bRjXtfnHb6NTl2TXKGY45TpfZ7cVlG/MlMzB2Vdw6BBtBSq01Cau J7B/MC6JryA+oFPWBk2YRy7t+8w5h8Fs52SadygO/C/TiHdBP8s2FAn9kn0ijDxm4xRR YwKRTdTnU0Z4cRGgBDCYIkijySsolC+eWXfT1JrQuufUtTmR4dSIaAzdSPT8fgY4N0D4 f+uwWsLkWfba+1NAJQ1d63vLpwA2p4dhSEsEG1tNeo4dgq8rToJ3CscMlAlB93Ghp/L0 JFvg== X-Gm-Message-State: AOAM530kLqP8C+g/P4NJhNeki5MCd8Ze64kot0MPOG3v7suoJyAuU3x8 EpSCKfDQyfUdSgYfe17uLFNDhapIxgn46pNuMZA= X-Google-Smtp-Source: ABdhPJzLy9UI6i3U80Shk6qrEsY1dpx2CgXBQBHp4bH7MH3NiYG5G1ctVbv5UMzK/U7HDY1KbSPSFpP1sGPXfiqOn84= X-Received: by 2002:a92:3302:: with SMTP id a2mr17880554ilf.62.1623128654437; Mon, 07 Jun 2021 22:04:14 -0700 (PDT) In-Reply-To: <87sg1tm57w.fsf@localhost> Received-SPF: pass client-ip=2607:f8b0:4864:20::12b; envelope-from=atamariya@gmail.com; helo=mail-il1-x12b.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, HTML_MESSAGE=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: 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:270555 Archived-At: --000000000000df628805c43a1649 Content-Type: text/plain; charset="UTF-8" One can still measure the actual character width using > window-text-pixel-size and take it into account. That's correct. width is pixel width returned by (posn-at-point) and w is (font-get (font-at (point)) :size). This assumes that, e.g., #x2001 takes the same horizontal space as the > SPC character (or the same as a column)? The code is only assuming what the specs prescribe. It makes no guarantee for non-standard fonts. The complete code in action, if anybody is interested, is here https://gitlab.com/atamariya/emacs/-/blob/dev/lisp/cedet/company.el#L2562 . --000000000000df628805c43a1649 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

=
One can still measure the actual character width using
window-text-pixel-size and take it into account.
=C2=A0Tha= t's correct. width= is pixel width returned by (= posn-at-point) and w is (font-get (font-at (= point)) :size).=C2=A0

This assumes that, e.g., #x2001 takes the same= horizontal space as the
SPC character (or the same as a column)?
The code is only = assuming what the specs prescribe. It makes no guarantee for non-standard f= onts.

The complete code in action, if anybody is i= nterested, is here https://gitlab.com/atamariya/emacs/-/blob/dev= /lisp/cedet/company.el#L2562 .
--000000000000df628805c43a1649--