Posted by mondrake on September 27, 2012 at 2:24pm
4 followers
| Project: | @font-your-face |
| Version: | 7.x-2.x-dev |
| Component: | Code (general) |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hi,
I need to have access to the url of .ttf files stored locally (I use the uploaded fonts for GD manipulations), and was wondering whether there could be a chance to have the URLs returned in the metadata property of the font object returned by fontyourface_get_fonts().
Currently I am doing the following workaround (for 'local_fonts')
... get a font object via fontyourface_get_fonts() ...
$metadata = unserialize($font->metadata);
$dirname = drupal_dirname($metadata['path']);
if ($handle = opendir($dirname)) {
while ($file = readdir($handle)) {
if (preg_match("/\.ttf/i", $file) == 1) {
return $dirname . '/' . $file;
break;
}
}
closedir($handle);
}
return NULL;but this requires scanning the entire directory of the font each time.
Thanks
Comments
#1
I don't see any problem with putting the paths in the metadata on upload. If you want to write a patch for that, I'll review and commit it.
#2
Hi, here's a patch. It adds to metadata, at upload time, an array with a key for each font file uri.
I also implemented in .install a hook_update_7200() to retrofit metadata at release update.
Thanks
#3
Looks good to me.
#4
Committed. Thanks everyone!
#5
Automatically closed -- issue fixed for 2 weeks with no activity.