prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  I find the font's line height is bigger than original font.
   I have tried pyftsubset  with command line option --no-recalc-bounds ,
  but the generated subfont's line height is still bigger than original font.
  
  I used html font-face render font.
  @font-face {
              font-family: 'freetype';
              src: url('font.ttf') format('truetype');
   }
  
  the font file is microsoft chinese liti.ttf.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `Lib/fontTools/ttLib/tables/_v_h_e_a.py`
  Content:
  ```
  1 from __future__ import print_function, division, absolute_import
  2 from fontTools.misc.py23 import *
  3 from fontTools.misc import sstruct
  4 from fontTools.misc.textTools import safeEval
  5 from . import DefaultTable
  6 
  7 vheaFormat = """
  8 		>	# big endian
  9 		tableVersion:		16.16F
  10 		ascent:			h
  11 		descent:		h
  12 		lineGap:		h
  13 		advanceHeightMax:	H
  14 		minTopSideBearing:	h
  15 		minBottomSideBearing:	h
  16 		yMaxExtent:		h
  17 		caretSlopeRise:		h
  18 		caretSlopeRun:		h
  19 		reserved0:		h
  20 		reserved1:		h
  21 		reserved2:		h
  22 		reserved3:		h
  23 		reserved4:		h
  24 		metricDataFormat:	h
  25 		numberOfVMetrics:	H
  26 """
  27 
  28 class table__v_h_e_a(DefaultTable.DefaultTable):
  29 
  30 	# Note: Keep in sync with table__h_h_e_a
  31 
  32 	dependencies = ['vmtx', 'glyf']
  33 
  34 	def decompile(self, data, ttFont):
  35 		sstruct.unpack(vheaFormat, data, self)
  36 
  37 	def compile(self, ttFont):
  38 		self.recalc(ttFont)
  39 		return sstruct.pack(vheaFormat, self)
  40 
  41 	def recalc(self, ttFont):
  42 		vtmxTable = ttFont['vmtx']
  43 		if 'glyf' in ttFont:
  44 			glyfTable = ttFont['glyf']
  45 			INFINITY = 100000
  46 			advanceHeightMax = 0
  47 			minTopSideBearing = +INFINITY    # arbitrary big number
  48 			minBottomSideBearing = +INFINITY # arbitrary big number
  49 			yMaxExtent = -INFINITY           # arbitrary big negative number
  50 
  51 			for name in ttFont.getGlyphOrder():
  52 				height, tsb = vtmxTable[name]
  53 				advanceHeightMax = max(advanceHeightMax, height)
  54 				g = glyfTable[name]
  55 				if g.numberOfContours == 0:
  56 					continue
  57 				if g.numberOfContours < 0 and not hasattr(g, "yMax"):
  58 					# Composite glyph without extents set.
  59 					# Calculate those.
  60 					g.recalcBounds(glyfTable)
  61 				minTopSideBearing = min(minTopSideBearing, tsb)
  62 				bsb = height - tsb - (g.yMax - g.yMin)
  63 				minBottomSideBearing = min(minBottomSideBearing, bsb)
  64 				extent = tsb + (g.yMax - g.yMin)
  65 				yMaxExtent = max(yMaxExtent, extent)
  66 
  67 			if yMaxExtent == -INFINITY:
  68 				# No glyph has outlines.
  69 				minTopSideBearing = 0
  70 				minBottomSideBearing = 0
  71 				yMaxExtent = 0
  72 
  73 			self.advanceHeightMax = advanceHeightMax
  74 			self.minTopSideBearing = minTopSideBearing
  75 			self.minBottomSideBearing = minBottomSideBearing
  76 			self.yMaxExtent = yMaxExtent
  77 		else:
  78 			# XXX CFF recalc...
  79 			pass
  80 
  81 	def toXML(self, writer, ttFont):
  82 		formatstring, names, fixes = sstruct.getformat(vheaFormat)
  83 		for name in names:
  84 			value = getattr(self, name)
  85 			writer.simpletag(name, value=value)
  86 			writer.newline()
  87 
  88 	def fromXML(self, name, attrs, content, ttFont):
  89 		setattr(self, name, safeEval(attrs["value"]))
  90
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/Lib/fontTools/ttLib/tables/_v_h_e_a.py b/Lib/fontTools/ttLib/tables/_v_h_e_a.py
  --- a/Lib/fontTools/ttLib/tables/_v_h_e_a.py
  +++ b/Lib/fontTools/ttLib/tables/_v_h_e_a.py
  @@ -35,7 +35,8 @@
   		sstruct.unpack(vheaFormat, data, self)
   
   	def compile(self, ttFont):
  -		self.recalc(ttFont)
  +		if ttFont.isLoaded('glyf') and ttFont.recalcBBoxes:
  +			self.recalc(ttFont)
   		return sstruct.pack(vheaFormat, self)
   
   	def recalc(self, ttFont):
  
verification_info: {"golden_diff": "diff --git a/Lib/fontTools/ttLib/tables/_v_h_e_a.py b/Lib/fontTools/ttLib/tables/_v_h_e_a.py\n--- a/Lib/fontTools/ttLib/tables/_v_h_e_a.py\n+++ b/Lib/fontTools/ttLib/tables/_v_h_e_a.py\n@@ -35,7 +35,8 @@\n \t\tsstruct.unpack(vheaFormat, data, self)\n \n \tdef compile(self, ttFont):\n-\t\tself.recalc(ttFont)\n+\t\tif ttFont.isLoaded('glyf') and ttFont.recalcBBoxes:\n+\t\t\tself.recalc(ttFont)\n \t\treturn sstruct.pack(vheaFormat, self)\n \n \tdef recalc(self, ttFont):\n", "issue": "I find the font's line height is bigger than original font.\n I have tried pyftsubset  with command line option --no-recalc-bounds ,\nbut the generated subfont's line height is still bigger than original font.\n\nI used html font-face render font.\n@font-face {\n            font-family: 'freetype';\n            src: url('font.ttf') format('truetype');\n }\n\nthe font file is microsoft chinese liti.ttf.\n\n", "before_files": [{"content": "from __future__ import print_function, division, absolute_import\nfrom fontTools.misc.py23 import *\nfrom fontTools.misc import sstruct\nfrom fontTools.misc.textTools import safeEval\nfrom . import DefaultTable\n\nvheaFormat = \"\"\"\n\t\t>\t# big endian\n\t\ttableVersion:\t\t16.16F\n\t\tascent:\t\t\th\n\t\tdescent:\t\th\n\t\tlineGap:\t\th\n\t\tadvanceHeightMax:\tH\n\t\tminTopSideBearing:\th\n\t\tminBottomSideBearing:\th\n\t\tyMaxExtent:\t\th\n\t\tcaretSlopeRise:\t\th\n\t\tcaretSlopeRun:\t\th\n\t\treserved0:\t\th\n\t\treserved1:\t\th\n\t\treserved2:\t\th\n\t\treserved3:\t\th\n\t\treserved4:\t\th\n\t\tmetricDataFormat:\th\n\t\tnumberOfVMetrics:\tH\n\"\"\"\n\nclass table__v_h_e_a(DefaultTable.DefaultTable):\n\n\t# Note: Keep in sync with table__h_h_e_a\n\n\tdependencies = ['vmtx', 'glyf']\n\n\tdef decompile(self, data, ttFont):\n\t\tsstruct.unpack(vheaFormat, data, self)\n\n\tdef compile(self, ttFont):\n\t\tself.recalc(ttFont)\n\t\treturn sstruct.pack(vheaFormat, self)\n\n\tdef recalc(self, ttFont):\n\t\tvtmxTable = ttFont['vmtx']\n\t\tif 'glyf' in ttFont:\n\t\t\tglyfTable = ttFont['glyf']\n\t\t\tINFINITY = 100000\n\t\t\tadvanceHeightMax = 0\n\t\t\tminTopSideBearing = +INFINITY    # arbitrary big number\n\t\t\tminBottomSideBearing = +INFINITY # arbitrary big number\n\t\t\tyMaxExtent = -INFINITY           # arbitrary big negative number\n\n\t\t\tfor name in ttFont.getGlyphOrder():\n\t\t\t\theight, tsb = vtmxTable[name]\n\t\t\t\tadvanceHeightMax = max(advanceHeightMax, height)\n\t\t\t\tg = glyfTable[name]\n\t\t\t\tif g.numberOfContours == 0:\n\t\t\t\t\tcontinue\n\t\t\t\tif g.numberOfContours < 0 and not hasattr(g, \"yMax\"):\n\t\t\t\t\t# Composite glyph without extents set.\n\t\t\t\t\t# Calculate those.\n\t\t\t\t\tg.recalcBounds(glyfTable)\n\t\t\t\tminTopSideBearing = min(minTopSideBearing, tsb)\n\t\t\t\tbsb = height - tsb - (g.yMax - g.yMin)\n\t\t\t\tminBottomSideBearing = min(minBottomSideBearing, bsb)\n\t\t\t\textent = tsb + (g.yMax - g.yMin)\n\t\t\t\tyMaxExtent = max(yMaxExtent, extent)\n\n\t\t\tif yMaxExtent == -INFINITY:\n\t\t\t\t# No glyph has outlines.\n\t\t\t\tminTopSideBearing = 0\n\t\t\t\tminBottomSideBearing = 0\n\t\t\t\tyMaxExtent = 0\n\n\t\t\tself.advanceHeightMax = advanceHeightMax\n\t\t\tself.minTopSideBearing = minTopSideBearing\n\t\t\tself.minBottomSideBearing = minBottomSideBearing\n\t\t\tself.yMaxExtent = yMaxExtent\n\t\telse:\n\t\t\t# XXX CFF recalc...\n\t\t\tpass\n\n\tdef toXML(self, writer, ttFont):\n\t\tformatstring, names, fixes = sstruct.getformat(vheaFormat)\n\t\tfor name in names:\n\t\t\tvalue = getattr(self, name)\n\t\t\twriter.simpletag(name, value=value)\n\t\t\twriter.newline()\n\n\tdef fromXML(self, name, attrs, content, ttFont):\n\t\tsetattr(self, name, safeEval(attrs[\"value\"]))\n", "path": "Lib/fontTools/ttLib/tables/_v_h_e_a.py"}], "after_files": [{"content": "from __future__ import print_function, division, absolute_import\nfrom fontTools.misc.py23 import *\nfrom fontTools.misc import sstruct\nfrom fontTools.misc.textTools import safeEval\nfrom . import DefaultTable\n\nvheaFormat = \"\"\"\n\t\t>\t# big endian\n\t\ttableVersion:\t\t16.16F\n\t\tascent:\t\t\th\n\t\tdescent:\t\th\n\t\tlineGap:\t\th\n\t\tadvanceHeightMax:\tH\n\t\tminTopSideBearing:\th\n\t\tminBottomSideBearing:\th\n\t\tyMaxExtent:\t\th\n\t\tcaretSlopeRise:\t\th\n\t\tcaretSlopeRun:\t\th\n\t\treserved0:\t\th\n\t\treserved1:\t\th\n\t\treserved2:\t\th\n\t\treserved3:\t\th\n\t\treserved4:\t\th\n\t\tmetricDataFormat:\th\n\t\tnumberOfVMetrics:\tH\n\"\"\"\n\nclass table__v_h_e_a(DefaultTable.DefaultTable):\n\n\t# Note: Keep in sync with table__h_h_e_a\n\n\tdependencies = ['vmtx', 'glyf']\n\n\tdef decompile(self, data, ttFont):\n\t\tsstruct.unpack(vheaFormat, data, self)\n\n\tdef compile(self, ttFont):\n\t\tif ttFont.isLoaded('glyf') and ttFont.recalcBBoxes:\n\t\t\tself.recalc(ttFont)\n\t\treturn sstruct.pack(vheaFormat, self)\n\n\tdef recalc(self, ttFont):\n\t\tvtmxTable = ttFont['vmtx']\n\t\tif 'glyf' in ttFont:\n\t\t\tglyfTable = ttFont['glyf']\n\t\t\tINFINITY = 100000\n\t\t\tadvanceHeightMax = 0\n\t\t\tminTopSideBearing = +INFINITY    # arbitrary big number\n\t\t\tminBottomSideBearing = +INFINITY # arbitrary big number\n\t\t\tyMaxExtent = -INFINITY           # arbitrary big negative number\n\n\t\t\tfor name in ttFont.getGlyphOrder():\n\t\t\t\theight, tsb = vtmxTable[name]\n\t\t\t\tadvanceHeightMax = max(advanceHeightMax, height)\n\t\t\t\tg = glyfTable[name]\n\t\t\t\tif g.numberOfContours == 0:\n\t\t\t\t\tcontinue\n\t\t\t\tif g.numberOfContours < 0 and not hasattr(g, \"yMax\"):\n\t\t\t\t\t# Composite glyph without extents set.\n\t\t\t\t\t# Calculate those.\n\t\t\t\t\tg.recalcBounds(glyfTable)\n\t\t\t\tminTopSideBearing = min(minTopSideBearing, tsb)\n\t\t\t\tbsb = height - tsb - (g.yMax - g.yMin)\n\t\t\t\tminBottomSideBearing = min(minBottomSideBearing, bsb)\n\t\t\t\textent = tsb + (g.yMax - g.yMin)\n\t\t\t\tyMaxExtent = max(yMaxExtent, extent)\n\n\t\t\tif yMaxExtent == -INFINITY:\n\t\t\t\t# No glyph has outlines.\n\t\t\t\tminTopSideBearing = 0\n\t\t\t\tminBottomSideBearing = 0\n\t\t\t\tyMaxExtent = 0\n\n\t\t\tself.advanceHeightMax = advanceHeightMax\n\t\t\tself.minTopSideBearing = minTopSideBearing\n\t\t\tself.minBottomSideBearing = minBottomSideBearing\n\t\t\tself.yMaxExtent = yMaxExtent\n\t\telse:\n\t\t\t# XXX CFF recalc...\n\t\t\tpass\n\n\tdef toXML(self, writer, ttFont):\n\t\tformatstring, names, fixes = sstruct.getformat(vheaFormat)\n\t\tfor name in names:\n\t\t\tvalue = getattr(self, name)\n\t\t\twriter.simpletag(name, value=value)\n\t\t\twriter.newline()\n\n\tdef fromXML(self, name, attrs, content, ttFont):\n\t\tsetattr(self, name, safeEval(attrs[\"value\"]))\n", "path": "Lib/fontTools/ttLib/tables/_v_h_e_a.py"}]}