From f7f9cd1296906854635ef020383f3fc4296e242c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 22 Mar 2025 11:42:32 -0600 Subject: [PATCH 1/2] [README.mingw.md] Review feedback --- README.mingw.md | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/README.mingw.md b/README.mingw.md index e04205e91..bb3f50540 100644 --- a/README.mingw.md +++ b/README.mingw.md @@ -20,6 +20,9 @@ Uniscribe usp10.dll from Windows 7 or before, you would need to build for 32bit. If you want to use a native DirectWrite DLL from Windows 10 or later, you would need to build for 64bit. +We suggest you read to the end of this document before starting, as it provides +a few different ways to build and test HarfBuzz for Windows. + 1. Install Wine. - Fedora: `dnf install wine`. @@ -64,6 +67,12 @@ build HarfBuzz for Windows and how we build our Windows binaries: - 32bit: `./.ci/build-win.sh 32 && ln -s build-win32 build-win` - 64bit: `./.ci/build-win.sh 64 && ln -s build-win64 build-win` +If you are on Linux and your Wine has configured itself as the processor for +the EXE files (called `binfmt_misc` in Linux), you can run the executables +EXE directly. But it is advised that instead, you modify the cross-file to +use the `exe_wrapper` option, which will allow you to run the executables +under Wine. This is the most reliable way to run the executables under Wine. + This might take a while, since, if you do not have the dependencies installed, meson will download and build them for you. @@ -80,10 +89,19 @@ to find the built HarfBuzz DLLs: Adjust for the path where you have built HarfBuzz. You might want to add this to your `.bashrc` or `.zshrc` file. +Alternatively, if you uncommented the `exe_wrapper` line in the cross-file, you +can skip this step, as the `exe_wrapper` will make meson take care of setting the +`WINEPATH` if commands are run through the `meson devenv` command, which we will +introduce in the next step. + 7. Run the `hb-shape` executable under Wine: - `wine build-win/util/hb-shape.exe perf/fonts/Roboto-Regular.ttf Test` +Or using `meson devenv to do the same: + + - `meson devenv -C build-win util/hb-shape.exe perf/fonts/Roboto-Regular.ttf Test` + You probably will get lots of Wine warnings, but if all works fine, you should see: ``` @@ -119,15 +137,16 @@ a PNG file. - `wine build-win/util/hb-view.exe perf/fonts/Roboto-Regular.ttf Test > test.png` -9. If you are on Linux and your Wine has configured itself as the processor for -the EXE files (called `binfmt` in Linux), you can run the executables directly: +7. As noted, if your Linux has `binfmt_misc` enabled, you can run the executables +directly. If not, you can modify the cross-file to use the `exe_wrapper` option as +specified before. - `build-win/util/hb-shape.exe perf/fonts/Roboto-Regular.ttf Test` If that does not work, you can use the `wine` command as shown above. -10. You can try running the test suite. If on Linux with `binfmt` enabled, you can -run the tests directly: +10. You can try running the test suite. If on Linux with `binfmt_misc` enabled, you +can run the tests directly: - `ninja -C build-win test` From a388989af43e2fca4f5421e9a4000bbd5e0ad686 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 22 Mar 2025 12:31:21 -0600 Subject: [PATCH 2/2] [README.mingw.md] Final touches, hopefully --- README.mingw.md | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/README.mingw.md b/README.mingw.md index bb3f50540..4227e1d41 100644 --- a/README.mingw.md +++ b/README.mingw.md @@ -168,24 +168,35 @@ DirectWrite API by Wine, and not the real thing. If you want to test the Uniscribe or DirectWrite shapers against the real Uniscribe / DirectWrite, you can follow the instructions below. -11. Uniscribe: Assuming a 32bit build for now. Bring a 32bit version of -`usp10.dll` for yourself from `C:\Windows\SysWOW64\usp10.dll` of your Windows -installation (assuming you have a 64-bit installation, otherwise -`C:\Windows\System32\usp10.dll`). You want one from Windows 7 or earlier. -One that is not just a proxy for `textshaping.dll`. Rule of thumb, your -`usp10.dll` should have a size more than 500kb. Put the file in -`build-win/src`. +11. Old Uniscribe: Assuming a 32bit build for now. + +Bring a 32bit version of `usp10.dll` for yourself from +`C:\Windows\SysWOW64\usp10.dll` of your 64bit Windows installation, +or `C:\Windows\System32\usp10.dll` for 32bit Windows installation. + +You want one from Windows 7 or earlier. One that is not just a proxy for +`TextShaping.dll`. Rule of thumb, your `usp10.dll` should have a size more +than 500kb. + +Put the file in `~/.wine/drive_c/windows/syswow64/` so wine can find it. You can now tell wine to use the native `usp10.dll`: - `export WINEDLLOVERRIDES="usp10=n"` - `wine build-win/util/hb-shape.exe perf/fonts/Roboto-Regular.ttf Test --shaper=uniscribe` -12. DirectWrite: You can use the same method to test the DirectWrite shaper -against the native DirectWrite DLL. Try with a 64bit build this time. Bring -`textshaping.dll`, `dwrite.dll`, and `usp10.dll` from your Windows installation -(`C:\Windows\System32`) to `build-win/src`. You can now tell wine to use the -native DirectWrite: +12. DirectWrite and new Uniscribe: You can use the same method to test the +DirectWrite shaper against the native DirectWrite DLL. Try with a 64bit build +this time. + +Bring `TextShaping.dll`, `DWrite.dll`, and `usp10.dll` from your 64bit Windows +installation (`C:\Windows\System32`) to `~/.wine/drive_c/windows/system32/`. + +You want the ones from Windows 10 or later. You might have some luck downloading +them from the internet, but be careful with the source. I had success with the +DLLs from [https://dllme.com](dllme.com), but I cannot vouch for the site. + +You can now tell wine to use the native DirectWrite: - `export WINEDLLOVERRIDES="textshaping,dwrite,usp10=n"` - `wine build-win/util/hb-shape.exe perf/fonts/Roboto-Regular.ttf Test --shaper=directwrite`