WPS Office bold fonts problems

I use WPS Office for my work and so far have been quite happy with it. However, I noticed that it has some problem with certain fonts, when bold. I am not sure when this started, but apparently it happened after a certain freetype update. So, I decided to look around for a solution.

Take a look at the screenshot below, that’s what I am talking about:

I found these discussions, at OpenSUSE forums and NixOS GutHub. The latter suggested a problem with FreeType after version 2.13.0 (at the moment, freetype is at version 2.13.2 on CRUX 3.7). The discussion also points at FreeType GitLab, where a proposed patch for the issue was rejected.

So, I had several options: downgrade FreeType to 2.13.0 system-wide, patch FreeType 2.13.2 system-wide, use 2.13.0 for WPS Office only or use a patched 2.13.2 for WPS Office only. I decided to try the last solution, so here’s the patch:

diff -pruN orig/src/base/ftsynth.c new/src/base/ftsynth.c
--- orig/src/base/ftsynth.c	2023-03-16 06:17:48.000000000 +0200
+++ new/src/base/ftsynth.c	2024-07-22 11:48:00.374834820 +0300
@@ -98,7 +98,22 @@
   FT_EXPORT_DEF( void )
   FT_GlyphSlot_Embolden( FT_GlyphSlot  slot )
   {
-    FT_GlyphSlot_AdjustWeight( slot, 0x0AAA, 0x0AAA );
+    FT_UShort        units_per_EM;
+    FT_Size_Metrics* metrics;
+    FT_Fixed         xdelta, ydelta;
+
+    if ( !slot )
+      return;
+
+    units_per_EM = slot->face->units_per_EM;
+    metrics      = &( slot->face->size->metrics );
+
+    xdelta = FT_MulFix( units_per_EM, metrics->x_scale / 24 ) * 1024 /
+             (FT_Pos)metrics->x_ppem;
+    ydelta = FT_MulFix( units_per_EM, metrics->y_scale / 24 ) * 1024 /
+             (FT_Pos)metrics->y_ppem;
+
+    FT_GlyphSlot_AdjustWeight( slot, xdelta, ydelta );
   }
 

So, my WPS office port builds an patched version of FreeType and places the library in the office6 dir. It works as before and so far, I have not had issues with the program. In any case, the patched lib is isolated from the rest of the system.

To fix this on another distribution, e.g. Ubuntu, let’s simply use the old freetype. Try the following:

wget https://sourceforge.net/projects/freetype/files/freetype2/2.13.0/freetype-2.13.0.tar.xz
tar xvf freetype-2.13.0.tar.xz 
meson setup freetype-2.13.0 build
meson compile -C build
sudo cp -a build/{libfreetype.so,libfreetype.so.6,libfreetype.so.6.19.0} /opt/kingsoft/wps-office/office6/

13 Comments on “WPS Office bold fonts problems”

  1. Unknown's avatar Anonymous says:

    Hello,

    I’m technology teacher and IT manager in french middle school and I have 2 computers rooms with old laptops recycled with Linux and WPS Office. I really need a workaround for this font glitchs bug.

    So, can you share the patched version of Free Type you made ?

    Thanks for your help, David.

  2. slackalaxy's avatar slackalaxy says:

    what distribution? i can send you instructions how to build it and trick wps office use it

  3. Unknown's avatar Anonymous says:

    Thanks for the answer ! I’m on Kubuntu 24.04.

  4. Unknown's avatar Anonymous says:

    Thanks for the answer. I’am on Kubuntu 24.04.

  5. slackalaxy's avatar slackalaxy says:

    check the solution

  6. Unknown's avatar Anonymous says:

    Worked for me on LM 22. Thanks!

  7. Unknown's avatar Anonymous says:

    Many Many Many thanks for the solution ! It worked for me too ! You’re the best.

  8. Unknown's avatar Anonymous says:

    Many Many Many thanks for the solution ! It worked for me too ! You’re the best.

    Now I can fix this issue on all the computers. Best regards and best wishes. David.

  9. Unknown's avatar Anonymous says:

    Many Many Many thanks for the solution ! It worked for me too ! You’re the best. Now I can fix this issue on all the computers in the Middle School. Best regards and wishes from David.

  10. Unknown's avatar Anonymous says:

    Thanks to you, now I can fix this issue on all the computers in the Middle School where I work. Thanks a lot, David.

  11. Unknown's avatar Anonymous says:

    Sorry for the duplicated posts but they appears a long time after I wrote them so I thought they were refused and wrote them again.

    David.

  12. slackalaxy's avatar slackalaxy says:

    it’s ok :) glad it worked!

  13. Unknown's avatar Anonymous says:

    wow thanks so much! i was so pissed off at the prospect of going back to windows just to use MS Office.. you saved me!


Leave a comment