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

Add Additional Instance Names to Info Pop-Over #92

Merged
merged 8 commits into from
Jul 3, 2024

Conversation

colinmford
Copy link
Contributor

Hey @LettError and @typemytype,

This is how it's looking so far... I added the style map stuff in there first — if you want me to remove the PostScript name from the main table and add it to this dialog I can certainly try to do that next... but because that was a change in behavior and it'll be a little more complicated than the style map names, I thought I would run this part by you guys first.

Personally I might prefer to leave PostScript Names where it is in the main table, but if you really want it out of there I can try to make it work.

image

I wanted it to match the RF Info panel as close as possible.

One potential issue with the radio buttons is you can't unset them once you select them, meaning you can't change your mind and leave that field blank if you wanted to. Potential solutions include adding the "use default value" checkboxes RF has, adding a "None" option to the radio button, or changing the input to a combo box or something. I welcome your input!

@typemytype also mentions in #91 the potential for auto-generating names, which is a behavior for PostScript names currently but I worry about getting too clever when it comes to the Style Map names. What do you think?

@colinmford
Copy link
Contributor Author

colinmford commented Jun 4, 2024

Ok, I think I'm set with the style map part of it. @LettError @typemytype do you want me to go further and add the postscript name field to that dialog, removing it from the main table, or should we call it done here?

@LettError
Copy link
Owner

There's a contextual menu item for assembling the postscriptfontname from the available family and stylenames. Would it be useful to extend that into "do all names" or something like that?

@colinmford
Copy link
Contributor Author

@LettError @typemytype

Check out this latest commit:

image image
  • Moved PostScript to the info pop over, removed it from the main table. Removed the "auto Postscript name" item from the context menu.
  • Added two columns to 1) indicate that there are additional names and 2) indicate there are localized names, respectively (the source tab had the second one, it was missing from the instance tab so I thought I would add it)
  • Added a field for the identifying "name" attribute... not typically necessary but for a sense of completeness, now all the attributes of the <instance> tag are covered in one way or another
  • Added "magic" buttons to those fields for generating "best guess" names. It uses transformer functions added to tools.py
    • The postScript auto function more closely follows the spec in terms of not allowing certain glyphs
    • the style map function has a little bit of heuristics that I can probably guess will never cover 100% of cases, but hopefully does well enough for most cases
    • The identifying name function could probably do more to generate a "unique" name if there are more than one entry of the same name but that would require looking at all the instances in the document and I was hoping not to go that far... it just smushes family name and style name together
  • I added a "help" button to that additional names tab in the popover, which links to the DS5 spec with more info about those names, but for some reason it doesn't work 100% of the time and sometimes it crashes RF if you click it too many times... and then I realized the other help button in the toolbar ALSO does not work really well, maybe @typemytype has some ideas...

@colinmford colinmford marked this pull request as ready for review June 5, 2024 20:31
@LettError
Copy link
Owner

LettError commented Jun 5, 2024 via email

@colinmford
Copy link
Contributor Author

@LettError I can update it... is it all written straight into the HTML in DesignspaceEditor2.roboFontExt/html/index.html or is that generated somehow?

@colinmford
Copy link
Contributor Author

colinmford commented Jun 6, 2024

While we're in here, I have a sort of partially related question — should the "update UFO filename" function also use the postscript name transformer function I wrote?

At the moment if you have a font with the name "Polymath Text" "Bold Italic", it'll create a file name like instances/Polymath Text-Bold Italic.ufo (with spaces), while the PostScript name it'll come up with is PolymathText-BoldItalic... it might be a cleaner look if they both follow the same method.

@ryanbugden
Copy link
Contributor

ryanbugden commented Jun 6, 2024

Would it be possible to choose an auto-formatter in prefs?

  • Postscript Style
  • Spaces
  • Underscores

I like the latter :)
Edit: Oh I guess there is no settings menu for DSE2. Ignore me. Can be scripted fairly easily I suppose.

@colinmford
Copy link
Contributor Author

colinmford commented Jun 11, 2024

@LettError @typemytype

OK, I updated the doc page in DesignspaceEditor2.roboFontExt/html/index.html and changed the "update UFO filename" function also use the postscript name transformer function I wrote.

LMK what you think!

@LettError
Copy link
Owner

Github is confusing, I can't find the page with the changes to the docs? Or also how to get a working extension with the PR code.

@colinmford
Copy link
Contributor Author

colinmford commented Jun 11, 2024

Github is confusing, I can't find the page with the changes to the docs? Or also how to get a working extension with the PR code.

@LettError

In a pinch you could just get the zip from here my repo here.

And you can see the diff for index.html here.

@colinmford
Copy link
Contributor Author

I just want to make sure this doesn't get stalled — how is it looking, guys? Anything else for me to work on?

@LettError
Copy link
Owner

Installed it. Looking at it. Sparkly icon is a bit dim in a dark RF.
image

@LettError
Copy link
Owner

Seems to work as advertised.

@colinmford
Copy link
Contributor Author

Installed it. Looking at it. Sparkly icon is a bit dim in a dark RF. image

@typemytype, is there a way to provide darkmode versions of the icons, or at least to get the darkmode state of RF?

@LettError
Copy link
Owner

Colin can you elaborate on this name. Is it new? What is its purpose?
image

@colinmford
Copy link
Contributor Author

Colin can you elaborate on this name. Is it new? What is its purpose? image

@LettError It is the name attribute in this section https://fonttools.readthedocs.io/en/latest/designspaceLib/xml.html#instances-element

name: required, string. A unique name that can be used to identify this font if it needs to be referenced elsewhere.

@typemytype
Copy link
Collaborator

use symbolImage("wand.and.stars", "primary") to use one of the dynamic OS colors

@colinmford
Copy link
Contributor Author

@typemytype Thanks! Working now

image

@typemytype
Copy link
Collaborator

is the instance.name necessary for the DSE? where is this used? I guess this should look more like an identifier then a readable string

@colinmford
Copy link
Contributor Author

colinmford commented Jun 17, 2024

I've opened up a question in FontTools fonttools/fonttools#3572 about how unique instance.name really needs to be... I looked around in a few libraries and it doesn't really seem to be used. (It might be a hold over from the Superpolator file format?)

But to answer the question of why I included it — with its inclusion we would now support all the attributes of the <instance> tag. We can certainly remove it if you do not want it there, I just added it for completeness.

@colinmford
Copy link
Contributor Author

@LettError @typemytype How about this — I removed the "identifying name" field from the pop over, and added a line to automatically name instances like is done for Sources (i.e. "instance.##") if the name attribute is missing.

image

https://github.com/colinmford/designSpaceRoboFontExtension/blob/069de2016b363494cbc50017258666487a2e5cbd/DesignspaceEditor2.roboFontExt/lib/designspaceEditor/ui.py#L148-L149

@LettError
Copy link
Owner

I'm in the middle of TM exams and a bit pressed for time. I understand you also have your schedules. My current thinking: both the sourceDescriptor.name and the instanceDescriptor.name are for tools that need to identify these records. Whether or not this is still a common practice I don't know. The sourceDescriptor.name is probably used (what was the related issue?). I doubt it will be necessary or possible to change the DS5 spec.
I'd argue to just keep the names out of the editor. It's not been necessary to edit these values by hand.

@colinmford
Copy link
Contributor Author

@LettError Sure, no problem we can leave this until after exams

@typemytype
Copy link
Collaborator

DSE doesnt use instance.name anywhere (and as you found out no other tool needs this either) so I would leave this like it is. If tools needs this they can always fill in the name attribute.

FYI: DSE has to review source names which are important in DSE to identify sources (see)

@colinmford
Copy link
Contributor Author

@typemytype yeah I agree 100%.

To me, this last commit is good enough to fulfill the purposes of this PR. I won't bug you guys any more with additions, but if there's any further changes you guys want made after you have space and time to review, I will certainly do it. Otherwise, when you're ready, I would support merging this so we can call it done.

@typemytype
Copy link
Collaborator

typemytype commented Jun 25, 2024

Looks good to me!

@typemytype typemytype merged commit 0c6ec56 into LettError:master Jul 3, 2024
@typemytype
Copy link
Collaborator

thanks Colin, super cool addition to DSE!

@colinmford
Copy link
Contributor Author

Thanks @typemytype and @LettError !

@ryanbugden
Copy link
Contributor

This is great, thank you @colinmford and team!

Is there a select-all-instances-and-wave-magic-wand option?

@typemytype
Copy link
Collaborator

no, the popup info is only for the selected instance.
I guess those magic-wand-options could be menu options too applied to all selected instances

@ryanbugden
Copy link
Contributor

I think that would be super useful, like the Update UFO Filename and Update PostScript Font Name were!

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.

4 participants