bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Eli Zaretskii
Subject: bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'?
Date: Fri, 09 Sep 2022 16:38:49 +0300

> From: Ihor Radchenko <yantar92@gmail.com>
> Date: Fri, 09 Sep 2022 21:25:35 +0800
> 
> In Org, we have recently had a need to check if a Unicode character can
> be displayed in buffer.
> 
> We used the following:
> (...
>   (if (and (display-graphic-p)
>            (char-displayable-p ?⭠)
>            (char-displayable-p ?─))
>       "⭠ now ───────────────────────────────────────────────"
>     "now - - - - - - - - - - - - - - - - - - - - - - - - -")
> ...)
> 
> However, char-displayable-p returned false-positive for one user:
> https://list.orgmode.org/orgmode/87mtddhprr.fsf@localhost/ 
> 
> False-positives are indeed not unexpected in char-displayable-p; just as
> its docstring warns. However, I am now wondering if there is some more
> accurate way to know if a character can be actually displayed on buffer
> or not.

I'd need to know more details.  Why did this test fail for that user?

Also, what exactly does the test above intend to test?  Are you
interested in whether this character can be displayed at all,
regardless of which font is to be used, or do you want it to be
displayed with the default face's font?

To answer your question: the most accurate way is to actually try
displaying the character and see if that works.  Not sure if it helps
you, though especially since that code is in a defcustom, AFAIU.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]