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.

Support font family picker in settings

See original GitHub issue

Currently our font pickers don’t know anything about system fonts:

image

image

By enabling and using the font access API we can provide suggestions for this which is really nice:

image

image

Unfortunately this doesn’t work well currently when syncing across machines and/or using font fallbacks as warnings will appear. For example this is valid on this machine but it throws an error:

image

I’ve tried a few things but none of them work:

  • The example JSON schema property is what we’re after, optional suggestions, but we don’t seem to support it.
  • Using pattern: '.*' in combination with enum still warns about not matching an enum value.
  • This works but is a bit hacky to avoid matching both oneOf values and it doesn’t show up in the settings UI. anyOf doesn’t work:
    oneOf: [
    	{
    		type: 'string',
    		enum: fontFamilies,
    		enumDescriptions: [`The system's default monospace font`],
    	},
    	{
    		type: 'string',
    		pattern: `^(?!(${fontFamilies.join('|')})).*`
    	}
    ]
    

Ideally any string value would be accepted and we would have a combobox in the settings editor to allow selecting from a dropdown or manual freeform entry.

@aeschli Am I interpreting example correctly and could we update the schema parsing to support it? @roblourens @rzhao271 If we support example could we add a combobox renderer to the settings editor?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:19 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
Ayanrockscommented, Jul 1, 2022

Any update on this issue?

1reaction
aeschlicommented, Jul 13, 2021

Yes, the settings editor would have to learn about this ‘pattern’ (anyOf with enum and string). Alternative would be to define it as string and use defaultSnippets to teach the editor about god proposals.

{
  "type": "string",
  "defaultSnippets": [
     { "label": "monospace", "description": "The default monspace font", "body": "monospace" },
     ...
   }
}

This is something that should be easier for the settings editor to adopt.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use Shopify's New font_picker Settings
Shopify recently announced a new partnership with Monotype. A key component of this new feature is the font_picker setting type.
Read more >
UIFontPickerViewController | Apple Developer Documentation
Creates a controller for a font picker view. ... Settings for fonts the font picker should offer to the user and how to...
Read more >
font-family - CSS: Cascading Style Sheets - MDN Web Docs
The font-family CSS property specifies a prioritized list of one or more font family names and/or generic family names for the selected ...
Read more >
Fonts - Shopify.dev
System fonts are listed with the available fonts, noted with a system badge, and will show under the System fonts category in the...
Read more >
CSS Font Stack: Web Safe and Web Font Family with HTML ...
Web safe CSS font stacks and web fonts. Select, preview, and generate CSS and HTML for your font family.
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