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 67 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 and others added 28 commits March 4, 2025 13:49
@ollimeier
Copy link
Collaborator Author

@justvanrossum About the label of customData, currently 'Advanced Information': What do you think about 'Low-level settings'?

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