OGU icon indicating copy to clipboard operation
OGU copied to clipboard

Initialization font issue in MacOS Sonoma 14.4.1

Open JianjunJin opened this issue 10 months ago • 2 comments

Hello Dr. Wu,

Thank you for developing this toolkit. It looks cool! I'm trying OGU and encounter the following font failures when initializing OGU:

$ python -m OGU init

21:48:12 INFO     Failed to extract font properties from /System/Library/Fonts/Apple Color Emoji.ttc: In FT2Font: Could not set the fontsize (invalid pixel size; error code 0x17)
21:48:12 INFO     Failed to extract font properties from /System/Library/Fonts/LastResort.otf: tuple indices must be integers or slices, not str
21:48:13 INFO     Failed to extract font properties from /System/Library/Fonts/Supplemental/NISC18030.ttf: In FT2Font: Could not set the fontsize (invalid pixel size; error code 0x17)
21:48:13 INFO     generated new fontManager
21:48:13 INFO     Try to locate or install all third-party software.
21:48:13 WARNING  Cannot find mafft.bat, try to install. May cost minutes
21:48:13 WARNING  Cannot find iqtree2, try to install. May cost minutes
21:48:14 INFO     Downloading iqtree-2.2.2.2-MacOSX.zip from https://ogu2023.s3.ap-east-1.amazonaws.com/iqtree-2.2.2.2-MacOSX.zip
21:48:14 INFO     Downloading mafft-7.511-mac.zip from https://ogu2023.s3.ap-east-1.amazonaws.com/mafft-7.511-mac.zip
21:48:18 INFO     iqtree-2.2.2.2-MacOSX.zip got. Installing...
21:48:18 INFO     iqtree2 installed successfully.
21:48:20 INFO     mafft-7.511-mac.zip got. Installing...
21:48:21 INFO     mafft.bat installed successfully.
21:48:21 INFO     Got IQTREE.
21:48:21 INFO     Got MAFFT.

I don't believe these errors are fatal, but I wanted to report them in case they can be resolved. Please let me know if you need more information from me.

Best, JianJun

JianjunJin avatar Apr 17 '24 01:04 JianjunJin

Dear JianJun,

Sorry for late response. I haven't receive email notification from GitHub (guess there are some repo settings need change).

The failed logs is from matplotlib, which will check and register all fonts in your operating systems during the first time running. It said that three fonts in macOS cannot be recognized. Since that the software only use Times New Roman and Arial or other limited fonts to draw visualization result, such fonts (emoji, special-purpose font and a long-time problematic font) missing have no effect for the program's function, as you said, they are not fatal.

However, they are indeed annoying. I will try to find out solution from matplotlib community. Once the problem is fixed, I will build a new release and let you know.

Thanks again for using the software and give valuable feedback.

Sincerely Ping Wu

wpwupingwp avatar Apr 20 '24 08:04 wpwupingwp

Hello Dr. Wu,

Thank you for developing this toolkit. It looks cool! I'm trying OGU and encounter the following font failures when initializing OGU:

$ python -m OGU init

21:48:12 INFO     Failed to extract font properties from /System/Library/Fonts/Apple Color Emoji.ttc: In FT2Font: Could not set the fontsize (invalid pixel size; error code 0x17)
21:48:12 INFO     Failed to extract font properties from /System/Library/Fonts/LastResort.otf: tuple indices must be integers or slices, not str
21:48:13 INFO     Failed to extract font properties from /System/Library/Fonts/Supplemental/NISC18030.ttf: In FT2Font: Could not set the fontsize (invalid pixel size; error code 0x17)
21:48:13 INFO     generated new fontManager
21:48:13 INFO     Try to locate or install all third-party software.
21:48:13 WARNING  Cannot find mafft.bat, try to install. May cost minutes
21:48:13 WARNING  Cannot find iqtree2, try to install. May cost minutes
21:48:14 INFO     Downloading iqtree-2.2.2.2-MacOSX.zip from https://ogu2023.s3.ap-east-1.amazonaws.com/iqtree-2.2.2.2-MacOSX.zip
21:48:14 INFO     Downloading mafft-7.511-mac.zip from https://ogu2023.s3.ap-east-1.amazonaws.com/mafft-7.511-mac.zip
21:48:18 INFO     iqtree-2.2.2.2-MacOSX.zip got. Installing...
21:48:18 INFO     iqtree2 installed successfully.
21:48:20 INFO     mafft-7.511-mac.zip got. Installing...
21:48:21 INFO     mafft.bat installed successfully.
21:48:21 INFO     Got IQTREE.
21:48:21 INFO     Got MAFFT.

I don't believe these errors are fatal, but I wanted to report them in case they can be resolved. Please let me know if you need more information from me.

Best, JianJun

Dear Jianjun,

After several tries, I found that the core of the problem is from matplotlib's font manager. Since matplotlib decided to ignore this problem, and it is hard to build a blacklist of fonts and push the code to them, I tried to hide such harmless logs.

Maybe you can try the new version, OGU v1.52, by running:

pip install -U OGU
# remove old font cache
rm -rf ~/.matplotlib
rm -rf ~/.config/matplotlib

and then reinitialize the program.

If the problem remains unsolved on your computer, please let me know.

Currently, it's just a naive work-around. Given that OGU just draws simple figures, in the future, a light-weight drawing library may be used to replace matplotlib in OGU.

Sincerely, Ping Wu

wpwupingwp avatar Apr 23 '24 12:04 wpwupingwp