jaywcjlove / svgtofont

Read a set of SVG icons and ouput a TTF/EOT/WOFF/WOFF2/SVG font.
https://jaywcjlove.github.io/svgtofont
MIT License
520 stars 82 forks source link

modify the output based on the useNameAsUnicode switch #145

Closed bstaley closed 2 years ago

bstaley commented 2 years ago

@jaywcjlove made an update to the output base on the switch. would be interested in your opinion. with this commit files using the switch would look something like this:

@font-face {
  font-family: "my-font";
  src: url('my-font.eot?t=123'); /* IE9*/
  src: url('my-font.eot?t=123#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url("my-font.woff2?t=123") format("woff2"),
  url("my-font.woff?t=123") format("woff"),
  url('my-font.ttf?t=123') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
  url('my-font.svg?t=123#my-font') format('svg'); /* iOS 4.1- */
}

.my-prefix {
  font-family: 'my-font' !important;
  font-size:16px;
  font-style:normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

essentially there would be no reason to have the classes anymore. but i'm wondering if it would be a good idea to still have the variables. for now i omitted them. also if you wouldn't mind taking a look at the html. i'm not using it so i'm not sure if i got it a 100% right. thanks!

note: this PR isn't a 100% necessary but it will be helpful for people using this switch

bstaley commented 2 years ago

Without this pull request you get some odd results with the default css. No worries though, if you create your own templates that will solve the problem. If you decide you would like me to bring this PR back please let me know.

jaywcjlove commented 2 years ago

@bstaley I think your idea is very good.