From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Display certain glyphs with paddings on the side Date: Tue, 3 Dec 2019 20:22:59 -0500 Message-ID: <7B97B0DA-7472-4410-B6B6-3C81F587D9EB@gmail.com> References: <87CA0401-1087-45C1-A952-DB8624C04D32@gmail.com> <83immylmpu.fsf@gnu.org> <83d0d5jom5.fsf@gnu.org> <83a789jk8c.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_8B198D7D-FB91-4EFC-87CE-D42B99995CAB" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="227043"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Eli Zaretskii , emacs-devel@gnu.org To: =?utf-8?Q?Cl=C3=A9ment_Pit-Claudel?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 04 03:05:45 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1icK2x-000wu1-9Z for ged-emacs-devel@m.gmane.org; Wed, 04 Dec 2019 03:05:43 +0100 Original-Received: from localhost ([::1]:33152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icK2v-00007d-PH for ged-emacs-devel@m.gmane.org; Tue, 03 Dec 2019 21:05:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50935) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icJNx-00012g-C1 for emacs-devel@gnu.org; Tue, 03 Dec 2019 20:23:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icJNq-0006Kz-BM for emacs-devel@gnu.org; Tue, 03 Dec 2019 20:23:17 -0500 Original-Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:46763) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icJNk-00061L-UY; Tue, 03 Dec 2019 20:23:09 -0500 Original-Received: by mail-qk1-x72f.google.com with SMTP id f5so5511048qkm.13; Tue, 03 Dec 2019 17:23:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=d0kFHJdol6oZR4Jaaq80g0m8uTi8IDJNhuSul2k4+j4=; b=u9UU+7hkjfUtUF/6FQBxzn2aL2Z9E52dBLyKnJuvXRv0dGfF/FYMQfkj78QMCXbQLD nnphzg7GOggl2HZSY7E2KvYl82lXvhIANjA1Yr5GDdFEanDrXYfinBpMM6yB8NWZ3jR/ BSu5NQk5daBhKztj6MHK/coOEPrmH/Md+N+K11fKYCQg+8jWA5HvfhZdGJHREjAjkW3f j5K6wg7E7i9DeUiLLE/nbGDpcvepKECtK3PihkhqtWwB496AVBv+S8CxlObzTOeMJmV4 GjrhqdqFGvfWKrrH7mD5ScUVPG0jwK1bDZAW7tuCjQF7RLcUnlUSuMgbSkYXuLIRiLDx qVCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=d0kFHJdol6oZR4Jaaq80g0m8uTi8IDJNhuSul2k4+j4=; b=MO83+AxPWAH7fbDAHarKIPLSASWo31NUUaMHPEe+XBAA/62wgD8sbGPn1PTZKXq1TB tRNXRSU4EcfmPs7EAbJ4x6K8Wr77w/lWwftXsMwA10EamoW/7a506+IMMH+QcAEtal6j UHsWM2NzUptEw8RsIXic1UHzXOZ361JaCoe0SLwqqVSVeCrd0LsAMxq75cG7Jb7wzyjT eHPEybIwxTAVP5K41sjT99TWQeXLD6wxmxo/+qHaWkdzQWZTzDurY9HtxUQ4DIl8oRYB TjOEA4SlVGdcT1Vjs0XcKwrukkbhUfQDcLBpWmvutOhaq2cByCAxSnDXRUGdGeeIGxW/ KSJw== X-Gm-Message-State: APjAAAWzbT0IqXlzP0Ng2RE15sbx6dBEsjvEYXmA6K4vC5xSfXzOV0N/ VxgudkEWvGZDzypBPwMiQIo= X-Google-Smtp-Source: APXvYqxPaXQQ9vrzZEgZOh4G2oOX+1+SAfMydPdMqhlnQzAJGqXuVpgz+/UFth2shJH17tfYlo4Irg== X-Received: by 2002:a37:4b06:: with SMTP id y6mr511574qka.14.1575422581228; Tue, 03 Dec 2019 17:23:01 -0800 (PST) Original-Received: from [192.168.1.5] (c-71-207-8-160.hsd1.pa.comcast.net. [71.207.8.160]) by smtp.gmail.com with ESMTPSA id 62sm2705628qkk.102.2019.12.03.17.23.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Dec 2019 17:23:00 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3601.0.10) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::72f 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243106 Archived-At: --Apple-Mail=_8B198D7D-FB91-4EFC-87CE-D42B99995CAB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 >=20 > Ideally, what I'd love to have is a mode that implements a grid-like = layout, where each character occupies an exact multiple of the base = character width, regardless of which font it comes from. >=20 > Deciding what this multiple should be for each character could be done = in various ways; for my purposes (and for OP's case as well, I think), = it would be enough to use one cell for halfwidth characters, two for = fullwidth characters, and add a few exceptions for things like TAB and = zero-width spaces (I'm using the terms fullwidth and halfwidth in the = sense of https://www.unicode.org/reports/tr11/ = ). >=20 Cl=C3=A9ment expressed the idea better than I could have. However, I=E2=80= =99d like to see it as a face attribute instead of a mode. (Because I = want to align my org table). Maybe there could be a face attribute = (:grid WIDTH) that instructs the display engine to pad each glyph to = have width that is a multiple of WIDTH in pixel, and if WIDTH is t, = default to =E2=80=9Cbase character width=E2=80=9D? I remembered that =E2=80=98window-width=E2=80=99 gives width in char = widths and had a look at its source. It knows the character width from = FRAME_COLUMN_WIDTH; the comment says the value currently equals to the = average width of the default font of the frame. I think this value can = be used as the =E2=80=9Cbase character width=E2=80=9D. Yuan --Apple-Mail=_8B198D7D-FB91-4EFC-87CE-D42B99995CAB Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Ideally, what I'd love to have is a mode that implements a = grid-like layout, where each character occupies an exact multiple of the = base character width, regardless of which font it comes from.

Deciding what this multiple should be for each character = could be done in various ways; for my purposes (and for OP's case as = well, I think), it would be enough to use one cell for halfwidth = characters, two for fullwidth characters, and add a few exceptions for = things like TAB and zero-width spaces (I'm using the terms fullwidth and = halfwidth in the sense of https://www.unicode.org/reports/tr11/).


Cl=C3=A9ment expressed the idea better than I could have. = However, I=E2=80=99d like to see it as a face attribute instead of a = mode. (Because I want to align my org table). Maybe there could be a = face attribute (:grid WIDTH) that instructs the display engine to pad = each glyph to have width that is a multiple of WIDTH in pixel, and if = WIDTH is t, default to =E2=80=9Cbase character = width=E2=80=9D?

I remembered = that =E2=80=98window-width=E2=80=99 gives width in char widths and = had a look at its source. It knows the character width from = FRAME_COLUMN_WIDTH; the comment says the value currently equals to the = average width of the default font of the frame. I think this value can = be used as the =E2=80=9Cbase character width=E2=80=9D.

Yuan

= --Apple-Mail=_8B198D7D-FB91-4EFC-87CE-D42B99995CAB--