custom font size presets does not work

Created on 14 March 2023, over 1 year ago
Updated 21 May 2024, about 1 month ago

I followed this doc:
https://www.drupal.org/docs/8/modules/gutenberg/creating-custom-font-siz... β†’

But it did not work, it shows the default fonts. I tested on a paragraph block.

πŸ› Bug report
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΎUruguay rpayanm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @rpayanm
  • πŸ‡ΊπŸ‡ΈUnited States joshuasosa

    I'm also unable to get font sizes to work with the provided instructions. It just shows the default set of font size options.

  • πŸ‡΅πŸ‡ΉPortugal marcofernandes

    It should work. But for versions >= 2.6, these settings were deprecated and font sizes should be set at the following section:

    - theme-support
      - __experimentalFeatures
      - typography
      - fontSizes
        - theme
          - name: ...
    

    We need to update the documentation.
    Anyway, make sure the configuration is at the theme folder and it's called [theme-name].gutenberg.yml. The theme must be active.

  • Pipeline finished with Success
    about 1 month ago
    Total: 407s
    #176420
  • Pipeline finished with Success
    about 1 month ago
    Total: 543s
    #176426
  • πŸ‡ΊπŸ‡ΈUnited States joshuasosa

    I have a custom theme for the front-end but use Claro for admin theme.

    In mytheme.gutenberg.yml I tried using your syntax:

    - theme-support:
      - __experimentalFeatures:
        - typography:
          - fontSizes:
            - theme:
              - name: "Small"
                slug: "small"
                size: 14
              - name: "Lead"
                slug: "lead"
                size: 20
              - name: "Display 1"
                slug: "display-1"
                size: 96
              - name: "Display 2"
                slug: "display-2"
                size: 88
              - name: "Display 3"
                slug: "display-3"
                size: 72
              - name: "Display 4"
                slug: "display-4"
                size: 56

    That didn't seem to work, so I tried without the hyphens:

    theme-support:
      __experimentalFeatures:
        typography:
          fontSizes:
            theme:
              - name: "Small"
                slug: "small"
                size: 14
              - name: "Lead"
                slug: "lead"
                size: 20
              - name: "Display 1"
                slug: "display-1"
                size: 96
              - name: "Display 2"
                slug: "display-2"
                size: 88
              - name: "Display 3"
                slug: "display-3"
                size: 72
              - name: "Display 4"
                slug: "display-4"
                size: 56

    That worked and I can see a dropdown of my specified font sizes.

    I was also able to get custom colors in like this:

    theme-support:
      __experimentalFeatures:
        color:
          background: true
          button: true
          caption: true
          defaultDuotone: false
          defaultGradients: false
          text: true
          defaultPalette: false
          heading: true
          link: true
          palette:
            theme:
              - slug: "blue"
                name: "Blue"
                color: "#0000FF"
              - slug: "red"
                name: "Red"
                color: "#CC0000"

    Thanks!

  • Status changed to Closed: works as designed about 1 month ago
  • πŸ‡΅πŸ‡ΉPortugal marcofernandes

    Oh.. I put the hyphens for better readability but now I see it just added confusion. Sorry about that. Anyway, I'm glad it work.

  • Pipeline finished with Success
    about 1 month ago
    Total: 318s
    #180383
  • Pipeline finished with Success
    24 days ago
    Total: 217s
    #190175
  • Pipeline finished with Success
    4 days ago
    Total: 301s
    #206694
Production build 0.69.0 2024