I found an issue for Font Squirrel, but this seems to be an issue for Google Fonts, too.

I added "Lato 300" and when I select "-- add selector in theme CSS --" it tells me the font-family is "Lato". Then I enable Lato 900 and when I select "-- add selector in theme CSS --", I am also told the font-family is "Lato". How do I use more than one font from a family?

See screenshot for my quandary!

Comments

Drave Robber’s picture

Title: Only first font in family accessible for Google Fonts » 'Add selector in theme CSS' instructions are incomplete
Version: 7.x-2.6 » 7.x-2.x-dev
Component: Google Fonts (provider) » Code (general)
Assigned: Unassigned » Drave Robber
Category: support » bug

This is completely different from the Font Squirrel issue. There, you could import only one font from each family; here, you can import all of them, but 'add selector in theme CSS' instructions are incomplete.

edit: and this issue is not limited to Google Fonts either.

Patch coming.

Drave Robber’s picture

Status: Active » Needs review
StatusFileSize
new2.55 KB

Patch attached.

Drave Robber’s picture

Assigned: Drave Robber » Unassigned

(review can be done by anyone but the author :)

sreynen’s picture

Status: Needs review » Needs work

Some font records have empty values for css_style and/or css_weight, which will output invalid CSS with the current patch. Changing if (fontStyle != 'normal') to if (fontStyle != 'normal' && fontStyle != '') (and same for fontWeight) is probably enough, though we could also cut down on page size a bit by removing the empty data-* attributes from the HTML as well.

Drave Robber’s picture

Status: Needs work » Needs review
StatusFileSize
new3.73 KB

Good point. And if we're not displaying 'normal', there's no point in passing it at all.
And while we're on this, instructions on the edit page need fixing, too.

Patch attached.

Drave Robber’s picture

Title: 'Add selector in theme CSS' instructions are incomplete » 'Add selector in theme CSS' instructions are broken and incomplete
StatusFileSize
new4.01 KB
sreynen’s picture

Status: Needs review » Fixed

Looks good. Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.