src/vs/workbench/services/themes/browser/productIconThemeData.ts/resolvePath
function _processIconThemeDocument(id: string, iconThemeDocumentLocation: URI, iconThemeDocument: ProductIconThemeDocument): { content: string; warnings: string[] } {

	const warnings: string[] = [];
	const result = { content: '', warnings };

	if (!iconThemeDocument.iconDefinitions || !Array.isArray(iconThemeDocument.fonts) || !iconThemeDocument.fonts.length) {
		return result;
	}

	const iconThemeDocumentLocationDirname = resources.dirname(iconThemeDocumentLocation);
	function resolvePath(path: string) {
		return resources.joinPath(iconThemeDocumentLocationDirname, path);
	}

	const cssRules: string[] = [];

	const fonts = iconThemeDocument.fonts;
	const fontIdMapping: { [id: string]: string } = {};
	for (const font of fonts) {
		const src = font.src.map(l => `${asCSSUrl(resolvePath(l.path))} format('${l.format}')`).join(', ');
		if (isString(font.id) && font.id.match(fontIdRegex)) {
			const fontId = `pi-` + font.id;
			fontIdMapping[font.id] = fontId;

			let fontWeight = '';
			if (isString(font.weight) && font.weight.match(fontWeightRegex)) {
				fontWeight = `font-weight: ${font.weight};`;
			} else {
				warnings.push(nls.localize('error.fontWeight', 'Invalid font weight in font \'{0}\'. Ignoring setting.', font.id));
			}

			let fontStyle = '';
			if (isString(font.style) && font.style.match(fontStyleRegex)) {
				fontStyle = `font-style: ${font.style};`;
			} else {
				warnings.push(nls.localize('error.fontStyle', 'Invalid font style in font \'{0}\'. Ignoring setting.', font.id));
			}

			cssRules.push(`@font-face { src: ${src}; font-family: '${fontId}';${fontWeight}${fontStyle} }`);
		} else {
			warnings.push(nls.localize('error.fontId', 'Missing or invalid font id \'{0}\'. Skipping font definition.', font.id));
		}
	}

	const primaryFontId = fonts.length > 0 ? fontIdMapping[fonts[0].id] : '';

	const iconDefinitions = iconThemeDocument.iconDefinitions;
	const iconRegistry = getIconRegistry();


	for (let iconContribution of iconRegistry.getIcons()) {
		const iconId = iconContribution.id;

		let definition = iconDefinitions[iconId];

		// look if an inherited icon has a definition
		while (!definition && ThemeIcon.isThemeIcon(iconContribution.defaults)) {
			const ic = iconRegistry.getIcon(iconContribution.defaults.id);
			if (ic) {
				definition = iconDefinitions[ic.id];
				iconContribution = ic;
			} else {
				break;
			}
		}

		if (definition) {
			if (isString(definition.fontCharacter)) {
				const fontId = definition.fontId !== undefined ? fontIdMapping[definition.fontId] : primaryFontId;
				if (fontId) {
					cssRules.push(`.codicon-${iconId}:before { content: '${definition.fontCharacter}' !important; font-family: ${fontId} !important; }`);
				} else {
					warnings.push(nls.localize('error.icon.fontId', 'Skipping icon definition \'{0}\'. Unknown font.', iconId));
				}
			} else {
				warnings.push(nls.localize('error.icon.fontCharacter', 'Skipping icon definition \'{0}\'. Unknown fontCharacter.', iconId));
			}
		}
	}
	result.content = cssRules.join('\n');
	return result;
}