Subject: Re: bug#73159: 30.0.90; uniscribe / harfbuzz are not initialized on Windows, resulting in fallback to gdi

From: Eli Zaretskii <[email-masked]>
Date: Tue, 10 Sep 2024 15:20:54 +0300

> From: Casey Banner <[email-masked]>
> Date: Tue, 10 Sep 2024 00:15:24 -0400
> 
> I recently pulled the latest emacs-30 branch (f47297782bdb5e5a07e02f119c8013d11f7d7fae), 
> and I'm building emacs using MSYS2 mingw64 on Windows.
> 
> With a build on this branch, certain symbols (from the nerd-icons
> package) were rendering as boxes and not their actual symbol. I
> suspected that this was because gdi was being used, and indeed using
> describe-char on any character shows me a font starting with
> `gdi:`, indicating the uniscribe or harfbuzz are not being used.
> 
> This is not the case on the emacs-29 branch, where I see `uniscribe:`
> instead (and the symbols render correctly). I was not able to get
> harfbuzz to load on that branch, which is why I was trying emacs-30
> to see if something was different there.
> 
> To investigate this, I first used procmon to look at the syscalls to
> see if anything was trying to load libharfbuzz-0.dll, and I did see it
> in the trace I took, however the callstack was an OS callstack, and not
> from where I expected (src\w32uniscribe.c:syms_of_w32uniscribe_for_pdumber).

Where did you get the libharfbuzz-0.dll file you have installed?
Is libharfbuzz-0.dll in a directory that is on Path or in the same
directory as emacs.exe you are running?
And what does the commend below print?

  objdump -x /path/to/libharfbuzz-0.dll | grep "DLL Name":

The main problem you have is that Emacs is somehow unable to use
HarfBuzz.  All the rest is less important (the fact that Emacs on the
emacs-30 branch was unable to load Uniscribe is indeed a bug, which I
fixed just now).  So let's focus on that one problem: you should be
able to use HarfBuzz if it is installed correctly; it works for me.

> One more piece of information: attempting to yank any text results in the error:
> 
> `Coding system is invalid or doesn't have an eol variant for dos line ends: nil` 
> 
> This error occurs when starting with -Q and attempting to yank any text. If I 
> call `(set-selection-coding-system 'utf-16-le)`, it resolves the issue. 

This is due tho the following, I think:

> Important settings:
>   value of $LANG: en_US.UTF-8  <<<<<<<<<<<<<<<<<<
>   locale-coding-system: cp1252

How come your LANG is set to en_US.UTF-8?  Did you set this in the
environment or something.  Using UTF-8 as the default encoding on
Windows is not a good idea.