https://helpx.adobe.com/fonts/using/add-fonts-website.html#Createawebpro...
Typekit is now Adobe Fonts
We used to organize web fonts for a particular site into a kit; now we call that a web project.
The fonts are still added to your website with the embed code that we provide
There is nowhere to enter a domain as was done previously with Typekit. I pestered Adobe and they said:
The new approach has no domain restrictions!
But when I set up a new 'project' I cannot seem to connect it to the site using the module (my typekit credentials are in, as usual). All the old sites/kits work fine.
Adobe wants me to insert code into like this:
<link rel="stylesheet" href="https://use.typekit.net/tfg6xoz.css">
is there a way to use the module as it exists? or will this require adjustment?
thanks!!!
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | disable-domain-check-3007966-16.patch | 4.79 KB | junaidpv |
| #12 | 8.x-3.x-disable-domain-check-3007966-12.patch | 4.4 KB | junaidpv |
| #10 | disable-domain-check-3007966-10.patch | 3.01 KB | junaidpv |
| #9 | inter-diff-7-to-9.patch | 2.77 KB | junaidpv |
| #9 | disable-domain-check-3007966-9.patch | 3.42 KB | junaidpv |
Comments
Comment #2
stellarvisions commentedNot relevant to the primary issue, just trying a temporary workaround.
I tried calling on the external stylesheet from template.php as noted below.
https://www.drupal.org/docs/7/theming/working-with-css/adding-style-shee...
Cleared caches, and put font in stylesheet, and it's being called upon in the HTML, but font not appearing.
Comment #3
droprocker commentedIs there a need for a/this module anyway in case of Adobe Fonts?
You can just copy the code
<link rel="stylesheet" href="https://use.typekit.net/tfg6xoz.css">and paste it in your head-section in html.html.twig and add your fonts in your CSS file. Its fast, its simple and theres no need to blow up drupal code with an module not serving any extra benefit for this task.
I kinda love the new approach of Adobe fonts, cause everyone can implement fonts easily with just ONE line of extra code. So just uninstall font-your-face and enjoy. ;-)
By the way, this is also an 8.x issue.
Comment #4
stellarvisions commentedThanks, this is what we will do going forward. For Drupal 7 would it be the html.tpl.php.
We will have some challenges because we have customers who share themes . . . but we'll figure it out.
thanks again.
Comment #5
stellarvisions commentedI see that the project ID becomes the URL, we could make at project ID variable and then call on it in the head
i will look around in documentation, but if anyone has done this, guidance appreciated
Comment #6
mikedance commentedI have run into this issue, new font imports are failing because its still attempting to match against a domain (that is no longer present from the api)
Comment #7
mikedance commentedHere is a patch to fix the problem
Comment #8
junaidpvPatch from #7 does not apply. Here is re-rolled one, also have minor improve handle it better when variant not found at Typekit.
Comment #9
junaidpvPrevious patch Improved to
Comment #10
junaidpvSorry, just understood that removing already imported fonts is not good idea!
Here is the updated patch.
Comment #11
junaidpvSame as #10 but for 8.x-3.x
Comment #12
junaidpvCorrected minor mistake in #11, it was creating blank font items when not receiving variant info. Enhanced, so font entry will get created only if a valid variant info is received.
Comment #13
Peter Buchanan commentedI'm getting the error "Typekit kit did not match current domain, ourglass8:8888" when I try to import fonts. I have other sites were the same typekit fonts were previously imported and they work OK.
Patch 12 wouldn't apply, terminal log says:
git apply -v typekit.patch
Checking patch modules/typekit_api/typekit_api.module...
error: while searching for:
$kits = typekit_api_get_kits($config->get('token'));
foreach ($kits as $kit_data) {
$kit = typekit_api_get_kit($kit_data->id, $config->get('token'));
if (typekit_api_kit_matches_domain($kit, $_SERVER['HTTP_HOST'])) {
foreach ($kit->families as $family) {
foreach ($family->variations as $variant_id) {
$variant = typekit_api_get_variant($family->id, $variant_id, $config->get('token'));
$metadata = [
'typekit_id' => $variant->id,
'variant' => $variant->font_variant,
'kit' => $kit->id,
];
$font_data = new stdClass();
$font_data->name = $variant->name;
$font_data->url = 'https://typekit.com/fonts/' . $family->slug . '#' . $variant_id;
$font_data->provider = 'typekit_api';
$font_data->css_family = "'" . implode("', '", $family->css_names) . "'";
$font_data->css_style = $variant->font_style;
$font_data->css_weight = $variant->font_weight;
$font_data->foundry_url = 'https://typekit.com/foundries/' . $variant->foundry->slug;
$font_data->metadata = $metadata;
$font = fontyourface_save_font($font_data);
$font->activate();
}
}
}
else {
Drupal::messenger()->addMessage(t('Typekit kit did not match current domain, @domain', ['@domain' => $_SERVER['HTTP_HOST']]));
}
}
Drupal::messenger()->addMessage(t('Imported Typekit kits: @kits', ['@kits' => print_r($kits, TRUE)]));
return $font_context;
error: patch failed: modules/typekit_api/typekit_api.module:106
error: modules/typekit_api/typekit_api.module: patch does not apply
I was in the fontyourface directory
Any thoughts?
Comment #14
junaidpv@Peter patch is for dev branch. You might be using current release 8.x-3.2 of the module. Please try current dev release then you can apply the patch.
Comment #15
greenskunkThis works on the latest dev at 8.x-3.x-dev from 29 Mar 2023.
Comment #16
junaidpvRe-rolled for the latest release 4.0.0