diff options
author | Po Lu <luangruo@yahoo.com> | 2023-02-19 23:33:19 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2023-02-19 23:33:19 +0800 |
commit | 1727777a46cb28711720faed2f66d195e5973368 (patch) | |
tree | 87b5bb27358b3eb10a100f415deb9cd4e717adf9 /src/fontset.c | |
parent | e5232fc0e508464533f783d6c03bf1aec29a58e5 (diff) | |
download | emacs-1727777a46cb28711720faed2f66d195e5973368.tar.gz |
Match font registry after font is opened
* src/fontset.c (fontset_find_font): Work around TrueType
performance problem.
Diffstat (limited to 'src/fontset.c')
-rw-r--r-- | src/fontset.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/fontset.c b/src/fontset.c index f196dee8259..8182d639299 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -667,8 +667,29 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, } font_object = font_open_for_lface (f, font_entity, face->lface, FONT_DEF_SPEC (font_def)); + + /* If the font registry is not the same as explicitly + specified in the font spec, do not cache the font. + TrueType fonts have contrived character map selection + semantics which makes determining the repertory at font + spec matching time unduly expensive. */ + + { + Lisp_Object spec; + + spec = FONT_DEF_SPEC (font_def); + + if (!NILP (font_object) + && !NILP (AREF (spec, FONT_REGISTRY_INDEX)) + && !NILP (AREF (font_object, FONT_REGISTRY_INDEX)) + && !EQ (AREF (spec, FONT_REGISTRY_INDEX), + AREF (font_object, FONT_REGISTRY_INDEX))) + goto strangeness; + } + if (NILP (font_object)) { + strangeness: /* Something strange happened, perhaps because of a Font-backend problem. To avoid crashing, record that this spec is unusable. It may be better to find |