For most activity, you'll want to see the fonts, so Drush doesn't make a lot of sense, but I think we could at least do imports via Drush.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Drave Robber’s picture

Assigned: Unassigned » Drave Robber

Also, we can have it return general status information, along the lines of:

usb@paddock:/var/www/fyf$ drush @s

Providers enabled (4):
edge_fonts, fontsquirrel, google_fonts_api, local_fonts

Fonts enabled (14):
Afta Sans Italic, Alegreya SC Black Italic, Amatic SC Bold, Andika Regular, Arvo Bold Italic, Comfortaa Bold, Dr Sugiyama Regular, Economica regular (latin-ext), Exo Regular, Gloria Hallelujah Regular, Kingthings Xstitch, Miso normal bold, Miso normal normal, Sniglet Regular

Drush allows funny aliases. :)

Drave Robber’s picture

Assigned: Drave Robber » Unassigned
Status: Active » Needs review
FileSize
4.29 KB

Patch attached.

Requires patch in #1823722: fontyourface_count_fonts() is broken to be applied first.

Import seems not to work for Font Squirrel as it is in current -dev, because fontsquirrel_fontyourface_import() does not properly return $success;
on the other hand, the new shiny batch import from #1124500: Interface for Font Squirel import only first font in family actually does not work. I need to read up on drush/batches relationship to find out why.

Drave Robber’s picture

FileSize
126.27 KB

Here's a glimpse of this in action:
screenshot
I haven't yet figured it out how to create a new command group, but neither I'm sure if it's really necessary.

BarisW’s picture

Awesome! Thanks so much for setting this up.

Can you change the message 'Imported fonts from edge_fonts' to something like this: 'Imported 1200 fonts from Edge Fonts'?
You might also want to introduce two shortcuts for these command (fyfs & fyfi)?

What are the @i and @s shortcuts for?

Drave Robber’s picture

Import functions only return TRUE/FALSE, so we won't know how many new/changed were imported; we could however get a count before and after and report it like:

Imported fonts from edge_fonts.                                      [success]
edge_fonts now has 862 fonts (+2).

@s is an alias of fyf-status; Drush seems to have no problem with such eccentric aliases.

I must confess I was tempted to make it drush ffs at first, but then there would be a risk of alias conflict if someone had similar temptation. :)

I'm open to other suggestions as to what the most appropriate aliases would be.

BarisW’s picture

What would think of:

drush font-import / drush fyfi
drush font-status / drush fyfs

Can font-import handle arguments? Like drush font-import google_fonts?

Drave Robber’s picture

FileSize
89.33 KB

Sure:
screenshot

sreynen’s picture

I don't have a strong opinion on @s vs. fyfs as the alias. I suspect fyfs would be a little easier to remember, so I'd probably learn toward that, but it's pretty easy to get a reminder of the alias either way.

Drave Robber’s picture

In fact, multiple aliases are possible - sorry for making fuss out of non-issue.

Here's a new patch. Differences to #2:
- two aliases for each command;
- found out how to create a command group;
- fyf-status handles a situation where there are enabled providers but no enabled fonts;
- for Font Squirrel, fyf-import explicitly says 'not supported yet' (let's look into it when/if the batch import patch lands);
- fyf-import reports something like 'edge_fonts now has 862 fonts (+2).' for each provider where import was successful.

sreynen’s picture

Status: Needs review » Fixed

Committed. I had to do drush cc drush (clearing the drush cache) before it noticed the new file. There may be something to do in hook_update_N() to make that unnecessary, but I think anyone using this probably knows how to do that already. And if they don't, this note is here.

Status: Fixed » Closed (fixed)

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