returns whether font is installed or not.

@param {String} fontName
@return {Boolean}
160911
function (fontName) {
    var testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS';
    var $tester = $('<div>').css({
      position: 'absolute',
      left: '-9999px',
      top: '-9999px',
      fontSize: '200px'
    }).text('mmmmmmmmmwwwwwww').appendTo(document.body);

    var originalWidth = $tester.css('fontFamily', testFontName).width();
    var width = $tester.css('fontFamily', fontName + ',' + testFontName).width();

    $tester.remove();

    return originalWidth !== width;
  }
204963
def open_font(self, name):
        """"""
        fid = self.display.allocate_resource_id()
        ec = error.CatchError(error.BadName)

        request.OpenFont(display = self.display,
                         onerror = ec,
                         fid = fid,
                         name = name)
        self.sync()

        if ec.get_error():
            self.display.free_resource_id(fid)
            return None
        else:
            cls = self.display.get_resource_class('font', fontable.Font)
            return cls(self.display, fid, owner = 1)
884024
def com_google_fonts_check_name_familyname(ttFont, style, familyname_with_spaces):
  
  from fontbakery.utils import name_entry_id
  failed = False
  only_weight = get_only_weight(style)
  for name in ttFont['name'].names:
    if name.nameID == NameID.FONT_FAMILY_NAME:

      if name.platformID == PlatformID.MACINTOSH:
        expected_value = familyname_with_spaces

      elif name.platformID == PlatformID.WINDOWS:
        if style in ['Regular',
                     'Italic',
                     'Bold',
                     'Bold Italic']:
          expected_value = familyname_with_spaces
        else:
          expected_value = " ".join([familyname_with_spaces,
                                     only_weight]).strip()
      else:
        failed = True
        yield FAIL, ("Font should not have a "
                     "{} entry!").format(name_entry_id(name))
        continue

      string = name.string.decode(name.getEncoding()).strip()
      if string != expected_value:
        failed = True
        yield FAIL, ("Entry {} on the 'name' table: "
                     "Expected '{}' "
                     "but got '{}'.").format(name_entry_id(name),
                                             expected_value,
                                             string)
  if not failed:
    yield PASS, "FONT_FAMILY_NAME entries are all good."
1303594
def find_font(font_name):
    """"""
    if font_name in STANDARD_FONT_NAMES:
        return font_name, True
    elif font_name in _registered_fonts:
        return font_name, _registered_fonts[font_name]

    NOT_FOUND = (None, False)
    try:
        # Try first to register the font if it exists as ttf,
        # based on ReportLab font search.
        registerFont(TTFont(font_name, '%s.ttf' % font_name))
        _registered_fonts[font_name] = True
        return font_name, True
    except TTFError:
        # Try searching with Fontconfig
        try:
            pipe = subprocess.Popen(
                ['fc-match', '-s', '--format=%{file}\\n', font_name],
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
            )
            output = pipe.communicate()[0].decode(sys.getfilesystemencoding())
            font_path = output.split('\n')[0]
        except OSError:
            return NOT_FOUND
        try:
            registerFont(TTFont(font_name, font_path))
        except TTFError:
            return NOT_FOUND
        # Fontconfig may return a default font totally unrelated with font_name
        exact = font_name.lower() in os.path.basename(font_path).lower()
        _registered_fonts[font_name] = exact
        return font_name, exact
1144712
function findRegisteredFontSet(alias) {
    var useDefault = angular.isUndefined(alias) || !(alias && alias.length);
    if (useDefault) {
      return config.defaultFontSet;
    }

    var result = alias;
    angular.forEach(config.fontSets, function(fontSet) {
      if (fontSet.alias === alias) {
        result = fontSet.fontSet || result;
      }
    });

    return result;
  }
1368938
public static boolean registerFont(@NonNull ITypeface font) {
        validateFont(font);

        FONTS.put(font.getMappingPrefix(), font);
        return true;
    }
581185
def com_google_fonts_check_family_has_license(licenses):
  """"""
  if len(licenses) > 1:
    yield FAIL, Message("multiple",
                        ("More than a single license file found."
                         " Please review."))
  elif not licenses:
    yield FAIL, Message("no-license",
                        ("No license file was found."
                         " Please add an OFL.txt or a LICENSE.txt file."
                         " If you are running fontbakery on a Google Fonts"
                         " upstream repo, which is fine, just make sure"
                         " there is a temporary license file in"
                         " the same folder."))
  else:
    yield PASS, "Found license at '{}'".format(licenses[0])
1094921
def font_attribute(styles={})
      return nil if styles.nil?
      value = styles[:font]
      return nil unless value && value.is_a?(UIFont)
      value
    end
865886
function fontSet(alias, className) {
    config.fontSets.push({
      alias: alias,
      fontSet: className || alias
    });
    return this;
  }
488387
function isBoldBroken(document) {
  var body = document.getElementsByTagName('body')[0];
  var terminal = document.createElement('div');
  terminal.className = 'terminal';
  var line = document.createElement('div');
  var el = document.createElement('span');
  el.innerHTML = 'hello world';
  line.appendChild(el);
  terminal.appendChild(line);
  body.appendChild(terminal);
  var w1 = el.scrollWidth;
  el.style.fontWeight = 'bold';
  var w2 = el.scrollWidth;
  body.removeChild(terminal);
  return w1 !== w2;
}
26540
private Font createfont(String fontName) {
		Font f1 = null;
		int pos=-1;
		do {
			f1 = FontFactory.getFont(fontName);
			
			if(f1.getBaseFont() != null) break;	// found a font, exit the do/while
			
			pos = fontName.lastIndexOf(' ');	// find the last space
			if(pos>0) {
				fontName = fontName.substring(0, pos );	// truncate it to the last space
			}
		} while(pos>0);
		return f1;
	}
489081
public boolean isOtherFont(Font font) {
        try {
            Font cFont = (Font) currentfont.peek();
            if (cFont.compareTo(font) == 0) return false;
            return true;
        }
        catch(EmptyStackException ese) {
            if (standardfont.compareTo(font) == 0) return false;
            return true;
        }
    }
281002
def com_google_fonts_check_valid_glyphnames(ttFont):
  """"""
  if ttFont.sfntVersion == b'\x00\x01\x00\x00' and ttFont.get(
      "post") and ttFont["post"].formatType == 3.0:
    yield SKIP, ("TrueType fonts with a format 3.0 post table contain no"
                 " glyph names.")
  else:
    import re
    bad_names = []
    for _, glyphName in enumerate(ttFont.getGlyphOrder()):
      if glyphName in [".null", ".notdef", ".ttfautohint"]:
        # These 2 names are explicit exceptions
        # in the glyph naming rules
        continue
      if not re.match(r'^(?![.0-9])[a-zA-Z._0-9]{1,31}$', glyphName):
        bad_names.append(glyphName)

    if len(bad_names) == 0:
      yield PASS, "Glyph names are all valid."
    else:
      from fontbakery.utils import pretty_print_list
      yield FAIL, ("The following glyph names do not comply"
                   " with naming conventions: {}\n\n"
                   " A glyph name may be up to 31 characters in length,"
                   " must be entirely comprised of characters from"
                   " the following set:"
                   " A-Z a-z 0-9 .(period) _(underscore). and must not"
                   " start with a digit or period."
                   " There are a few exceptions"
                   " such as the special character \".notdef\"."
                   " The glyph names \"twocents\", \"a1\", and \"_\""
                   " are all valid, while \"2cents\""
                   " and \".twocents\" are not."
                   "").format(pretty_print_list(bad_names))
235450
function font() {
  return src([`${svgDir}/*.svg`])
    .pipe(
      iconfontCss({
        fontName: config.name,
        path: template,
        targetPath: '../src/index.less',
        normalize: true,
        firstGlyph: 0xf000,
        cssClass: fontName // this is a trick to pass fontName to template
      })
    )
    .pipe(
      iconfont({
        fontName,
        formats
      })
    )
    .pipe(dest(srcDir));
}
13053
function fontDetect(content, fallback_font_type, options = {}){
  if (!content) {
    if (!globalOptions.isSilentMode()) console.warn('Content must be specified on knayi.fontDetect.');
    return fallback_font_type || 'en';
  }

	if (content === '')
		return content;

	if (!mmCharacterRange.test(content))
		return fallback_font_type || 'en';

	content = content.trim().replace(/\u200B/g, '');
	fallback_font_type = fallback_font_type || 'zawgyi';

  options = globalOptions.detector(options);

  if (options.use_myanmartools) {
    var myanmartools_zg_probability = myanmartoolZawgyiDetector.getZawgyiProbability(content);

    if (myanmartools_zg_probability < options.myanmartools_zg_threshold[0]) {
  		return 'unicode';
  	} else if (myanmartools_zg_probability > options.myanmartools_zg_threshold[1]) {
  		return 'zawgyi';
  	} else {
  		return fallback_font_type;
  	}

  } else {
    var match = {};

    for (var type in library.detect) {
  		match[type] = 0;

  		for (var i = 0; i < library.detect[type].length; i++) {
  			var rule = library.detect[type][i]
  			var m = content.match(rule);
  			match[type] += (m && m.length) || 0;
  		}
  	}

    if (match.unicode > match.zawgyi) {
  		return 'unicode';
  	} else if (match.unicode < match.zawgyi) {
  		return 'zawgyi';
  	} else {
  		return fallback_font_type;
  	}

  }
}
925404
function (fontSpans) {
        var detected = false
        for (var i = 0; i < baseFonts.length; i++) {
          detected = (fontSpans[i].offsetWidth !== defaultWidth[baseFonts[i]] || fontSpans[i].offsetHeight !== defaultHeight[baseFonts[i]])
          if (detected) {
            return detected
          }
        }
        return detected
      }
1060849
protected function getFontFamily(string $fontname = null): string
    {
        /**
         * Font sets to be used for PDF documents:
         *
         *   - Arial           - Times             - Tahoma
         *   - Georgia         - Trebuchet         - Courier
         *   - Lucida          - Lucida-Bright     - Palatino
         *   - Garamond        - Verdana           - Console
         *   - Monaco          - Helvetica         - Calibri
         *   - Avant-Garde     - Cambria
         */
        return array_key_exists(strtolower($fontname), $this->fontFamily)
            ? $this->fontFamily[strtolower($fontname)]
            : $this->fontFamily['default'];
    }