Enabling the "ct" ligature feature in Google Web Fonts

In my current project, I am using the IM Fell English font. You can find it here:

This font supports ligatures such as "ff", "fi", "ft", and even the "long s" ſ.

However, I'm facing an issue with getting the "ct" ligature to work correctly, although the glyph is present in the font. You can see it here too: 1) and 2)

I've attempted to use the CSS property font-variant-ligatures following the instructions provided here, but it hasn't made a difference no matter what value I set: https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-ligatures

To address this issue temporarily, I've replaced the "s" with the Unicode character "ſ". However, I haven't been able to find a similar Unicode character for the "ct" ligature (or a joining glyph).

Furthermore, to make the long ſ work, I had to import the font in this manner:

@import url('https://fonts.googleapis.com/css?family=IM+Fell+English:400,400i&subset=all&text=+!%22%23$%25%26()*%2B,-.%2F0123456789:;%3C%3D%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5Dabcdefghijklmnopqrstuvwxyz%7B%7D%C2%A2%C2%A3%C2%A5%C2%A9%C2%AE%C3%97%C3%B7%C5%BF%E2%80%98%E2%80%99%E2%80%9C%E2%80%9D%E2%82%AC');

I managed to obtain the value for the text parameter by inputting the long ſ into the preview field on the Google Font webpage for IM Fell English and then observing the request sent out by my browser.

Below, you'll see that I desperately need to resolve this! (Note the "ct" in "Octaves"; while I've fixed the long ſ in titles, the paragraphs remain unchanged)

Recreation: https://i.sstatic.net/pDbbh.png Original Source: https://i.sstatic.net/2iman.png


Edit: I've discovered a workaround. I proceeded to download the IM Fell English font and utilized Character Map (available on Windows 10) to locate the glyph and copy it (U+E004 Private Use). Now, I face the challenge of being unable to search (using Ctrl F) for anything containing the ligature! Therefore, I cannot search for "Octaves" since it now appears as "Oaves".

I still believe the original question posed in the title remains unanswered. Instead of resorting to workarounds, I seek a solution where the browser enforces the ligature, if feasible.

Answer №1

According to Eana Hufwe, Google will automatically remove additional substitution features when requesting the font through the API. Instead, you will receive a subset that matches the current language on your page (or more specifically, the text used in it).

1. Get the complete "un-substituted" woff2 file

You can obtain the complete woff2 file using the developer API. In the example below, a static copy of the JSON response is utilized. Getting an API key is free and simple (Refer to the documentation) and gives access to the most recent font list from Google.

/*
//if you obtained an API key use this dynamic query URL
let format = 'woff2'
let apiKey = "";
let apiURL = `https://www.googleapis.com/webfonts/v1/webfonts?capability=VF&capability=${format}&sort=style&key=${apiKey}`;
*/

let apiURL = "https://cdn.jsdelivr.net/gh/herrstrietzel/fonthelpers@main/json/gfontsAPI_woff2.json";


// get font item
let fontFamily = "IM Fell English";
let familyQuery = fontFamily.replaceAll(" ", "+");
let fontList

( async()=>{
  fontList =  await (await (await fetch(apiURL)).json() ).items;
  //get data options
  populateDatalist(fontsDataOptions, fontList)

  //init
  inputFont.dispatchEvent(new Event('change'))

})()

inputFont.addEventListener('change', e=>{
  fontFamily = inputFont.value
  let item = fontList.filter(item => item.family === fontFamily)[0];
  let fontUrl = item.files.regular
  
  a_woff2.href = fontUrl
  a_woff2.textContent = fontUrl
  
})

function populateDatalist(target, list) {
  let datalistOptions = "";
  list.forEach((font) => {
      datalistOptions += `<option >${font.family}</option>`;
  });
  target.insertAdjacentHTML("beforeend", datalistOptions);
}
<fieldset>
  <legend>Get font from API </legend>
  <input id="inputFont" type="text" list="fontsDataOptions" value="IM Fell English" placeholder="Search for google font">
  <datalist id="fontsDataOptions"></datalist>


</fieldset>
<p><strong>Woff font URL: </strong>
  <a id="a_woff2" href=""></a>
</p>

2. Explore font-features

Upload your font to the UI helper wakamaifondue.com.
This tool will display all available features of the font along with a stylesheet containing all CSS font-feature-settings

https://i.sstatic.net/OSg6G.png

@font-face {
  font-family: "IM Fell English";
  src: url('https://fonts.gstatic.com/s/imfellenglish/v14/Ktk1ALSLW8zDe0rthJysWrnLsAz3EqmZVY9Y5w.woff2');
  font-weight: 400;
  font-style: normal
}

body {
  font-size: 8vw;
  font-family: "IM Fell English";
}

.im-fell-english-roman-dlig {
  font-feature-settings: "dlig" on;
  /* font-variant-ligatures: discretionary-ligatures; */
}

.im-fell-english-roman-ss01 {
  font-feature-settings: "ss01" on;
}
<p>
  <span class="im-fell-english-roman-dlig">
    ct ſs
</span>
  <span class="im-fell-english-roman-ss01">
    sa sb sc sd se sf sg sh si sj sk sl sm sn so sp sq sr ss st su sv sw sx sy sz sà sá sâ sã sä så sæ sç sè sé sê së sì sí sî sï sð sñ sò só sô sõ sö sø sù sú sû sü sý sþ sÿ sā să są sć sč sď sđ sē sė sę sě sğ sģ sī sį sķ sĺ sļ sľ sł sń sņ sň sō ső sœ sŕ sŗ sř sś sş sš sţ sť sū sů sű sų sŵ sŷ sź sż sž sș sẁ sẃ sẅ sỳ
</span>
</p>

<h3>No features appllied</h3>
<p>
    ct ſs
    sa sb sc sd se sf sg sh si sj sk sl sm sn so sp sq sr ss st su sv sw sx sy sz sà sá sâ sã sä så sæ sç sè sé sê së sì sí sî sï sð sñ sò só sô sõ sö sø sù sú sû sü sý sþ sÿ sā să să... (read more at source)

This method can also be applied to Google fonts that include special glyphs like arrows, symbols, etc. (e.g., IBM Plex).

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The click event on a card is not triggering on a cloned item in the Owl Carousel 2

I have implemented owl carousel to showcase products, where each product is displayed on a card with an 'add to cart' button. However, I am facing an issue where the 'add to cart' button on a cloned item does not trigger the click event ...

Include the array in the 'content' property of the CSS using Jquery

I need help formatting data in CSS. The code I have is as follows: if (ext){ switch (ext.toLowerCase()) { case 'doc': pos = 'doc'; break; case 'bmp': pos = 'bmp'; break; ...

Display the HTML/CSS layout following the JavaScript window.open action

Encountering issues with printing output in an opened window using JavaScript. I'm creating a new document through window.open and including CDN links to Bootstrap files. While everything appears fine in the opened window, when attempting to print (XP ...

Using Material UI v1 to customize the widths of table columns

I am looking to configure column widths on a Material UI table using CSS, rather than within React with "classes." However, I am struggling to understand how the column widths are actually controlled. Despite trying to set widths on the TH columns, it does ...

Bulma: Tips for creating equally sized buttons?

I am working with Bulma CSS and trying to ensure that all my buttons are the same size. Currently, each button appears to have a different size based on the text content. I have looked into using the "is-fullwidth" option, but it makes the buttons too la ...

The hover effect does not work when clicking the mouse button in the Chrome browser

All: [UPDATE] Another method I discovered to achieve this is not a solution, but rather a workaround: Utilize the mousedown event as a trigger (since a drag action is needed, a mousedown event is required), within that, attach a mouseover event to that sp ...

Attempting to link two JavaScript files, however, only one of them is functioning correctly

I'm currently experiencing an issue with my HTML page that involves calling two JS files for two different image sliders on the same website page. One slider works perfectly fine while the other does not. I'm confused as to whether it's perm ...

I am having trouble with my scroll reveal effects on JavaScript, how can I troubleshoot and fix the issue?

I'm currently making updates to my portfolio website, but for some reason, the scroll reveal animation has suddenly stopped working. I made a few edits and now it seems to be broken. /*===== SCROLL REVEAL ANIMATION =====*/ const sr = ScrollReveal({ ...

Bootstrap 4 offers a full-height, full-width layout that is optimized for Chrome, but may not display as well on Firefox or

My current project has a basic prototype that functions fine in Chrome, but encounters issues in Firefox and IE11. I am utilizing 'container-fluid' for full-width, 'h-100' for full-height, and 'overflow-y' to enable vertical s ...

Create a new division directly underneath the bootstrap column

Imagine having a bootstrap table like this: https://i.sstatic.net/kXHiP.jpg Now, if you want to click on a column and open a div with more details below it, is it achievable with CSS or JavaScript? https://i.sstatic.net/HIfkK.jpg I tried using the Metr ...

Steps to Change the Background Color to White in a Dropdown menu

Hello everyone! I'm currently using this codepen example on my website. My query is regarding the fifth panel - is it possible to change the color of the drop-down box when clicking on it? Here's a snippet of the HTML: <link href='https: ...

Can you please explain the meaning of this wildcard symbol?

We recently came across a part of our grunt file that was written by a former colleague. While the code functions correctly, the specific purpose of one segment remains a mystery to us! Here is the enigmatic code snippet: dist: { files: [{ ex ...

What could be the reason for the gap that shows up when transitioning from one image to the

Check out my website at: This section discusses: https://i.sstatic.net/WTTxJ.gif At the bottom of the image, a 'gap' appears. Instead of using standard HTML img tags, I used Next.js Image like this: <Image src="https://ticket- ...

Tips for adding CSS styling to the action button within the ShinyWidgets package in Shiny applications

I have created a shiny app example below. In order to align the actionButton with selectInput, I had to include style='margin-top:25px'. The Shinywidgets package offers actionBttn widgets with predefined styles. For instance, I prefer the one wit ...

Showcasing Portfolio Work in a User-Friendly Mobile Design

Currently revamping my portfolio website and looking for ways to optimize the display of my personal projects. I have a card-like interface in place that works well on desktop but only shows one project at a time on mobile devices. Seeking solutions to imp ...

What is the best way to position a div as a footer within a larger main div?

I am aiming to create a div with simple header, content, and footer sections. Here is the design I am trying to achieve: https://i.stack.imgur.com/QfnGa.png You can check out my code on jsfiddle. I'm having trouble understanding how the relative lay ...

The CSS background fails to expand to the entire height of the element

I'm encountering an issue where an element with 100% height is extending beyond its boundaries when there are multiple blocks. For a demonstration, you can refer to this jsfiddle example: http://jsfiddle.net/yPqKa/ Any suggestions on how to resolve ...

Ways to align one child to the end without affecting any other elements

I'm attempting to position only div3 at the flex-end of .app. If I use this code: .app { display: flex; flex-direction: column; height: 100vh; justify-content: flex-end; } Div3 goes where I want it, but everything else also moves dow ...

Creating a responsive image using Bootstrap with an SVG filter applied

I've been working on applying an SVG filter to responsive images in Bootstrap 4 by using the class "img-fluid" However, I'm facing an issue where the separation between images varies across different resolutions. It's fine on desktop, but o ...

Creating a Dynamic Soundtrack: How to Embed an Audio

Success! I finally figured it out, with a little help from everyone. I've been diving into the world of Audio Playlists in HTML and attempted to follow a tutorial on the topic found here: https://www.youtube.com/watch?v=vtZCMTtP-0Y. However, I encoun ...