[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#57693: 29.0.50; Is there a more reliable version of `char-displayabl
From: |
Ihor Radchenko |
Subject: |
bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'? |
Date: |
Sun, 11 Sep 2022 17:31:06 +0800 |
Eli Zaretskii <eliz@gnu.org> writes:
>> Yup. And I am asking if there is such test exposed to Elisp. Display
>> code certainly knows when some character cannot be displayed and must be
>> replaced by its hex code.
>
> The display engine only knows it retroactively, when it tried and
> failed to display a character.
The situation is similar to `string-pixel-width'.
Trying to display and checking retroactively should be a valid option,
unless I miss something.
>> This is not great. I am really hoping that we can make nicer defaults
>> when possible and only fallback to something robust when fancy version
>> cannot be used.
>
> I'm not sure I understand how this could be done even in principle.
> The conditions and restrictions you put forward can only be tested by
> trying to display the character at its specific place in a specific
> buffer and a specific window (because all of those can potentially
> affect the face and thus the font). We can code a function that
> emulates the display, but such a function can only work if the
> offending character was already inserted into its place and is part of
> buffer text. Is this something you'd consider good enough, to have to
> do something like
>
> insert the character
> call the new magic
> if the new magic says NO-CAN-DO
> replace the character with something else
>
> If the above is acceptable, I think it can be done, although it would
> not be very useful in other situations. But if you want to know the
> answer before you insert the character, I don't think we know how to
> satisfy your requirements with 100% accuracy. At least I cannot see
> how it could be done; maybe someone else will.
The described approach should be acceptable.
What I have in mind is a function like
(insert-displayable '("fancy version" "backup"))
The function will try to insert "fancy version" first; check if all the
characters are displayable, and replace the inserted text with "backup"
if not.
--
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, (continued)
bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Ihor Radchenko, 2022/09/10
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Eli Zaretskii, 2022/09/10
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Ihor Radchenko, 2022/09/10
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Eli Zaretskii, 2022/09/10
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Ihor Radchenko, 2022/09/10
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Eli Zaretskii, 2022/09/10
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?,
Ihor Radchenko <=
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Eli Zaretskii, 2022/09/11
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Eli Zaretskii, 2022/09/11
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Ihor Radchenko, 2022/09/12
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Eli Zaretskii, 2022/09/12
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Ihor Radchenko, 2022/09/12
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Eli Zaretskii, 2022/09/13
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Ihor Radchenko, 2022/09/13
- bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Eli Zaretskii, 2022/09/13
bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Ihor Radchenko, 2022/09/12
bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?, Robert Pluim, 2022/09/09