diff --git a/google_webfont_loader_api.module b/google_webfont_loader_api.module index 33edcb2..a0bc8fc 100755 --- a/google_webfont_loader_api.module +++ b/google_webfont_loader_api.module @@ -152,6 +152,17 @@ function _google_webfont_loader_api_load_js_from_fontinfo($font_info, $filepath) } } } + // If specified, load and use custom test strings. + if ($key == "custom_families" && is_array($font_info['custom_testStrings'])) { + foreach ($font_info['custom_testStrings'] as $string) { + /* testString should be added to info file escaped like: + custom_testStrings[] = '\\uE001\\uE002\\uE838' */ + $str = preg_replace_callback('/\\\\u([0-9a-fA-F]{4})/', function ($match) { + return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UTF-16BE'); + }, $string); + $loader_js['custom']['testStrings'][$info[0]] = $str; + } + } } return google_webfont_loader_api_add_js($loader_js); }