Return a list of font names matching pattern. No more than
        max_names will be returned.
334739
def list_fonts(self, pattern, max_names):
        """"""
        r = request.ListFonts(display = self.display,
                              max_names = max_names,
                              pattern = pattern)
        return r.fonts
535342
function getNames(names) {
    var result = [];

    ['copyright', 'fontFamily', 'uniqueID', 'fontSubfamily', 'licence'].forEach(function(n) {
        if(names[n]) {
            result.push.apply(result, getStrings(names[n], TTF_NAMES[n]));
        }
    });

    result.push.apply(result, getStrings('Generated by node-freetype.', TTF_NAMES.description));
    result.push.apply(result, getStrings('https://github.com/YuhangGe/node-freetype', TTF_NAMES.url));

    result.sort(function (a, b) {
        var orderFields = ['platformID', 'encodingID', 'languageID', 'id'];
        var i;
        for (i = 0; i < orderFields.length; i++) {
            if (a[orderFields[i]] !== b[orderFields[i]]) {
                return a[orderFields[i]] < b[orderFields[i]] ? -1 : 1;
            }
        }
        return 0;
    });

    return result;
}
966957
def prettyMatcherList(things):
    """"""
    norm = []
    for x in makeSequence(things):
        if hasattr(x, 'pattern'):
            norm.append(x.pattern)
        else:
            norm.append(x)
    return "('%s')" % "', '".join(norm)
1019114
def wc_names(self):
        """"""
        if self.wc_name is None:
            res = set()
        else:
            res = set([self.wc_name])
        if self.args is not None:
            for arg in self.args:
                if isinstance(arg, Pattern):
                    res.update(arg.wc_names)
        if self.kwargs is not None:
            for val in self.kwargs.values():
                if isinstance(val, Pattern):
                    res.update(val.wc_names)
        return res
672304
def _names(lexer):
    """"""
    first = _expect_token(lexer, {NameToken}).value
    rest = _zom_name(lexer)
    rnames = (first, ) + rest
    return rnames[::-1]
1281808
def find_matches(text):
    
    """
    path = os.path.expanduser(text)
    if os.path.isdir(path) and not path.endswith('/'):
        return [ text + '/' ]

    pattern = path + '*'
    is_implicit_cwd = not (path.startswith('/') or path.startswith('./'))
    if is_implicit_cwd:
        pattern = './' + pattern
    rawlist = glob.glob(pattern)
    ret = []
    for fname in rawlist:
        if is_implicit_cwd:
            fname = fname[2:]
        if os.path.isdir(fname):
            ret.append(fname + '/')
        else:
            ret.append(fname)
    return ret
371114
def find_latex_font_serif():
  
  '''

  import os, re
  import matplotlib.font_manager

  name = lambda font: os.path.splitext(os.path.split(font)[-1])[0].split(' - ')[0]

  fonts = matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf')

  matches = [
    r'.*Computer\ Modern\ Roman.*',
    r'.*CMU\ Serif.*',
    r'.*CMU.*',
    r'.*Times.*',
    r'.*DejaVu.*',
    r'.*Serif.*',
  ]

  for match in matches:
    for font in fonts:
      if re.match(match,font):
        return name(font)

  return None
915013
def _getFontChars(self, font_files):
        
        code_points = set()
        for font_file in font_files:
            face = ft.Face(font_file)
            charcode, agindex = face.get_first_char()
            while agindex != 0:
                code_points.add(charcode)
                charcode, agindex = face.get_next_char(charcode, agindex)
        return sorted(code_points)
128075
def getAvailableGlyphnames(self):
        
        glyphNames = {}
        for locationName, (source, loc) in self.sources.items():
            for glyph in source:
                glyphNames[glyph.name] = 1
        names = sorted(glyphNames.keys())
        return names
891912
@NonNull
    public static Collection<ITypeface> getRegisteredFonts(@NonNull Context ctx) {
        init(ctx);
        return FONTS.values();
    }
790083
def com_google_fonts_check_name_family_and_style_max_length(ttFont):
  """"""
  from fontbakery.utils import (get_name_entries,
                                get_name_entry_strings)
  failed = False
  for familyname in get_name_entries(ttFont,
                                     NameID.FONT_FAMILY_NAME):
    # we'll only match family/style name entries with the same platform ID:
    plat = familyname.platformID
    familyname_str = familyname.string.decode(familyname.getEncoding())
    for stylename_str in get_name_entry_strings(ttFont,
                                                NameID.FONT_SUBFAMILY_NAME,
                                                platformID=plat):
      if len(familyname_str + stylename_str) > 27:
        failed = True
        yield WARN, ("The combined length of family and style"
                     " exceeds 27 chars in the following '{}' entries:"
                     " FONT_FAMILY_NAME = '{}' / SUBFAMILY_NAME = '{}'"
                     "").format(PlatformID(plat).name,
                                familyname_str,
                                stylename_str)
        yield WARN, ("Please take a look at the conversation at"
                     " https://github.com/googlefonts/fontbakery/issues/2179"
                     " in order to understand the reasoning behing these"
                     " name table records max-length criteria.")
  if not failed:
    yield PASS, "All name entries are good."
26385
def available():
    
    font_dir = os.path.dirname(__file__)
    names = [os.path.basename(os.path.splitext(f)[0])
            for f in glob(os.path.join(font_dir, '*.pil'))]
    return sorted(names)
200055
function getPattern(type_, limit) {
      if (!type_) return;
      if (isUdf(limit)) limit = true;
      if (contains(['all', 'list'], type_)) return keys(patterns);
      if (!has(patterns, type_)) return UDF;
      var pattern = patterns[type_];
      return limit ? new RegExp('^(' + pattern.source.replace(/^(\^|\$)$/mg, '') + ')$') : pattern;
    }
462607
def get_columns(self, font):
        
        font = self.get_font(font)
        return self.fonts[six.text_type(font)]['columns']
624008
def __register_font(self, name):
        ""
        if name not in self.__registered_fonts:
            self.__registered_fonts[name] = self.__next_font_id
            self.__next_font_id += 1
        return self.__registered_fonts[name]
1235444
private String getFontName(TermList list, CSSProperty.FontWeight weight, CSSProperty.FontStyle style)
    {
        for (Term<?> term : list)
        {
            Object value = term.getValue();
            if (value instanceof CSSProperty.FontFamily)
                return ((CSSProperty.FontFamily) value).getAWTValue();
            else
            {
                String name = lookupFont(value.toString(), weight, style);
                if (name != null) return name;
            }
        }
        //nothing found, use Serif
        return java.awt.Font.SERIF;
    }
1247629
def com_google_fonts_check_fvar_name_entries(ttFont):
  """"""

  failed = False
  for instance in ttFont["fvar"].instances:

    entries = [entry for entry in ttFont["name"].names if entry.nameID == instance.subfamilyNameID]
    if len(entries) == 0:
      failed = True
      yield FAIL, (f"Named instance with coordinates {instance.coordinates}"
                   f" lacks an entry on the name table (nameID={instance.subfamilyNameID}).")

  if not failed:
    yield PASS, "OK"