def dumpMetrics(self):

        print
        print 'fonts scanned:', len(self.processedPostscriptNames)
        print 'fonts processed:', len(self.nonEmptyPostscriptNames)
        print 'glyph pairs observed:', len(self.kerningPairCountMap)
        maxGlyphPairCount = reduce(max, self.kerningPairCountMap.values())
        print 'Highest glyph pair frequency:', maxGlyphPairCount

        #        self.dumpMetricsMap(self.kerningPairCountMap, 'most_common_kerning_pairs.html')
        #        self.dumpMetricsMap(self.kerningPairAbsEmsMap, 'most_common_kerning_pairs_ems.html')
        #        kerningPairAverageMap = {}
        #        for key in self.kerningPairCountMap:
        #            kerningPairAverageMap[key] = self.kerningPairAbsEmsMap[key] / self.kerningPairCountMap[key]
        #        self.dumpMetricsMap(kerningPairAverageMap, 'most_common_kerning_pairs_avg.html')

        countGlyphs = []
        avgGlyphs = []
        for key in self.kerningPairCountMap:
            glyph0, glyph1 = key
            glyph = TFSMap()
            glyph.glyph0 = glyph0
            glyph.glyph1 = glyph1
            glyph.absEmsTotal = self.kerningPairAbsEmsMap[key]
            glyph.count = self.kerningPairCountMap[key]
            glyph.frequencyPct = 100.0 * glyph.count / float(
                len(self.nonEmptyPostscriptNames))
            glyph.absEmsRawAverage = self.kerningPairAbsEmsMap[key] / float(
                len(self.nonEmptyPostscriptNames))
            glyph.absEmsWeightedAverage = self.kerningPairAbsEmsMap[
                key] / float(self.kerningPairCountMap[key])

            glyphHex0 = '%04X' % glyph.glyph0
            glyphHex1 = '%04X' % glyph.glyph1

            def getGlyphName(codePoint):
                result = getUnicodeCharacterName(codePoint,
                                                 ignoreUnknown=True,
                                                 skipValidation=True)
                if result is None:
                    return 'Unknown'
                result = result.replace('<', '').replace('>', '')
                return result

            glyph.label = '0x%s &#x%s %s vs. 0x%s &#x%s %s' % (
                glyphHex0,
                glyphHex0,
                getGlyphName(glyph.glyph0),
                glyphHex1,
                glyphHex1,
                getGlyphName(glyph.glyph1),
            )

            #                   'glyphCount': locale.format("%d", glyph.count, grouping=True),
            #                   'glyphPercent': '%0.2f%%' % (100.0 * glyph.count / float(len(self.nonEmptyPostscriptNames))),

            if glyph.frequencyPct >= 10.0:
                countGlyph = TFSMap(glyph)
                countGlyph.sortValue = glyph.count
                countGlyph.displayValue = glyph.count
                countGlyph.displayValue = '%0.0f%%' % (glyph.frequencyPct, )
                countGlyphs.append(countGlyph)

            if glyph.absEmsRawAverage > 0.03:
                avgGlyph = TFSMap(glyph)
                avgGlyph.sortValue = glyph.absEmsRawAverage
                avgGlyph.displayValue = '%0.2f em' % (glyph.absEmsRawAverage, )
                #            avgGlyph.displayValue = '%0.2f%%' % (100.0 * glyph.absEmsRawAverage, )
                avgGlyphs.append(avgGlyph)

        self.dumpMetricsGroup(countGlyphs, 'Most Common Kerning Pairs',
                              'The most frequent kerning pairs.',
                              'most_common_kerning_pairs_avg.html')
        self.dumpMetricsGroup(avgGlyphs, 'Most Heavily Kerning Pairs',
                              'The most heavily kerning pairs.',
                              'most_heavily_kerning_pairs_avg.html')
    def dumpMetrics(self):

        print
        print 'fonts scanned:', len(self.processedPostscriptNames)
        print 'fonts processed:', len(self.nonEmptyPostscriptNames)
        print 'glyph pairs observed:', len(self.kerningPairCountMap)
        maxGlyphPairCount = reduce(max, self.kerningPairCountMap.values())
        print 'Highest glyph pair frequency:', maxGlyphPairCount

#        self.dumpMetricsMap(self.kerningPairCountMap, 'most_common_kerning_pairs.html')
#        self.dumpMetricsMap(self.kerningPairAbsEmsMap, 'most_common_kerning_pairs_ems.html')
#        kerningPairAverageMap = {}
#        for key in self.kerningPairCountMap:
#            kerningPairAverageMap[key] = self.kerningPairAbsEmsMap[key] / self.kerningPairCountMap[key]
#        self.dumpMetricsMap(kerningPairAverageMap, 'most_common_kerning_pairs_avg.html')

        countGlyphs = []
        avgGlyphs = []
        for key in self.kerningPairCountMap:
            glyph0, glyph1 = key
            glyph = TFSMap()
            glyph.glyph0 = glyph0
            glyph.glyph1 = glyph1
            glyph.absEmsTotal = self.kerningPairAbsEmsMap[key]
            glyph.count = self.kerningPairCountMap[key]
            glyph.frequencyPct = 100.0 * glyph.count / float(len(self.nonEmptyPostscriptNames))
            glyph.absEmsRawAverage = self.kerningPairAbsEmsMap[key] / float(len(self.nonEmptyPostscriptNames))
            glyph.absEmsWeightedAverage = self.kerningPairAbsEmsMap[key] / float(self.kerningPairCountMap[key])

            glyphHex0 = '%04X' % glyph.glyph0
            glyphHex1 = '%04X' % glyph.glyph1

            def getGlyphName(codePoint):
                result = getUnicodeCharacterName(codePoint, ignoreUnknown=True, skipValidation=True)
                if result is None:
                    return 'Unknown'
                result = result.replace('<', '').replace('>', '')
                return result
            glyph.label = '0x%s &#x%s %s vs. 0x%s &#x%s %s' % ( glyphHex0,
                                                                glyphHex0,
                                                                getGlyphName(glyph.glyph0),
                                                                glyphHex1,
                                                                glyphHex1,
                                                                getGlyphName(glyph.glyph1),
                                                                )

#                   'glyphCount': locale.format("%d", glyph.count, grouping=True),
#                   'glyphPercent': '%0.2f%%' % (100.0 * glyph.count / float(len(self.nonEmptyPostscriptNames))),

            if glyph.frequencyPct >= 10.0:
                countGlyph = TFSMap(glyph)
                countGlyph.sortValue = glyph.count
                countGlyph.displayValue = glyph.count
                countGlyph.displayValue = '%0.0f%%' % ( glyph.frequencyPct, )
                countGlyphs.append(countGlyph)

            if glyph.absEmsRawAverage > 0.03:
                avgGlyph = TFSMap(glyph)
                avgGlyph.sortValue = glyph.absEmsRawAverage
                avgGlyph.displayValue = '%0.2f em' % (glyph.absEmsRawAverage,)
    #            avgGlyph.displayValue = '%0.2f%%' % (100.0 * glyph.absEmsRawAverage, )
                avgGlyphs.append(avgGlyph)


        self.dumpMetricsGroup(countGlyphs,
                              'Most Common Kerning Pairs',
                              'The most frequent kerning pairs.',
                              'most_common_kerning_pairs_avg.html')
        self.dumpMetricsGroup(avgGlyphs,
                              'Most Heavily Kerning Pairs',
                              'The most heavily kerning pairs.',
                              'most_heavily_kerning_pairs_avg.html')