LettError / designSpaceRoboFontExtension

A RoboFont extension for creating and editing designspace documents.
MIT License
27 stars 6 forks source link

Add Additional Instance Names to Info Pop-Over #92

Closed colinmford closed 2 days ago

colinmford commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

@LettError @typemytype

Check out this latest commit:

image image
LettError commented 1 month ago

Screenshot looks great! I don’t have time until Friday to see it run. But I’m supporting the work!Doc’s wlll need an update too. ErikOn 5 Jun 2024, at 22:29, Colin M. Ford @.***> wrote: @colinmford commented on this pull request.

In DesignspaceEditor2.roboFontExt/lib/designspaceEditor/ui.py:

  • Create the container for the Style Map tab

  • self.instanceStyleMapNames.container = vanilla.Box((10, 10, -10, -10))
  • self.styleMapStyleOptions = ["regular", "italic", "bold", "bold italic"]
  • col1 = 10
  • col2 = 180
  • padding = 24
  • y = 10
  • Create the text box and edit box for identifier Name

  • self.instanceStyleMapNames.container.identifierNameLabel = vanilla.TextBox((col1, y, col2-padding, 22), "Identifying Name:", alignment="right")
  • self.instanceStyleMapNames.container.identifierNameTextBox = vanilla.EditText((col2, y, -40, 22), "", callback=self.controlEditCallback)
  • self.instanceStyleMapNames.container.identifierNameAutoBtn = vanilla.SquareButton((-32, y, -10, 22), "􀜍", callback=self.autoIdentifyingNameCallback)

Done.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

colinmford commented 4 weeks ago

@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 commented 4 weeks ago

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 commented 4 weeks ago

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

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 commented 3 weeks ago

@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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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

LettError commented 2 weeks ago

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

image
LettError commented 2 weeks ago

Seems to work as advertised.

colinmford commented 2 weeks ago

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 commented 2 weeks ago

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

image
colinmford commented 2 weeks ago

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 commented 2 weeks ago

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

colinmford commented 2 weeks ago

@typemytype Thanks! Working now

image
typemytype commented 2 weeks ago

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 commented 2 weeks ago

I've opened up a question in FontTools https://github.com/fonttools/fonttools/issues/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 commented 2 weeks ago

@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 commented 2 weeks ago

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 commented 2 weeks ago

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

typemytype commented 2 weeks ago

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 commented 2 weeks ago

@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 commented 1 week ago

Looks good to me!

typemytype commented 2 days ago

thanks Colin, super cool addition to DSE!

colinmford commented 2 days ago

Thanks @typemytype and @LettError !

ryanbugden commented 2 days ago

This is great, thank you @colinmford and team!

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

typemytype commented 2 days ago

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 commented 1 day ago

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