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

Edit font infos metadata #2039

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft

Conversation

ollimeier
Copy link
Collaborator

Fixes #2023

This is an early draft for feedback.

My main question: Is it the right direction to add and use a Fontra to UFO mapping for customData parameters (it's similar to lineMetricsVerMapping)?

I am also wondering if fontInfoNameMapping should be a dict instead of a list? But this is not related to this issue. I am just noticing it and wondering if we should make it consistent?

@ollimeier
Copy link
Collaborator Author

Here a short demo:

Fontra-CustomData.mp4

source.customData = {};
for (const item of event.newValue) {
const value = parseFloat(item["value"]);
// TODO: How do we handle different types of values?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can allow items to carry their own formatters, then the item would be able override the column-level formatter:

diff --git a/src/fontra/client/web-components/ui-list.js b/src/fontra/client/web-components/ui-list.js
index 614540b94..abc61bdac 100644
--- a/src/fontra/client/web-components/ui-list.js
+++ b/src/fontra/client/web-components/ui-list.js
@@ -273,7 +273,8 @@ export class UIList extends UnlitElement {
             [colDesc.cellFactory(item, colDesc)]
           );
         } else {
-          const formatter = colDesc.formatter || DefaultFormatter;
+          const formatter =
+            item.formatters?.[colDesc.key] || colDesc.formatter || DefaultFormatter;
 
           cell = html.div(
             { class: `text-cell ${colDesc.key} ${colDesc.align || "left"}` },

(Maybe the key shouldn't be "formatter", but we can decide later.)

@ollimeier ollimeier force-pushed the issue-2023-edit-font-infos-metadata branch from a13f394 to f27e558 Compare February 25, 2025 13:00
@ollimeier
Copy link
Collaborator Author

Note: We will add UI for lineMetricsVerticalLayout to this PR as we noticed that there is an overlap with openTypeVheaVertTypoLineGap.

@ollimeier
Copy link
Collaborator Author

Note: We will add UI for lineMetricsVerticalLayout to this PR as we noticed that there is an overlap with openTypeVheaVertTypoLineGap.

@justvanrossum I think this requires more and thorough consideration of how we really want to deal with it. There are too many open questions: How would a UI look like? Does it look like "Line metrics" or like "Custom Data". Is it always there, like "Guidelines", even though we don't really need it always? In general I would think it should look like "Line metrics", but we don't set these values always (which differs from "Line Metrics"), and we don't have an add or remove concept for that UI, yet.

@ollimeier
Copy link
Collaborator Author

Notes from todays call together with @justvanrossum:

  • maybe get rid of ufoInfoPrefix = "ufo.info." . Just wants to think about it.
  • add-button should open a dialog where the user can select an attribute from a list (similar to "Add Source"-dialog select layer)

@justvanrossum
Copy link
Collaborator

I just realized there are several items that you currently propose to edit as part of font sources, that are actually font-level bits of data, that we should incorporate in the "Font info" panel.

Examples:

  • openTypeHeadCreated
  • openTypeHeadLowestRecPPEM
  • openTypeHeadFlags
  • openTypeOS2Selection
  • openTypeOS2Type

We should very carefully select which items are potentially interpolatable (see also: the MVAR table), and which are not, and therefore do not belong in the font sources panel.

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.

[Font Info] edit font infos (metadata that are used for binary generation)
2 participants