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 Extended Typography Fields #39

Closed
georgeolaru opened this issue Oct 25, 2016 · 5 comments
Closed

Add Extended Typography Fields #39

georgeolaru opened this issue Oct 25, 2016 · 5 comments
Assignees
Milestone

Comments

@georgeolaru
Copy link
Member

georgeolaru commented Oct 25, 2016

It would be nice if we can bring together in one "extended" field the following typography related options:

font-family / font-weight / font-subset
font-size / line-height
letter-spacing / text-transform

This way we can reuse them more consistently.

I created an example and how this field configuration might look like:

// Example of an Extended Typography field
'extended_typography_example' => array(
    'type'        => 'font',
    'label'       => esc_html__( 'Item Title Font', 'noah' ),
    'desc'        => esc_html__( '', 'noah' ),
    'selector'    => '.c-card h2',

    // Set the defaults
    'default'   => array(
        'font-family' => 'Arca Majora',
        'font-weight' => '700',
        'font-subset' => 'latin-ext,cyrillic',
        'font-size'   => 24,
        'line-height' => 1.5,
        'letter-spacing' => 1,
        'text-transform' => 'none'
    ),

    // Sub Fields Configuration (optional)
    'fields'    => array(
        'font-family'   => array(
            'recommended' => $recommended_headings_fonts,   // List of recommended fonts defined by theme 
        ),
        'font-weight'   => array(
            'load_all_weights' => true,                     // False by default (used for Body fonts)
        ),
        'font-size'     => array(                           // Set custom values for a range slider
            'min'          => 8,
            'max'          => 20,
            'step'         => 1,
            'unit'         => 'px',
        ),
        'line-height'    => array(0, 2, 0.1, ''),           // Short-hand version
        'letter-spacing' => array(-5, 20, 1, 'em'),
        'text-transform'     => false                           // Disable sub-field (False by default) 
    )
),
@andreilupu
Copy link
Contributor

Just a hint: aici propun ca type sa fie font @georgeolaru

@georgeolaru
Copy link
Member Author

Se poate — eu m-am gandit doar ca deja avem field-ul de "typography" care ar fi putut fi "font-family" ca sa aiba sens sa folosim acum "font".

@andreilupu
Copy link
Contributor

Eu asta cred, ca typography ar trebui sa ramana ca legacy o perioada iar noul font sa reprezinte type-ul cu subfields ca font-family, font-weight sau font-size aproape ca in CSS

@georgeolaru
Copy link
Member Author

In regula atunci, ramane font. ( sa nu uiti si de line-height, letter-spacing si text-transform)

andreilupu pushed a commit that referenced this issue Nov 1, 2016
I've added the new font type.
Stil needs some work to work and I didn't touched yet the configuration defaults and live preview

For #39
andreilupu pushed a commit that referenced this issue Nov 2, 2016
andreilupu pushed a commit that referenced this issue Nov 24, 2016
@todo I stil need to comment some code around here

For #39
@andreilupu
Copy link
Contributor

Done!

Cu mentiunea ca din config-ul initial am ajuns la cateva compromisuri precum:

  • in array-ul default, nu are rost un 'font-subset' => 'latin-ext,cyrillic', pentru ca el vine oricum latin by default.
  • lista de recomandate ramane pe primul nivel si NU o sa fie in fields -> font-family
  • load_all_weights ramane pe primul nivel si NU in fields -> font-weight

@georgeolaru georgeolaru modified the milestone: 1.3.0 Dec 7, 2016
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

2 participants