Skip to content

Stop blocking all fonts in FontFace

On desktop we limit fonts to bundled with a few system fonts on mac and windows

With win10 as the minimum version, and with mac being consistent (I think) - we no longer have any differences in system fonts - e.g

  • whitelisted Segoe UI (win7+)
    • Segoe UI Semilight was added in windows 8
    • Segoe UI Black was added in windows 8.1
  • whitelisted Malgun Gothic (win7+)
    • Malgun Gothic Semilight was added in windows 10

In other words, we control the fonts and all users per desktop platform should be identical (available fonts, not necessarily the same font version)

I'm not aware of any specific patch/issue that disabled the FontFace API, but it's definitely something that hasn't worked in TB for years. Is there any reason to still block it? IIUIC there's nothing in the API that should differ across users (per platform). Android is probably fine as well, especially when we turn on RFP's font.vis (except I think users could have wildly disparate font versions, not sure what that means in terms of this API)

await new FontFace('Arial','local("Arial")').load()

fonty_mcfontface

edit: here's a script for you

function getFontFace() {
	function getLocalFontFamily(font) {
		return new FontFace(font, `local("${font}")`)
			.load()
			.then((font) => font.family)
			.catch(() => null)
	}
	function loadFonts(fonts) {
		return Promise.all(fonts.map(getLocalFontFamily))
			.then(list => list.filter(font => font !== null))
	}
	let fntList = [
		'Arial Black','Arial Narrow','Segoe UI Light','Segoe UI Semibold', // 7
		'Segoe UI Semilight', // 8
		'Microsoft JhengHei Light','Microsoft YaHei Light','Segoe UI Black', // 8.1
		'Malgun Gothic Semilight', // 10
	]
	loadFonts(fntList).then(function(results){
		console.log(results)
	})
}

cc @pierov

Edited by Thorin
OSZAR »