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

Font path seems to have been hardcoded for Mac? #12

Open
farzadmf opened this issue Mar 22, 2024 · 4 comments
Open

Font path seems to have been hardcoded for Mac? #12

farzadmf opened this issue Mar 22, 2024 · 4 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@farzadmf
Copy link

The code seems to do os.Open("/Library/Fonts/Arial Unicode.ttf"), which I think is only valid for a Mac

@ugwis ugwis added good first issue Good for newcomers bug Unexpected behavior / Something isn't working labels Mar 23, 2024
@ljacobsson
Copy link

ljacobsson commented Mar 24, 2024

+1 here on Ubuntu

Really eager to build support for this in cfn-diagram

@ugwis
Copy link
Member

ugwis commented Mar 25, 2024

Thank you for reporting issue!

Yes. It was hardcoded.
I've confirmed that AWS architecture guidelines recommend Arial for as a universal font that everyone can use. Although the redistribution of Arial font is prohibited, it is pre-installed on major operating systems such as Windows and macOS (and in the case of Ubuntu, it is distributed as a package). Although it is possible to embed redistributable fonts into executable binaries, there are many considerations, including compatibility with Unicode, so we do not currently plan to embed them into binaries.
However, we will add attributes to the definition file to allow users to specify custom fonts.

Work procedure:

  • 1. Hardcode the path to the pre-installed Arial font for each operating system.
  • 2. Make it possible to specify the font path (and font name, font URL) in the definition file and template.

@farzadmf
Copy link
Author

Thank you for the update @ugwis ; hopefully those things will be implemented soon. And I'm not sure if "non-gui" Linux distributions will somehow include fonts (probably they do?!)


And also the resources seem to be limited? For example, I tried to add AWS::StepFunctions::StateMachine (from here), but that didn't work

@ugwis
Copy link
Member

ugwis commented Mar 25, 2024

In #19 I specified the path to the font on Linux and Windows. Font paths should not be hard-coded, but will be removed if we add an implementation that searches for font files by font name.

I have confirmed that the Arial font is included in ttf-mscorefonts-installer, and it's possible to generate it even in a non-GUI environment with the latest commit.

$ sudo apt install ttf-mscorefonts-installer
$ fc-list | grep Arial
...
/usr/share/fonts/truetype/msttcorefonts/Arial.ttf: Arial:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,thường,Arrunta
$ awsdac vpc-natgw.yaml

I tried to add AWS::StepFunctions::StateMachine (from here), but that didn't work

Available resource types are still limited. we need to create a list of resource types. I added a workaround using presets for undefined resource types to #20.

@ugwis ugwis mentioned this issue Apr 2, 2024
@ugwis ugwis removed the bug Unexpected behavior / Something isn't working label May 9, 2024
@ugwis ugwis self-assigned this May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants