How to use the gftools.util.google_fonts.RegularWeight function in gftools

To help you get started, we’ve selected a few gftools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googlefonts / gftools / bin / gftools-compare-font.py View on Github external
def CompareDirs(font1, font2):
  """Compares fonts by assuming font1/2 are dirs containing METADATA.pb."""

  m1 = fonts.Metadata(font1)
  m2 = fonts.Metadata(font2)

  subsets_to_compare = fonts.UniqueSort(m1.subsets, m2.subsets)
  subsets_to_compare.remove('menu')
  subsets_to_compare.append('all')

  font_filename1 = os.path.join(font1, fonts.RegularWeight(m1))
  font_filename2 = os.path.join(font2, fonts.RegularWeight(m2))

  if FLAGS.diff_coverage:
    print('Subset Coverage Change (codepoints)')
    for subset in subsets_to_compare:
      DiffCoverage(font_filename1, font_filename2, subset)

  print(CompareSize(font_filename1, font_filename2))
github googlefonts / gftools / bin / gftools-compare-font.py View on Github external
def CompareDirs(font1, font2):
  """Compares fonts by assuming font1/2 are dirs containing METADATA.pb."""

  m1 = fonts.Metadata(font1)
  m2 = fonts.Metadata(font2)

  subsets_to_compare = fonts.UniqueSort(m1.subsets, m2.subsets)
  subsets_to_compare.remove('menu')
  subsets_to_compare.append('all')

  font_filename1 = os.path.join(font1, fonts.RegularWeight(m1))
  font_filename2 = os.path.join(font2, fonts.RegularWeight(m2))

  if FLAGS.diff_coverage:
    print('Subset Coverage Change (codepoints)')
    for subset in subsets_to_compare:
      DiffCoverage(font_filename1, font_filename2, subset)

  print(CompareSize(font_filename1, font_filename2))