(data, start, numMetrics, numGlyphs, glyphs)
| 5011 | // Parse the `hmtx` table, which contains the horizontal metrics for all glyphs. |
| 5012 | // This function augments the glyph array, adding the advanceWidth and leftSideBearing to each glyph. |
| 5013 | function parseHmtxTable(data, start, numMetrics, numGlyphs, glyphs) { |
| 5014 | var advanceWidth; |
| 5015 | var leftSideBearing; |
| 5016 | var p = new parse.Parser(data, start); |
| 5017 | for (var i = 0; i < numGlyphs; i += 1) { |
| 5018 | // If the font is monospaced, only one entry is needed. This last entry applies to all subsequent glyphs. |
| 5019 | if (i < numMetrics) { |
| 5020 | advanceWidth = p.parseUShort(); |
| 5021 | leftSideBearing = p.parseShort(); |
| 5022 | } |
| 5023 | |
| 5024 | var glyph = glyphs.get(i); |
| 5025 | glyph.advanceWidth = advanceWidth; |
| 5026 | glyph.leftSideBearing = leftSideBearing; |
| 5027 | } |
| 5028 | } |
| 5029 | |
| 5030 | function makeHmtxTable(glyphs) { |
| 5031 | var t = new table.Table('hmtx', []); |
nothing calls this directly
no outgoing calls
no test coverage detected