unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* how to detect that current font does not have particular unicode char
@ 2020-12-19  8:54 yyoncho
  2020-12-19  9:18 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: yyoncho @ 2020-12-19  8:54 UTC (permalink / raw)
  To: emacs-devel

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

Hi,

I am trying to implement an automatic fallback if the user has configured a
font that does not have a particular unicode char (e. g. “💡” (U+1F4A1)). I
tried to use char-displayable-p but it seems like it is not what I am
looking for.

Thanks,
Ivan

[-- Attachment #2: Type: text/html, Size: 346 bytes --]

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

* Re: how to detect that current font does not have particular unicode char
  2020-12-19  8:54 how to detect that current font does not have particular unicode char yyoncho
@ 2020-12-19  9:18 ` Eli Zaretskii
  2020-12-19 11:33   ` yyoncho
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2020-12-19  9:18 UTC (permalink / raw)
  To: yyoncho; +Cc: emacs-devel

> From: yyoncho <yyoncho@gmail.com>
> Date: Sat, 19 Dec 2020 10:54:35 +0200
> 
> I am trying to implement an automatic fallback if the user has configured a font that does not have a
> particular unicode char (e. g. “💡” (U+1F4A1)).

What kind of fallback?  IOW, what did you intend to do if you find out
that the font configured by the user does NOT have a glyph for the
character in question?

I'm asking because some fallbacks don't need to know whether a
particular font can display a particular character.  But I'm not sure
those fallbacks are appropriate for your use case.

> I tried to use char-displayable-p but it seems like it is not
> what I am looking for.

I believe you want font-get-glyphs.



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

* Re: how to detect that current font does not have particular unicode char
  2020-12-19  9:18 ` Eli Zaretskii
@ 2020-12-19 11:33   ` yyoncho
  2020-12-19 12:00     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: yyoncho @ 2020-12-19 11:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

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

Thank you for your reply.

What kind of fallback?


I want to detect if char is visible and use a different one. E. g. bulb can
be replaced with "!".


> IOW, what did you intend to do if you find out
> that the font configured by the user does NOT have a glyph for the
> character in question?
>

Yes.


> I'm asking because some fallbacks don't need to know whether a
> particular font can display a particular character.  But I'm not sure
> those fallbacks are appropriate for your use case.
>
> > I tried to use char-displayable-p but it seems like it is not
> > what I am looking for.
>
> I believe you want font-get-glyphs.
>

I will try that out. I am not sure what FONT-OBJECT parameter stands for?

Thanks,
Ivan

[-- Attachment #2: Type: text/html, Size: 1410 bytes --]

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

* Re: how to detect that current font does not have particular unicode char
  2020-12-19 11:33   ` yyoncho
@ 2020-12-19 12:00     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2020-12-19 12:00 UTC (permalink / raw)
  To: yyoncho; +Cc: emacs-devel

> From: yyoncho <yyoncho@gmail.com>
> Date: Sat, 19 Dec 2020 13:33:05 +0200
> Cc: emacs-devel <emacs-devel@gnu.org>
> 
>  What kind of fallback?  
> 
> I want to detect if char is visible and use a different one. E. g. bulb can be replaced with "!". 

But that's misleading, isn't it?  The user could think the character
really was "!".

You could instead set up the glyphless-char-display char-table to have
"!" in the slot for U+1F4A1, then Emacs will display the "!" character
inside a box, which at least cannot dupe the user.

>  > I tried to use char-displayable-p but it seems like it is not
>  > what I am looking for.
> 
>  I believe you want font-get-glyphs.
> 
> I will try that out. I am not sure what FONT-OBJECT parameter stands for?

The return value of one of functions that return such objects.  I
think in your case font-at will be useful in that role.



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

end of thread, other threads:[~2020-12-19 12:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-19  8:54 how to detect that current font does not have particular unicode char yyoncho
2020-12-19  9:18 ` Eli Zaretskii
2020-12-19 11:33   ` yyoncho
2020-12-19 12:00     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).