From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jimmy Yuen Ho Wong Newsgroups: gmane.emacs.devel Subject: Re: Need `truncate-string-to-pixel-width` and `glyph-pixel-width` functions in C Date: Thu, 24 Oct 2024 16:33:14 +0100 Message-ID: References: <86sesndz8v.fsf@gnu.org> <86ed46en1q.fsf@gnu.org> <86seslddvs.fsf@gnu.org> <86msitd0oy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000b3963006253aba74" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="747"; 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 Thu Oct 24 17:34:43 2024 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 1t3zrH-00006G-8y for ged-emacs-devel@m.gmane-mx.org; Thu, 24 Oct 2024 17:34:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3zqV-0007Qv-Gz; Thu, 24 Oct 2024 11:33:55 -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 1t3zqU-0007Qe-3c for emacs-devel@gnu.org; Thu, 24 Oct 2024 11:33:54 -0400 Original-Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t3zqS-0000mL-Q8; Thu, 24 Oct 2024 11:33:53 -0400 Original-Received: by mail-qv1-xf2e.google.com with SMTP id 6a1803df08f44-6cbe700dcc3so5864486d6.3; Thu, 24 Oct 2024 08:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729784031; x=1730388831; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=30aR2Z3U0RQUwiKZ11m7NLCeAE2Fj0mQLVvyvU2hMpM=; b=gNpFpEwM7KrHajj+b1MldEaZwiEXOkWXBCSwmzZptOrLmp6Um4BJF/Ic1dHWmtd18+ j46bFNq2VcNsBS/RBnpkj6boiTQJK+tqPCHxO8RPnPJBg2GNoZVTTbyE4h0+JvWQ0pxN oN+Vm7b+eIh9ljZXIoprVmp0A6GOzID/sde06cTVNirwtiJGz4U0spCY54lm4WHS5TQ1 2UDjrzA3cVaM4Q/pAlPUvUCyJSbA8L5OoykjSlRDzL/maAtMAhDdKonmdEmsCgtNbZ38 8q/6F8oBS5pM85QV6D+jx3VKTW2Gfh2VCsxXMhfR7n6PbhnhfQ8eySRKharuW/oak3ZU NmLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729784031; x=1730388831; h=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=30aR2Z3U0RQUwiKZ11m7NLCeAE2Fj0mQLVvyvU2hMpM=; b=Jl8l6b5LK4SlSqTjuxer63iPZ+W91zYNJSJV+xzHPQUoUmS2T1o5AQOMm9qgsxpd1l FeqQ0hQHFHCupQ6IwWaHqMgeafc+ZSN7MLJck6mD1sNY2DCYMX+SUPGklN6H2zoJVkE0 lv2Zz0YOJ0IQocO5IuRp5op7T79bLZj2ACQt+cTorDVCbtE72V5froG3BicJ8Jml+O/W +YTpbLv+mm8uDPDrjb68UedLl38h29py5r44thAPgFVL3kvTm4Y+DliJedPBdynyPOxv qfQyqGBlVkShOxZq0S8kfw3E7OAUJ8yfHN6vRots7M+IWJmUnr0XRl34BHAvZ9XMOgqk xk0A== X-Gm-Message-State: AOJu0YxAphbkCtSjMFMIzZCq8xUR8gdKvx2wV0cUR4uGun5IqLH/H4Rs sfZlXL/rKLTykgrE0MRGeYoZ0vwVyQuoxlXkE/FnWHR7qYYpF5GIqIXrQ1YC94sAtGzPYyw99/F EAmKK4jlIFqcbhJgKB/UUIXp/2N2iGg== X-Google-Smtp-Source: AGHT+IEwVNnED/Py4KC606A/rNQt+UZRyNEvqEfit3WLARYycAXY581EBML13yB0lwIzmNomA/tCFsIRvPL5wO09JoU= X-Received: by 2002:a05:6214:4b12:b0:6cb:e9eb:1b24 with SMTP id 6a1803df08f44-6d08efd53famr23075406d6.24.1729784030923; Thu, 24 Oct 2024 08:33:50 -0700 (PDT) In-Reply-To: <86msitd0oy.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::f2e; envelope-from=wyuenho@gmail.com; helo=mail-qv1-xf2e.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.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:324822 Archived-At: --000000000000b3963006253aba74 Content-Type: text/plain; charset="UTF-8" > > If the scroll bar and the margin are generated programmatically, then > presumably the program which creates them knows their width, or can > calculate that? If so, the :align-to value should take that into > consideration. > As I said, the problem is letting the window system do the truncation rather than in code. There's no way to tell Emacs to start truncating from the actual content rather than UI elements that Emacs thinks are content. Hence, the original ask. Correct and performant custom truncation that respects pixel width is much much harder than it should be in Emacs. --000000000000b3963006253aba74 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
If the scroll bar and the margin are generated programma= tically, then
presumably the program which creates them knows their width, or can
calculate that?=C2=A0 If so, the :align-to value should take that into
consideration.

As I said, the problem is letting t= he window system do the truncation rather than in code. There's no way = to tell Emacs to start truncating from the actual content rather than UI el= ements that Emacs thinks are content. Hence, the original ask. Correct and = performant custom truncation that respects pixel width is much much harder = than it should be in Emacs.
--000000000000b3963006253aba74--