Hello, During some experiments to use `char-property-alias-alist', I discovered that `string-pixel-width' could return wrong results with alternative properties that affect how the string is displayed. Here is a simple recipe to eval in the *scratch* buffer, that illustrates the issue: (let ((text0 (propertize "This text" 'face 'variable-pitch)) (text1 (propertize "This text" 'my-face 'variable-pitch))) (with-temp-buffer (setq-local char-property-alias-alist '((face my-face))) (list (string-pixel-width text0 (current-buffer)) (string-pixel-width text1 (current-buffer))))) Normally the result should be a list of two identical numbers. But, on my config, the result is (89 117) instead of expected (89 89). This problem is similar to the already solved case with `face-remapping-alist', as is the solution. I propose the attached patch to fix this and slightly simplify the code. On my configuration, the new code has no significant impact on performance. The patch also includes several tests of `string-pixel-width' that could be added to test/lisp/misc-test.el. As expected with the current implementation, all tests pass but the test `misc-test-string-pixel-width-char-property-alias-alist'. With the patch applied, all tests pass: ----------------------- emacs -batch -l ./test/lisp/misc-tests.el -f ert-run-tests-batch-and-exit [...] passed 6/11 misc-test-string-pixel-width-char-property-alias-alist (0.001030 sec) passed 7/11 misc-test-string-pixel-width-display-line-numbers (0.000057 sec) passed 8/11 misc-test-string-pixel-width-face-remapping-alist (0.000065 sec) passed 9/11 misc-test-string-pixel-width-line-and-wrap-prefix (0.000240 sec) [...] ----------------------- Here is a possible Change log: 2025-03-15 David Ponce Fix possible wrong result of `string-pixel-width' with alternate properties. Create regression tests. * lisp/emacs-lisp/subr-x.el (string-pixel-width): Like for `face-remapping-alist', use in work buffer the value of `char-property-alias-alist' local to the passed buffer, to correctly compute pixel width. * test/lisp/misc-tests.el: Add tests for `string-pixel-width'. Thanks