Skip to content

User agents and font formats #7

@timwhitlock

Description

@timwhitlock

I have no idea if this is against the API terms of use, but if you were considering expanding your script to download other formats, you might try sending alternative user agent strings to the CSS end point.

I've tested a bunch of browsers and note the following font types are generated:

.woff2
Modern browser user agents produce this (as you are doing already).

.woff
Edge version < 14, e.g:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240

.eot (embedded-opentype)
Ancient Internet Explorer, e.g:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)

.ttf (truetype)
Seems to be the default.

Then presuming you had all these formats, you could generate a rule like this:

@font-face {
  font-family: "Name";
  src:url("font.eot");
  src:url("font.eot#iefix") format('embedded-opentype'),
      url("font.woff2") format("woff2"),
      url("font.woff") format("woff"),
      url("font.ttf") format("truetype");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions