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

fix(qr-fonts): implement ibm plex sans for qrcode url #1317

Merged
merged 3 commits into from
Mar 18, 2021
Merged

Conversation

orbitalsqwib
Copy link
Contributor

@orbitalsqwib orbitalsqwib commented Mar 17, 2021

Problem

Currently, the font used in qr-code generation does not sufficiently distinguish between (capital i) I,1 and (lowercase L) l.

Closes #433

Solution

Implement IBM Plex Sans as the font for qr code generation instead of the default sans-serif font.

  • added appropriate styles to qr generation in QRCodeService to render IBM Plex Sans Regular
  • added wget command in Dockerfile to install IBM Plex Sans Regular in the container instance to give
    sharp access to the font

Screenshots

Before

https __go gov sg_il1il1i1l1i1i1i1i1111ll1l111-1

After

https __go gov sg_il1il1i1l1i1i1i1i1111ll1l111

Deploy Notes

Note that IBM Plex Sans is sourced from Google Fonts when exporting to SVG, while sharp uses a container-installed instance of the same font from IBM's Plex typeface repository (link).

As such, modifications have been made to the appropriate Dockerfiles to get the container instance to download the appropriate font and subsequently install via fc-cache -f, which force rebuilds the font configurations on Alpine Linux.

- added appropriate styles to qr generation in `QRCodeService` to render IBM Plex Sans Regular
-
added wget command in Dockerfile to install IBM Plex Sans Regular in the container instance to give
sharp access to the font

fix #433
Copy link
Contributor

@LoneRifle LoneRifle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - @NatMaeTan can you give it a once over?

@LoneRifle
Copy link
Contributor

I see the following error when trying to spin up gitpod:
Screenshot_20210318-090656

Gitpod does not use `/usr/share/fonts/TTF` but rather `usr/share/fonts/truetype` for sourcing its
fonts.
I suspect this may be due to gitpod using a debian distro rather than alpine

- switched
to use truetype dir instead of TTF

#fix 433
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

Successfully merging this pull request may close these issues.

Avoid confusion between I, 1 and I in rendered URL
2 participants