I have written a small module that lets one play around with enabled fonts, switching them on the fly.

Sandbox: Live webfont preview (proof of concept)
git: git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/DraveRobber/1817852.git live_webfont_preview

It's going to need more work to make it neater and compatible with more browsers, but the approach itself could use some review now.

Comments

Drave Robber’s picture

Status: Active » Needs review

(issue status)

sreynen’s picture

Status: Needs review » Needs work

I'm always interested in slimming down the main project by moving submodules out, but I'd be happy to include this if you'd rather not maintain it as a separate project. It seems like it could be really useful, but it still needs work. Some notes:

  1. I think this should have a separate permission. I can imagine a site builder might use this to allow a client to see some different font options, and they'd want to give the client access to the preview without giving access to any of the other font admin screens.
  2. Using drupal_html_class($font->name) for a class seems to cause problems, I suspect due to fonts that have ™ or ® in the name. I'm not sure why, but I think this is worth changing for other reasons, namely $font->name isn't necessarily unique, which could cause some confusing behavior. I replaced this with $font->fid, which is always unique, and that seemed to also fix the pages where it wasn't working.
  3. I think ul.lwp-box should be a single element that moves when you hover over the @. It sometimes gets stuck behind other elements, and I think moving it up to the body would solve this. It also just feels cleaner to not have several copies of the same element. Plus, having the @ directly inside the ul makes me cringe. :)
  4. It would be great to have an optional key command to turn the @ on and off, to quickly see the preview without the distraction.
Drave Robber’s picture

AFAIK text inside ul is perfectly legal HTML, at least http://validator.w3.org/ has no objections to it. Of course, we can refrain from doing this on grounds of it being "cruel and unusual". :)

Other notes are all reasonable. On 4. I was thinking about a button on the side/corner, but it's possible to have both.

About 'slimming down' and 'moving out' I'm generally somewhat skeptical, but I'll voice my doubts on IRC.

Drave Robber’s picture

1. and 2. have been implemented;
4. has been partially implemented (mouse-clickable button to toggle anchor display, no key binding yet).

As for 3, exploring options.

Drave Robber’s picture

Progress report:

  • There's no plain text inside ul anymore; however, there are still multiple control elements instead of one (I'm just not sure if perceived cleanness is worth added complexity);
  • Positioning is better but still not perfect;
  • #1859342: Respect selectors set by other modules might require some work.
Drave Robber’s picture

Status: Needs work » Needs review

#1859342: Respect selectors set by other modules is fixed;

how about another review?

Drave Robber’s picture

Status: Needs review » Closed (won't fix)

Not pushing this anymore, due to lack of interest.