Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely on cross-platform font #20

Closed
felix-seifert opened this issue Apr 5, 2023 · 7 comments
Closed

Rely on cross-platform font #20

felix-seifert opened this issue Apr 5, 2023 · 7 comments

Comments

@felix-seifert
Copy link
Collaborator

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.

@csgoh
Copy link
Owner

csgoh commented Apr 7, 2023

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.

@antmanin
Copy link

antmanin commented Apr 7, 2023

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

@csgoh
Copy link
Owner

csgoh commented Apr 9, 2023

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

@csgoh
Copy link
Owner

csgoh commented Apr 19, 2023

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.

@antmanin
Copy link

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

@csgoh
Copy link
Owner

csgoh commented Apr 22, 2023

@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.

@csgoh
Copy link
Owner

csgoh commented Apr 23, 2023

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.

@csgoh csgoh closed this as completed Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants