Subject: bug#28795: 25.2; UTF-8 language environment causes extreme sluggishness

From: Eli Zaretskii <[email-masked]>
Date: Thu, 12 Oct 2017 14:55:44 +0300

> From: Mark Laws <[email-masked]>
> Date: Thu, 12 Oct 2017 19:31:57 +0900
> Cc: [email-masked]
> 
> > And which font is used if you don't set your language-environment to
> > UTF-8?
> 
> uniscribe:-outline-Malgun
> Gothic-bold-normal-normal-sans-15-*-*-*-p-*-ksc5601.1987-0 (#xF7)

OK, so now we know why you get slow redisplay only with UTF-8 as
language-environment: doing that changes the preferred charset, which
affects font selection (Malgun Gothic is for the Korean character set,
as you see from the end of its spec, so it is rejected when the
preferred charset is unicode-bmp or Unicode).

> If I use (prefer-coding-system 'utf-8), I do not get the slowness
> anymore, even if inhibit-compacting-font-caches is nil, and even after
> propertizing the text. However, the font changes from PragmataPro Mono
> to Malgun Gothic, which seems odd too.

Why is that odd?  Emacs selects fonts according to what it thinks is
the user's preferences, and by default those preferences are deduced
from the culture defined in the environment.

> if I use both (set-locale-environment "English") and
> (prefer-coding-system 'utf-8), the issue returns.

"English" nowadays defaults to Unicode as well.

In general, there should be no reason for you to set a non-default
language-environment on Windows, because Emacs takes that from your
system's setup.  If you just want to control the default encodings,
use prefer-coding-system, its effect is limited to encodings, and
doesn't change anything else.

Is there any other problem left to solve, or we can close this bug
report?