question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Fonts: notify user about deleted fonts in story

See original GitHub issue

Feature Description

It’s possible for custom fonts (and even Google Fonts!) to be deleted.

When the user opens a story that uses a font that no longer exists, we want to notify the user about it.

Here’s what this notification should be like:

Figma: View current design

Screenshot:

Screen Shot 2022-02-24 at 1 33 14 PM

General flow:

  1. When opening a story in the editor, we go through all text elements in a story and their fonts
  2. For each font, we try to retrieve information about it from the server. If the server doesn’t return the font information, we know it has been deleted.
  3. For each missing font, display a single modal to let the user know about it, offering further instructions.
  4. That means in the unlikely event of there being multiple missing fonts, there will be multiple modals, one after the other
  5. The modal displays the single <FontPicker> dropdown; the same component we use in the design panel.

CTAs

  • “Open anyway” will close the modal & replace the missing font for all affected elements with Roboto (either from TEXT_ELEMENT_DEFAULT_FONT or fetched via API)
  • “Replace font” will close the modal & replace the missing font for all affected elements with the selected font from the picker

When replacing an element’s missing font, the font weight should be preserved. If the replacement font is not available in the same weight, we pick the closest possible match

Implementation notes:

  • FontPicker needs to be refactored so that handleFontPickerChange and fontFamily are passed via props instead (so there is no dependency on selectedElements and pushUpdate
  • We might want to add font to ELEMENT_PROPS_TO_IGNORE, so that clicking on “Open anyway” does not cause a history entry
  • The rough flow is similar to how <StatusCheck> works
  • Can add JS & e2e tests for this
  • Can add storybook story for this dialog as well

Alternatives Considered

Additional Context

  • While we’re at it, if there are saved templates that use a missing font, should we also notify the user in this case?
  • If a font still exists but has updated metrics, we could simply update the metrics for all affected elements silently. (requires updating ELEMENT_PROPS_TO_IGNORE accordingly)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
felipebochehin87commented, Mar 16, 2022

Tested against https://stories-qa-wordpress-amp.pantheonsite.io/wp-admin/, using PR #10808.

  1. Added custom font
  2. Enabled flags on Experiments screen
  3. Created a story and added a text with the custom font
  4. Saved story
  5. Removed the custom font
  6. Reopened the story - dialog displayed - When clicking on Back to Dashboard OR hitting ESC on the keyboard, I was redirected to the dashboard; when clicked on Open Anyway, story opened displaying text using Roboto font; when selecting a new font and clicking on replace font, story was displayed using the selected font

https://user-images.githubusercontent.com/96055551/158597504-87b14edc-92c8-44d7-a827-eae66428b10b.mp4

1reaction
swissspidycommented, Mar 3, 2022

@timarney The font picker uses the Datalist component from the design system. The Datalist component has a zIndex prop for overriding the popup’s default z-index (which I think is 2).

Read more comments on GitHub >

github_iconTop Results From Across the Web

9 Little-Known Font How-Tos for Instagram Stories
1. Add your brand font to the Stories. Recently, Instagram released new fonts for Stories for us all to play with. It's true:...
Read more >
How To Add Custom Fonts To Your Instagram Story
Step up your social media game and get creative with this step-by-step guide for how to add custom fonts to your Instagram Story....
Read more >
Custom Fonts and Audio - WordPress.org
Are you looking for a way to use custom fonts that are not available on Google Fonts?
Read more >
How to Add Custom Fonts to Instagram Stories - Bad Rhino Inc.
To use this app: Open the app and upload the photo you want to post to you story. Tap the “add text” option...
Read more >
Common Mistakes With Adding Custom Fonts to Your iOS App
Step 1: Include your fonts in your XCode project. Most commonly, you'll have a TTF or OTF font that you'll want to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found