csgoh / roadmapper

Roadmapper - A Roadmap as Code (Rac) python library. Generate professional roadmap diagram using python code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rely on cross-platform font

felix-seifert opened this issue · comments

Currently, roadmapper relies on the font Arial, which seems to be specific to Windows. Users of roadmapper on different platforms (Mac and Linux) need to manually ensure the presence of this font on their system. This provides further hurdles for potential users of roadmapper and might even prevent them from adopting roadmapper. Even though different fonts can be specified, this customisation requires more work to get started.

Besides the required work for new users, our CI agents would have to be customised by installing this font. Even though this is possible, more required customisation steps of the used CI agents increase the time for CI test execution (think of apt update && apt install...).

To provide users with a more seamless option to start using roadmapper, we should implement a standard setup which works on every platform. AFAIK, this requires the usage of a font which is preinstalled on every platform (Windows, Mac and Linux) and we should provide Arial as a custom option. Alternatively, roadmapper can be system agnostic by not enforcing the usage of Arial and selecting different fonts based on the used OS.

commented

This sounds like a feature request than a defect or issue.

Roadmapper uses Pillow library and Pillow refers to font by font file name instead of file and each OSes uses different file name. Do you have any suggestion on how to support cross-platform fonts with Pillow library? I tried to avoid installing custom font. One way is to detect OS type and then alter the font file name during runtime.

probably you can use ImageFont.load_default() as a workaround

commented

probably you can use ImageFont.load_default() as a workaround
@antmanin, thanks, but text rendered using the 'load_default()' method looks horrible! 😄

commented

It seems like I have use if..else statement to detect OS type and replace it with appropriate font file. This should be added in v1.2.0.

Could you add it as an optional argument for Roadmap?
I solved issue replacing arial.ttf with Arial.ttf
One can pass dictionary with fonts

commented

@antmanin The fix that I put in will resolve your need to replace font file name. The fix will be available in v1.2.0.

commented

This is now fixed in v1.2.0. No absolute font like 'arial.ttf' is referenced in the code. Based on the OS you code is running on, the library will use the right font file name.