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

One Generate button to rule them all! #59

Closed
ryanbugden opened this issue Mar 30, 2023 · 9 comments
Closed

One Generate button to rule them all! #59

ryanbugden opened this issue Mar 30, 2023 · 9 comments

Comments

@ryanbugden
Copy link
Sponsor Contributor

I love the Export in Sub Folders option, but it only works within each panel. What if one could select all the types of fonts one wants to generate (web, desktop, variable, what-have-you), hit Generate, and watch as something like the following folder tree builds and fills in front of one’s eyes?

Desktop > OTF ( > [files] ), TTF ( > [files] )
Web > WOFF2 ( > [files] ), TTF ( > [files] )
Variable > WOFF2 ( > [files] ), TTF ( > [files] )

Desktop and Web could easily use the same input from the Fonts section, but a lingering question is whether Variable Fonts would need its own unique concurrent section for designspace files.

@typemytype
Copy link
Owner

sounds like a good plan!

this requires to have checkboxes for the Variable Fonts pane with:

[X] ttf 
[ ] otf(cff2)
[ ] woff2        ● ttf  ○ cff2

@typemytype
Copy link
Owner

and related eot must be removed #47

@ryanbugden
Copy link
Sponsor Contributor Author

Do you think all three sections should share the same file-drop input area? And the variable section just ignores UFOs and looks for designspaces?

Rather than panels in the AccordionView, all three sections could be in one view, and have checkboxes which enable/disable the settings under them

[X] Desktop
     [X] Decompose 
     [ ] Remove Overlap
     ...

[ ] Web (grayed out settings because unchecked)
     [ ] OTF 
     [ ] TTF
     ...

[X] Variable
     [X] ttf 
     [ ] otf(cff2)
     [ ] woff2        ● ttf  ○ cff2

@ryanbugden
Copy link
Sponsor Contributor Author

Should Variable be a sub-pane within both Desktop and Web?

this requires to have checkboxes for the Variable Fonts pane with:

[X] ttf 
[ ] otf(cff2)
[ ] woff2        ● ttf  ○ cff2

@typemytype
Copy link
Owner

oke, maybe a complete UI redesign :)

@typemytype
Copy link
Owner

something like this could work!

cc @typesupply

import ezui


def buildFormatCheckBoxes(items, identifier, indent):
    result = []
    for item in items:
        result.append(f"{indent} [ ] {item}                 @{identifier}_generate_{item.replace(' ', '')}")
    
    return "\n".join(result)


class BatchController(ezui.WindowController):
    
    desktopFormats = [
        "OTF", 
        "TTF", 
        "PFA", 
        "VFB"
    ]
    webFormats = [
        "OTF",
        "OTF Woff 2",
        "TTF",
        "TTF Woff 2",
        "SVG",
    ]
    variableFormats = [
        "OTF",
        "OTF Woff 2",
        "TTF",
        "TTF Woff 2",
    ]
    
    def build(self):
        content = f"""
           
* ScrollingVerticalStack 
> |---|                  @sources
> (+-)                   @sourcesAddRemoveButton

> * VerticalStack        @generateOptions

>> !§ Desktop Fonts:
>> * HorizontalStack
{ buildFormatCheckBoxes(self.desktopFormats, "desktop", indent=">>>") }      
>>> * Box                      @desktopFontSettings
>>>> [ ] Decompose             @desktopFontDecompose
>>>> [ ] Remove Overlap        @desktopFontRemoveOverlap
>>>> [ ] Autohint              @desktopFontAutohint
>>>> [ ] Release Mode          @desktopFontReleaseMode
>>>> Sufix: [_ _]              @desktopFontSuffix

>> !§ Web Fonts:
>> * HorizontalStack
{ buildFormatCheckBoxes(self.webFormats, "deskop", indent=">>>") }        
>>> * Box                                               @webFontSettings
>>>> [ ] Preserve TTF Hints                             @webFontsPreserveTTFHints
>>>> [ ] Generate HTML                                  @webFontsGenerateHTML
>>>> Sufix: [_ _]                                       @webFontSuffix
>>>> ( Web Fonts Settings )                             @webFontsSettingsButton

>> !§  Variable Fonts:
>> * HorizontalStack
{ buildFormatCheckBoxes(self.variableFormats, "deskop", indent=">>>") }
>>> * Box                                              @variableFontSettings
>>>> [ ] Interpolate to fit axes extremes              @variableFontInterplateToFitAxesExtremes
>>>> [ ] Autohint                                      @variableFontAutohint

=---=
( Generate )          @generate
"""
        
        descriptionData = dict(
            sources=dict(
                height=200,
                columnDescriptions=[dict(identifier="source", title="Sources")],
                showColumnTitles=True,
                items=[dict(source="foo.ufo"), dict(source="bar.designspace")],
            ),
            generateOptions=dict(
                margins=0
            ),           
        )

        smallUIItems = [
            "desktopFontDecompose", "desktopFontRemoveOverlap", "desktopFontAutohint", "desktopFontReleaseMode", "desktopFontSuffix",
            "webFontsPreserveTTFHints", "webFontsGenerateHTML", "webFontsSettingsButton", "webFontSuffix",
            "variableFontInterplateToFitAxesExtremes", "variableFontAutohint"            
        ]        
        descriptionData.update(dict((identifier, dict(sizeStyle="small")) for identifier in smallUIItems))
        boxes = ["desktopFontSettings", "webFontSettings", "variableFontSettings"]
        descriptionData.update(dict(((identifier, dict(width=250)) for identifier in boxes)))
        self.w = ezui.EZWindow(
            title="Batch",
            content=content,
            descriptionData=descriptionData,
            size=(300, 500),
            minSize=(300, 200),
            margins=10,
            controller=self,
        )
    
    def started(self):
        self.w.open()
    
    def generateCallback(self, sender):
        print("generate")
        print(self.w.getItems())

BatchController()    

@typesupply
Copy link

The HIG nanny has entered the chat.

How about this?

import ezui

content = """
= ScrollingVerticalStack 

|---|                                     @sources
(+-)                                      @sourcesAddRemoveButton

---

!§ Desktop Fonts
[ ] OTF                                   @desktop_generate_OTF
[ ] TTF                                   @desktop_generate_TTF
[ ] PFA                                   @desktop_generate_PFA
[ ] VFB                                   @desktop_generate_VFB
* Accordion: Options                      @desktopOptionsAccordion
> [ ] Decompose                           @desktopFontDecompose
> [ ] Remove Overlap                      @desktopFontRemoveOverlap
> [ ] Autohint                            @desktopFontAutohint
> [ ] Release Mode                        @desktopFontReleaseMode
> Sufix: [_ _]                            @desktopFontSuffix

---

!§ Webfonts
[ ] OTF                                   @deskop_generate_OTF
[ ] OTF Woff 2                            @deskop_generate_OTFWoff2
[ ] TTF                                   @deskop_generate_TTF
[ ] TTF Woff 2                            @deskop_generate_TTFWoff2
[ ] SVG                                   @deskop_generate_SVG
* Accordion: Options                      @webfontOptionsAccordion
> [ ] Preserve TTF Hints                  @webFontsPreserveTTFHints
> [ ] Generate HTML                       @webFontsGenerateHTML
> Suffix: [_ _]                           @webFontSuffix
> ( Settings )                            @webFontsSettingsButton

---

!§ VariableFonts
[ ] OTF                                   @deskop_generate_OTF
[ ] OTF Woff 2                            @deskop_generate_OTFWoff2
[ ] TTF                                   @deskop_generate_TTF
[ ] TTF Woff 2                            @deskop_generate_TTFWoff2
* Accordion: Options                      @variableOptionsAccordion
> [ ] Interpolate to fit axes extremes    @variableFontInterplateToFitAxesExtremes
> [ ] Autohint                            @variableFontAutohint

=---=

( Generate )                              @generate


"""

class Test(ezui.WindowController):

    def build(self):
        descriptionData = dict(
            sources=dict(
                height=200
            ),
            desktopOptionsAccordion=dict(
                closed=True
            ),
            webfontOptionsAccordion=dict(
                closed=True
            ),
            variableOptionsAccordion=dict(
                closed=True
            )
        )
        self.w = ezui.EZWindow(
            content=content,
            descriptionData=descriptionData,
            controller=self,
            size=(300, 500),
            minSize=(300, 200),
        )

    def started(self):
        self.w.open()

Test()
  • The content view becomes a ScrollingVerticalStack.
  • Removes the nested boxes.
  • Moves the options to closed accordions.
  • Keeps everything at the same sizeStyle.

@ryanbugden
Copy link
Sponsor Contributor Author

ryanbugden commented Mar 31, 2023

The only thing is that at this point, there will be 3 different panels for settings (main global one, Options dropdowns, and the webfont settings within one dropdown). What if we put all settings in one place and kept the main UI super simple?

Simple main window UI attached (gear icon misaligned?)

import ezui

content = """
= HorizontalStack

* Box  @box1
> !§ Input
> ---
> |---|                                     @sources
> (+-)                                      @sourcesAddRemoveButton

* Box  @box2
> !§ Output
> ---



> Desktop
> [ ] OTF                                   @desktop_generate_OTF
> [ ] TTF                                   @desktop_generate_TTF
> [ ] PFA                                   @desktop_generate_PFA
> [ ] VFB                                   @desktop_generate_VFB

> Web
> [ ] OTF
> [ ] OTF WOFF2
> [ ] TTF      
> [ ] TTF WOFF2   
> [ ] SVG   

> Variable
> [ ] OTF
> [ ] OTF WOFF2
> [ ] TTF      
> [ ] TTF WOFF2
> ---
> = HorizontalStack
>> ({gearshape.fill})      @button1
>> ( Generate )                              @generate

"""

class Test(ezui.WindowController):

    def build(self):
        descriptionData = dict(
            box1=dict(
                width=300,
            ),
            box2=dict(
                width=140,
            ),
        )
        self.w = ezui.EZWindow(
            content=content,
            descriptionData=descriptionData,
            controller=self,
        )

    def started(self):
        self.w.open()

Test()

Settings window attached (I think I messed up something with ezui here...)

import ezui

class DemoController(ezui.WindowController):

    def build(self):
        content = """
        = Tabs
        
        * Tab: General @tab1
        > [ ] Threaded (not sure what this does)
        > [ ] Export in sub-folders
        > ---
        > (X) Keep file names     @radioButtons
        > ( ) Use familyName-styleName        
        > ---
        > [ ] Debug
        
        * Tab: Desktop @tab2
        > [ ] Decompose
        > [ ] Remove Overlap
        > [ ] Autohint
        > [ ] Release Mode
        > Suffix: [_ _]
        
        * Tab: Web @tab3
        > [ ] Preserve TTF Hints
        > [ ] Generate HTML
        > Suffix: [_ _]
        > ---
        
        > !§ TTF Autohint
        
        > = TwoColumnForm  @twoCol

        >> : Hint Set Range Minimum:
        >> ---X--- [__]               @slider
        >> : Hint Set Range Maximum:
        >> ---X--- [__]               @slider
        >> : Hinting Limit:
        >> ---X--- [__]               @slider
        >> : X-Height Increase Limit:
        >> ---X--- [__]               @slider
        
        >> : Stem Width & Positioning:
        >> [ ] Gray Scale
        >> [ ] GDI
        >> [ ] DW
        
        >> : Miscellaneous:
        >> [ ] Fallback Script
        >> [ ] Adjust Subglyphs
        >> [ ] Symbol
        >> [ ] Add TTFAutohint Info
        >> [ ] Override Font License Restrictions
        
        > !§ HTML Preview
        
        > = TwoColumnForm  @twoCol
        
        >> : Preview Text:
        >> [[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789     _]]
        
        >> : CSS Style:
        >> [[_@font-face...     _]]
        
        * Tab: Variable @tab3
        > [ ] Interpolate to fit axis extremes
        > [ ] Autohint
        > ---
        > Suffix: [_ _]
        > ---
        
        =---=

        ( Save Settings )                              @save
        """
        descriptionData = dict(
            twoCol=dict(
                titleColumnWidth=125,
                itemColumnWidth=200
            ),
        )
        self.w = ezui.EZWindow(
            title="Batch Settings",
            descriptionData=descriptionData,
            content=content,
            controller=self
        )

    def started(self):
        self.w.open()

DemoController()

@typemytype
Copy link
Owner

Batch 2.0!!!

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

No branches or pull requests

3 participants