<commit_before>fs = require 'fs'

class AFMFont
  @open: (filename) ->
    new AFMFont fs.readFileSync filename, 'utf8'
  
  constructor: (@contents) ->
    @attributes = {}
    @glyphWidths = {}
    @boundingBoxes = {}
    
    @parse()
    @charWidths = (@glyphWidths[characters[i]] for i in [0..255])
    
    @bbox = (+e for e in @attributes['FontBBox'].split /\s+/)
    @ascender = +@attributes['Ascender']
    @decender = +@attributes['Descender']
    @lineGap = (@bbox[3] - @bbox[1]) - (@ascender - @decender)
  
  parse: ->
    section = ''
    for line in @contents.split '\n'<commit_msg>prevent missing ascender from breaking layout<commit_after>fs = require 'fs'

class AFMFont
  @open: (filename) ->
    new AFMFont fs.readFileSync filename, 'utf8'
  
  constructor: (@contents) ->
    @attributes = {}
    @glyphWidths = {}
    @boundingBoxes = {}
    
    @parse()
    @charWidths = (@glyphWidths[characters[i]] for i in [0..255])
    
    @bbox = (+e for e in @attributes['FontBBox'].split /\s+/)
    @ascender = +(@attributes['Ascender'] or 0)
    @decender = +(@attributes['Descender'] or 0)
    @lineGap = (@bbox[3] - @bbox[1]) - (@ascender - @decender)
  
  parse: ->
    section = ''
    for line in @contents.split '\n'
{'fraction_non_alphanumeric': 0.17903225806451614, 'fraction_numerical': 0.012903225806451613, 'mean_word_length': 2.9522292993630574, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4290446', 'n_tokens_mistral': 455, 'n_tokens_neox': 438, 'n_words': 102}