Skip to content

Add support for multiple font styles#212

Merged
mondeja merged 1 commit intosimple-icons:developfrom
LitoMore:aspect-ratio-viewbox
May 31, 2025
Merged

Add support for multiple font styles#212
mondeja merged 1 commit intosimple-icons:developfrom
LitoMore:aspect-ratio-viewbox

Conversation

@LitoMore
Copy link
Copy Markdown
Member

@LitoMore LitoMore commented Sep 11, 2024

Related to #222
Resolves #211

Get a preview build

Download it from: simple-icons-font-multi-styles.zip

Changes

  • This changed the default font style to the same aspect ratio as the icon. Users still can use the squared version with the SimpleIcons-Squared.[ext] font file
  • Re-organized the font file locations since we added a new style
  • Specify the font-style in the font SVG template

Web browser preview

Typeface preview

Before After

File tree

font
├── simple-icons.css
├── simple-icons.min.css
├── simple-icons.json
├── simple-icons.min.json
├── SimpleIcons.eot
├── SimpleIcons-Fit.eot
├── SimpleIcons.otf
├── SimpleIcons-Fit.otf
├── SimpleIcons.svg
├── SimpleIcons-Fit.svg
├── SimpleIcons.ttf
├── SimpleIcons-Fit.ttf
├── SimpleIcons.woff
├── SimpleIcons-Fit.woff
├── SimpleIcons.woff2
└── SimpleIcons-Fit.woff2

@LitoMore LitoMore force-pushed the aspect-ratio-viewbox branch 2 times, most recently from a873aae to 1d8c5e4 Compare December 28, 2024 14:34
@LitoMore LitoMore changed the title Use a viewbox with the same aspect ratio as the icon entity Add support for multiple font styles Dec 28, 2024
@LitoMore LitoMore marked this pull request as ready for review December 28, 2024 15:04
@LitoMore LitoMore requested a review from mondeja December 28, 2024 15:04
@LitoMore LitoMore added the enhancement New feature or request label Dec 28, 2024
@LitoMore LitoMore force-pushed the aspect-ratio-viewbox branch 4 times, most recently from 9d85bcd to a32ed69 Compare December 29, 2024 04:40
@LitoMore LitoMore force-pushed the aspect-ratio-viewbox branch from a32ed69 to 5827c9b Compare January 6, 2025 21:21
@mondeja
Copy link
Copy Markdown
Member

mondeja commented Jan 12, 2025

This seems like a breaking change to me. Can we prepare it for v15?

@LitoMore
Copy link
Copy Markdown
Member Author

This seems like a breaking change to me. Can we prepare it for v15?

Sure. Let's convert it to draft.

@LitoMore LitoMore marked this pull request as draft January 12, 2025 23:21
@LitoMore LitoMore added the breaking change Issues or pull requests that include a breaking change and scheduled for the next major release label Jan 12, 2025
@LitoMore LitoMore force-pushed the aspect-ratio-viewbox branch from 5827c9b to 9291e74 Compare January 12, 2025 23:26
@mondeja mondeja added this to the v15.0.0 milestone Jan 12, 2025
@LitoMore LitoMore force-pushed the aspect-ratio-viewbox branch from 9291e74 to b1f72f2 Compare May 31, 2025 06:43
@LitoMore
Copy link
Copy Markdown
Member Author

@mondeja Resolved conflicts and ready for review.

@LitoMore LitoMore marked this pull request as ready for review May 31, 2025 06:44
@mondeja
Copy link
Copy Markdown
Member

mondeja commented May 31, 2025

Would you mind to resolve conflicts again?

Copy link
Copy Markdown
Member

@mondeja mondeja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the regular style should keep the old file name. Adding -Regular to the file name only confuses and adds a breaking change to most consumers of this library providing no benefits.

@LitoMore
Copy link
Copy Markdown
Member Author

I think that the regular style should keep the old file name. Adding -Regular to the file name only confuses and adds a breaking change to most consumers of this library providing no benefits.

Good point. Do you have a good suggestion for the new style name? What about Fit?

@mondeja
Copy link
Copy Markdown
Member

mondeja commented May 31, 2025

I think that the regular style should keep the old file name. Adding -Regular to the file name only confuses and adds a breaking change to most consumers of this library providing no benefits.

Good point. Do you have a good suggestion for the new style name? What about Fit?

If it provides the same functionality than viewbox=auto in the CDN, probably viewbox-auto or ViewboxAuto or viewbox=auto or viewbox or whatever, to maintain the same API. But I'm not totally sure if that would be better than Fit anyway, so as you want.

@LitoMore LitoMore force-pushed the aspect-ratio-viewbox branch from b1f72f2 to 1f82827 Compare May 31, 2025 07:55
@LitoMore
Copy link
Copy Markdown
Member Author

Thanks for your thoughts. I think auto-viewbox is more for SVGs, and fit would be better for font style names.

I've kept the old icon style as Regular. And the new icon style is Fit.

It's ready for review now.

@LitoMore LitoMore requested a review from mondeja May 31, 2025 07:57
Copy link
Copy Markdown
Member

@mondeja mondeja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm probably not expressing myself correctly. What I was saying earlier is that I think that the generated directory structure should be like this:

font
├── Fit
│   ├── SimpleIcons-Fit.eot
│   ├── SimpleIcons-Fit.otf
│   ├── SimpleIcons-Fit.svg
│   ├── SimpleIcons-Fit.ttf
│   ├── SimpleIcons-Fit.woff
│   └── SimpleIcons-Fit.woff2
├── simple-icons.css
├── SimpleIcons.eot
├── SimpleIcons.json
├── simple-icons.min.css
├── SimpleIcons.min.json
├── SimpleIcons.otf
├── SimpleIcons.svg
├── SimpleIcons.ttf
├── SimpleIcons.woff
└── SimpleIcons.woff2

Instead of the one currently being generated, which is this:

font
├── eot
│   ├── SimpleIcons-Fit.eot
│   └── SimpleIcons-Regular.eot
├── otf
│   ├── SimpleIcons-Fit.otf
│   └── SimpleIcons-Regular.otf
├── simple-icons.css
├── SimpleIcons.json
├── simple-icons.min.css
├── SimpleIcons.min.json
├── svg
│   ├── SimpleIcons-Fit.svg
│   └── SimpleIcons-Regular.svg
├── ttf
│   ├── SimpleIcons-Fit.ttf
│   └── SimpleIcons-Regular.ttf
├── woff
│   ├── SimpleIcons-Fit.woff
│   └── SimpleIcons-Regular.woff
└── woff2
    ├── SimpleIcons-Fit.woff2
    └── SimpleIcons-Regular.woff2

For several reasons:

  • Avoid the breaking change for consumers of needing to change the file used. This is a breaking change for most of them that does not offer benefits.
  • Less directories.
  • Less weird names in fonts.

@LitoMore
Copy link
Copy Markdown
Member Author

LitoMore commented May 31, 2025

How about this?

font
├── simple-icons.css
├── simple-icons.min.css
├── simple-icons.json
├── simple-icons.min.json
├── SimpleIcons.eot
├── SimpleIcons.otf
├── SimpleIcons.svg
├── SimpleIcons.ttf
├── SimpleIcons.woff
├── SimpleIcons.woff2
├── SimpleIcons-Fit.eot
├── SimpleIcons-Fit.otf
├── SimpleIcons-Fit.svg
├── SimpleIcons-Fit.ttf
├── SimpleIcons-Fit.woff
├── SimpleIcons-Fit.woff2

I've moved all font files to the same directory. I also changed the data JSON file name to simple-icons.json and simple-icons.min.json.

@LitoMore LitoMore force-pushed the aspect-ratio-viewbox branch from 1f82827 to 600bfa9 Compare May 31, 2025 09:25
@LitoMore LitoMore requested a review from mondeja May 31, 2025 09:33
Copy link
Copy Markdown
Member

@mondeja mondeja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better. Thank you, this is great!

@mondeja mondeja removed the breaking change Issues or pull requests that include a breaking change and scheduled for the next major release label May 31, 2025
@mondeja mondeja merged commit 9a809c2 into simple-icons:develop May 31, 2025
5 checks passed
@LitoMore LitoMore deleted the aspect-ratio-viewbox branch May 31, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use a viewbox with the same aspect ratio as the icon entity

2 participants