all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#52118: 29.0.50; string-pixel-width reports incorrect width
@ 2021-11-26  0:51 Arthur Miller
  2021-11-26 13:41 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Arthur Miller @ 2021-11-26  0:51 UTC (permalink / raw)
  To: 52118

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]


Attached is small lisp program and a screenshot of the output. From the
screenshot itself it is visible that for string with large non-default font-size
the reported width is erroneous. It should be close to frame/window size
in this particular example, but reported size is missing ~500 pixels.

For small sizes it seems to report relatively ok. The clock is ~70 pixels
according to Gimp's measure tool, +/- some, so it is more visible with big sizes.


[-- Attachment #2: string-pixel-width.png --]
[-- Type: image/png, Size: 33974 bytes --]

[-- Attachment #3: emacs-vision-clock.el --]
[-- Type: text/plain, Size: 5189 bytes --]

;;; emacs-vision-clock.el ---  -*- lexical-binding: t; -*-

;; Copyright (C) 2021  Arthur Miller

;; Author: Arthur Miller <arthur.miller@live.com>
;; Keywords: 

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; https://github.com/BobbyBakes/conky-Vision
\f
;;; Code:
(require 'time-stamp)

(defgroup emacs-vision-clock nil
  "Conky like clock application written in Emacs Lisp."
  :prefix "evc--"
  :prefix "emacs-vision-clock-"
  :tag "Conky-Vision style clock as Emacs application."
  :group 'applications)
\f
;;; Customize
(defcustom emacs-vision-clock-x -100
  "Frame width"
  :type 'fixnum
  :group 'emacs-vision-clock)

(defcustom emacs-vision-clock-y 100
  "Frame width"
  :type 'fixnum
  :group 'emacs-vision-clock)

(defface emacs-vision-clock-date-face
  '((t :weight light :family "Open Sans" :default nil
       :foreground "white" :height 540))
  "Default face for emacs-vision-clock frame."
  :group 'emacs-vision-clock)

(defface emacs-vision-clock-time-face
  '((t :weight light :family "Open Sans" :default nil
       :foreground "white" :height 200))
  "Default face for emacs-vision-clock frame."
  :group 'emacs-vision-clock)
\f
;;; Implementation
(defvar evc--frame nil)
(defvar evc--timer nil)
(defvar evc--buffer nil)
(defvar evc--date-face 'emacs-vision-clock-date-face)
(defvar evc--time-face 'emacs-vision-clock-time-face)

(defface evc--debug-face
  '((t :weight light :family "Open Sans" :default nil
       :foreground "white" :height 200))
  "Default face for emacs-vision-clock frame."
  :group 'emacs-vision-clock)

(defun evc--fmtdbg (&rest args)
  (propertize (apply 'format args) 'face 'evc--debug-face))

(defun evc--time ()
  (propertize
   (time-stamp-string "%H:%M") 'face evc--time-face))

(defun evc--date ()
  (propertize
   (concat
    (capitalize (time-stamp-string "%A")) ". "
    (capitalize (time-stamp-string "%B %d"))) 'face evc--date-face))

(defun evc--make-frame ()
  (make-frame `((name . "*emacs-vision-clock*")
                (left . ,emacs-vision-clock-x)
                (top . ,emacs-vision-clock-y)
                ;;(alpha-background . 0)
                (tool-bar-lines . 0)
                (menu-bar-lines . 0)
                (minibuffer . nil)
                (right-fringe . 0)
                (left-fringe . 0)
                (horizontal-scroll-bars . nil)
                (vertical-scroll-bars . nil)
                (border-width . 0)
                (internal-border-width . 0)
                (no-special-glyphs . t)
                (visibility . nil)
                (z-group . below)
                (auto-raise . nil)
                (skip-taskbar . t)
                (no-focus-on-map . t)
                (no-accept-focus . t)
                (unsplittable . t)
                (undecorated . t))))

(defun evc--update ()
  (let ((frame evc--frame)
        (buffer evc--buffer)
        (window (get-buffer-window evc--buffer))
        (time (evc--time))
        (date (evc--date)))
      (select-frame frame)
    (with-current-buffer buffer
      (erase-buffer)
      (insert time "\n" date)
      (let* ((wndw (window-pixel-width window))
             (frmw (frame-pixel-width frame))
             (tlen (string-pixel-width time))
             (dlen (string-pixel-width date)))
        (insert "\n"
                (evc--fmtdbg "\nFrame width: %s" frmw)
                (evc--fmtdbg "\nWindow width: %s" wndw)
                (evc--fmtdbg "\nTime string width %s" tlen)
                (evc--fmtdbg "\nDate string width %s" dlen))
        (fit-frame-to-buffer)
        (goto-char 1)
        ))))

(defun evc--make-buffer ()
  (with-current-buffer (get-buffer-create "  *emacs-vision-clock*")
    (setq cursor-in-non-selected-windows nil mode-line-format nil)
    (setq evc--buffer (current-buffer))))

(defun evc--make-widget ()
  (let ((frame (evc--make-frame)))
    (evc--make-buffer)
    (select-frame frame)
    (switch-to-buffer evc--buffer)
    (delete-other-windows)
    (evc--update)
    (fit-frame-to-buffer)
    (make-frame-visible frame)
    (set-window-dedicated-p (selected-window) t)
    (setq evc--frame frame evc--timer (run-at-time nil 60 #'evc--update))))
\f
;;; Public commands
(defun emacs-vision-clock-run ()
  (interactive)
  (unless evc--frame
    (evc--make-widget)))

(defun emacs-vision-clock-stop ()
  (interactive)
  (if evc--timer (cancel-timer evc--timer))
  (if evc--frame (delete-frame evc--frame))
  (if evc--buffer (kill-buffer evc--buffer))
  (setq evc--buffer nil evc--frame nil evc--timer nil))

(provide 'emacs-vision-clock)
;;; emacs-vision-clock.el ends here

[-- Attachment #4: Type: text/plain, Size: 14238 bytes --]











In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4)
 of 2021-11-17 built on pascal
Repository revision: 1ddebefc9fe178e9e8b4275a45e0eda1bcf7848e
Repository branch: alpha-patch
Windowing system distributor 'The X.Org Foundation', version 11.0.12101001
System Description: Arch Linux

Configured using:
 'configure --with-native-compilation 'CFLAGS=-O2 -march=native -mtune=native''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE
XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: sv_SE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  text-scale-mode: t
  windmove-mode: t
  beacon-mode: t
  outshine-mode: t
  dired-async-mode: t
  outline-minor-mode: t
  yas-minor-mode: t
  page-break-lines-mode: t
  company-mode: t
  electric-pair-mode: t
  global-auto-revert-mode: t
  global-hl-line-mode: t
  global-subword-mode: t
  subword-mode: t
  auto-image-file-mode: t
  auto-insert-mode: t
  display-time-mode: t
  delete-selection-mode: t
  save-place-mode: t
  winner-mode: t
  which-key-mode: t
  wrap-region-global-mode: t
  wrap-region-mode: t
  helm-mode: t
  helm-adaptive-mode: t
  shell-dirtrack-mode: t
  helm-autoresize-mode: t
  helm--remap-mouse-mode: t
  async-bytecomp-package-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: yas--auto-fill
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
/home/arthur/repos/emacs/lisp/transient hides /home/arthur/.emacs.d/elpa/transient-20210723.1601/transient
/home/arthur/.emacs.d/elpa/lispy-20210914.1209/elpa hides /home/arthur/.emacs.d/elpa/ivy-20210930.1450/elpa
/home/arthur/repos/emacs/lisp/emacs-lisp/helper hides /home/arthur/.emacs.d/elpa/helper-0.5/helper
/home/arthur/.emacs.d/lisp/helm-git-branch hides /home/arthur/.emacs.d/elpa/helm-git-branch-0.1/helm-git-branch
/usr/local/share/emacs/site-lisp/emms/emms-cue hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-cue
/usr/local/share/emacs/site-lisp/emms/emms-info-ogginfo hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info-ogginfo
/usr/local/share/emacs/site-lisp/emms/emms-mark hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-mark
/usr/local/share/emacs/site-lisp/emms/emms-last-played hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-last-played
/usr/local/share/emacs/site-lisp/emms/emms-player-mpg321-remote hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-mpg321-remote
/usr/local/share/emacs/site-lisp/emms/emms-score hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-score
/usr/local/share/emacs/site-lisp/emms/emms-player-mpd hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-mpd
/usr/local/share/emacs/site-lisp/emms/emms-show-all hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-show-all
/usr/local/share/emacs/site-lisp/emms/emms-setup hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-setup
/usr/local/share/emacs/site-lisp/emms/emms-playlist-sort hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-playlist-sort
/usr/local/share/emacs/site-lisp/emms/emms hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms
/usr/local/share/emacs/site-lisp/emms/emms-info-mp3info hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info-mp3info
/usr/local/share/emacs/site-lisp/emms/emms-source-playlist hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-source-playlist
/usr/local/share/emacs/site-lisp/emms/emms-cache hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-cache
/usr/local/share/emacs/site-lisp/emms/emms-volume hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-volume
/usr/local/share/emacs/site-lisp/emms/emms-playing-time hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-playing-time
/usr/local/share/emacs/site-lisp/emms/emms-tag-editor hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-tag-editor
/usr/local/share/emacs/site-lisp/emms/emms-source-file hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-source-file
/usr/local/share/emacs/site-lisp/emms/emms-bookmarks hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-bookmarks
/usr/local/share/emacs/site-lisp/emms/emms-player-simple hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-simple
/usr/local/share/emacs/site-lisp/emms/emms-player-xine hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-xine
/usr/local/share/emacs/site-lisp/emms/emms-librefm-stream hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-librefm-stream
/usr/local/share/emacs/site-lisp/emms/emms-browser hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-browser
/usr/local/share/emacs/site-lisp/emms/emms-maint hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-maint
/usr/local/share/emacs/site-lisp/emms/emms-playlist-mode hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-playlist-mode
/usr/local/share/emacs/site-lisp/emms/emms-url hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-url
/usr/local/share/emacs/site-lisp/emms/emms-streams hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-streams
/usr/local/share/emacs/site-lisp/emms/emms-info-opusinfo hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info-opusinfo
/usr/local/share/emacs/site-lisp/emms/emms-mode-line hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-mode-line
/usr/local/share/emacs/site-lisp/emms/emms-player-mplayer hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-mplayer
/usr/local/share/emacs/site-lisp/emms/emms-info hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info
/usr/local/share/emacs/site-lisp/emms/emms-librefm-scrobbler hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-librefm-scrobbler
/usr/local/share/emacs/site-lisp/emms/emms-info-libtag hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info-libtag
/usr/local/share/emacs/site-lisp/emms/emms-info-metaflac hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-info-metaflac
/usr/local/share/emacs/site-lisp/emms/emms-metaplaylist-mode hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-metaplaylist-mode
/usr/local/share/emacs/site-lisp/emms/emms-compat hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-compat
/usr/local/share/emacs/site-lisp/emms/emms-volume-pulse hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-volume-pulse
/usr/local/share/emacs/site-lisp/emms/emms-player-mpv hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-mpv
/usr/local/share/emacs/site-lisp/emms/emms-playlist-limit hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-playlist-limit
/usr/local/share/emacs/site-lisp/emms/emms-history hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-history
/usr/local/share/emacs/site-lisp/emms/emms-player-vlc hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-player-vlc
/usr/local/share/emacs/site-lisp/emms/emms-mode-line-icon hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-mode-line-icon
/usr/local/share/emacs/site-lisp/emms/emms-lyrics hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-lyrics
/usr/local/share/emacs/site-lisp/emms/emms-stream-info hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-stream-info
/usr/local/share/emacs/site-lisp/emms/emms-volume-amixer hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-volume-amixer
/usr/local/share/emacs/site-lisp/emms/emms-i18n hides /home/arthur/.emacs.d/elpa/emms-20210911.2031/emms-i18n
/home/arthur/.emacs.d/elpa/elisp-refs-20211009.1531/elisp-refs hides /home/arthur/.emacs.d/elpa/elisp-refs-1.4/elisp-refs
/home/arthur/.emacs.d/elpa/elisp-refs-20211009.1531/elisp-refs-autoloads hides /home/arthur/.emacs.d/elpa/elisp-refs-1.4/elisp-refs-autoloads
/home/arthur/.emacs.d/elpa/elisp-refs-20211009.1531/elisp-refs-pkg hides /home/arthur/.emacs.d/elpa/elisp-refs-1.4/elisp-refs-pkg
/home/arthur/.emacs.d/lisp/company-cmake hides /home/arthur/.emacs.d/elpa/company-20211002.1732/company-cmake

Features:
(shadow mail-extr emacsbug sendmail misearch multi-isearch cl-print debug qp
gnus-async gnus-ml gnus-topic cursor-sensor url-cache benchmark nndraft nnmh
nnhackernews anaphora request gnus-bcklg gnus-cite nnfolder utf-7 gnutls
network-stream gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg
nntp gnus-cache avy magit-utils crm face-remap shortdoc windmove cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
mule-util helpful trace info-look help-fns radix-tree elisp-refs helm-command
emacs-vision-clock time-stamp vc-git diff-mode vc-dispatcher org-pretty-table
ol-eww eww xdg url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-search eieio-opt speedbar ezimage dframe gnus-art mm-uu mml2015 mm-view
mml-smime smime dig gnus-sum shr kinsoku svg dom gnus-group gnus-undo gnus-start
gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo gnus-spec
gnus-int gnus-range message yank-media rfc822 mml mml-sec epa epg rfc6068
epg-config mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader
gnus-win ol-docview doc-view ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi
dired-auto-readme helm-external helm-net tramp-archive tramp-gvfs tramp-cache
zeroconf dbus ffap beacon emms-librefm-stream xml emms-librefm-scrobbler
emms-i18n emms-history emms-score emms-stream-info emms-metaplaylist-mode
emms-bookmarks emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort
emms-last-played emms-player-xine emms-player-mpd emms-lyrics emms-url
emms-streams emms-show-all emms-tag-editor emms-mark emms-cache
emms-info-opusinfo emms-info-ogginfo emms-info-mp3info emms-player-vlc
emms-player-mplayer emms-player-mpv emms-mode-line-cycle emms-mode-line
emms-playing-time emms-player-simple emms-info later-do emms-playlist-limit
emms-volume emms-volume-amixer emms-playlist-mode emms-source-playlist
emms-source-file locate emms-setup emms emms-compat c++-setup sv-kalender lunar
solar cal-dst holidays hol-loaddefs extras recentf tree-widget server overseer
pkg-info url-http url-auth url-gw nsm rmc puny epl f s outshine
outshine-org-cmds outorg org-protocol org-pdftools pdf-occur pdf-isearch
let-alist pdf-annot tablist tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic semantic/tag
semantic/lex semantic/fw mode-local cedet facemenu pdf-misc imenu pdf-tools
cus-edit cus-start cus-load pdf-view bookmark pp jka-compr pdf-cache pdf-info tq
pdf-util pdf-macs image-mode dired-extras dired-copy-paste dired-subtree
dired-hacks-utils openwith dired-x wdired dired-async dired-aux dired
dired-loaddefs exif org-noter org-element avl-tree org-refile org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp ob-core
ob-eval org-table oc-basic bibtex ol org-keys oc org-compat org-macs
org-loaddefs cal-menu calendar cal-loaddefs noutline outline yasnippet-snippets
yasnippet derived disp-table page-break-lines company-yasnippet company-ispell
ispell company-clang company-elisp company-etags etags fileloop generator xref
project company-semantic company-template company-keywords company-files
company-capf company pcase comp comp-cstr warnings rx cl-extra elec-pair
autorevert hl-line cap-words superword subword image-file image-converter
autoinsert time delsel saveplace winner which-key advice solarized-dark-theme
solarized solarized-faces color wrap-region dash gnus nnheader gnus-util rmail
rmail-loaddefs mail-utils wid-edit helm-mode helm-adaptive helm-projectile
projectile lisp-mnt mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr grep compile text-property-search ibuf-ext ibuffer ibuffer-loaddefs
thingatpt helm-eshell helm-elisp helm-files filenotify tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat shell pcomplete comint
ansi-color parse-time iso8601 time-date ls-lisp helm-buffers helm-occur
helm-tags helm-locate helm-eval edebug backtrace find-func helm-info ring
helm-types helm-config diminish helm-pages helm-grep helm-regexp help-mode
helm-utils helm-help format-spec helm easy-mmode async-bytecomp
helm-global-bindings edmacro kmacro helm-source helm-multi-match helm-lib async
elisp-extras popup helm-easymenu cl info package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map url-vars seq gv subr-x byte-opt bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse
jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process native-compile emacs)

Memory information:

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#52118: 29.0.50; string-pixel-width reports incorrect width
  2021-11-26  0:51 bug#52118: 29.0.50; string-pixel-width reports incorrect width Arthur Miller
@ 2021-11-26 13:41 ` Lars Ingebrigtsen
  2021-11-26 13:46   ` Arthur Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-26 13:41 UTC (permalink / raw)
  To: Arthur Miller; +Cc: 52118

Arthur Miller <arthur.miller@live.com> writes:

> Attached is small lisp program and a screenshot of the output. From the
> screenshot itself it is visible that for string with large non-default font-size
> the reported width is erroneous. It should be close to frame/window size
> in this particular example, but reported size is missing ~500 pixels.

Seems to be working OK for me:

(string-pixel-width
 (propertize "foo" 'face '(:height 500 :background "red")))
=> 300

(string-pixel-width
 (propertize "foo" 'face '(:height 5000 :background "red")))
=> 2997

But you seem to be using an old version, and not from the Emacs repo?

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4)
 of 2021-11-17 built on pascal
Repository revision: 1ddebefc9fe178e9e8b4275a45e0eda1bcf7848e
Repository branch: alpha-patch

`string-pixel-width' was rewritten recently.  Could you try a fresh
checkout and see whether the problem is still present?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#52118: 29.0.50; string-pixel-width reports incorrect width
  2021-11-26 13:41 ` Lars Ingebrigtsen
@ 2021-11-26 13:46   ` Arthur Miller
  2021-11-26 13:47     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Arthur Miller @ 2021-11-26 13:46 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52118

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Arthur Miller <arthur.miller@live.com> writes:
>
>> Attached is small lisp program and a screenshot of the output. From the
>> screenshot itself it is visible that for string with large non-default font-size
>> the reported width is erroneous. It should be close to frame/window size
>> in this particular example, but reported size is missing ~500 pixels.
>
> Seems to be working OK for me:
>
> (string-pixel-width
>  (propertize "foo" 'face '(:height 500 :background "red")))
> => 300
>
> (string-pixel-width
>  (propertize "foo" 'face '(:height 5000 :background "red")))
> => 2997
>
> But you seem to be using an old version, and not from the Emacs repo?
>
> In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4)
>  of 2021-11-17 built on pascal
> Repository revision: 1ddebefc9fe178e9e8b4275a45e0eda1bcf7848e
> Repository branch: alpha-patch

:) Yes, like a week old :).

> `string-pixel-width' was rewritten recently.  Could you try a fresh
> checkout and see whether the problem is still present?

Allright. I haven't had time to pull and rebuild; I'll try and come back when I
rebuild it.

Thanks for the info.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#52118: 29.0.50; string-pixel-width reports incorrect width
  2021-11-26 13:46   ` Arthur Miller
@ 2021-11-26 13:47     ` Lars Ingebrigtsen
  2021-11-26 14:36       ` Arthur Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-26 13:47 UTC (permalink / raw)
  To: Arthur Miller; +Cc: 52118

Arthur Miller <arthur.miller@live.com> writes:

> :) Yes, like a week old :).

That's like a decade in vim development years.  😀

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#52118: 29.0.50; string-pixel-width reports incorrect width
  2021-11-26 13:47     ` Lars Ingebrigtsen
@ 2021-11-26 14:36       ` Arthur Miller
  2021-11-26 16:17         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Arthur Miller @ 2021-11-26 14:36 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52118

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Arthur Miller <arthur.miller@live.com> writes:
>
>> :) Yes, like a week old :).
>
> That's like a decade in vim development years.  😀

Indeed; I should have known better before reporting a bug :).

Seems it works well.

Hopefully I can align two string to center now, without doing entire calculus in
custom code.


[-- Attachment #2: string-width-rebuild.png --]
[-- Type: image/png, Size: 34028 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#52118: 29.0.50; string-pixel-width reports incorrect width
  2021-11-26 14:36       ` Arthur Miller
@ 2021-11-26 16:17         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-26 16:17 UTC (permalink / raw)
  To: Arthur Miller; +Cc: 52118

Arthur Miller <arthur.miller@live.com> writes:

> Indeed; I should have known better before reporting a bug :).
>
> Seems it works well.

Thanks for checking; I'm closing this bug report, then.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-26 16:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-26  0:51 bug#52118: 29.0.50; string-pixel-width reports incorrect width Arthur Miller
2021-11-26 13:41 ` Lars Ingebrigtsen
2021-11-26 13:46   ` Arthur Miller
2021-11-26 13:47     ` Lars Ingebrigtsen
2021-11-26 14:36       ` Arthur Miller
2021-11-26 16:17         ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.