Lines Matching refs:metrics

79 		# changed the size metrics should be recalculated. There are a variety
120 # requires metrics then those metrics may be in the locator.
121 # In this case populate the bitmaps with "export metrics".
128 # I'm not sure which metrics have priority here.
129 # For now if both metrics exist go with glyph metrics.
130 if hasattr(glyph, 'metrics'):
131 glyph.exportMetrics = glyph.metrics
133 glyph.exportMetrics = curIndexSubTable.metrics
267 metrics = bitmapObject.exportMetrics
272 writer.begintag('rowimagedata', bitDepth=bitDepth, width=metrics.width, height=metrics.height)
274 for curRow in range(metrics.height):
275 rowData = bitmapObject.getRow(curRow, bitDepth=bitDepth, metrics=metrics)
283 metrics = SmallGlyphMetrics()
284 metrics.width = safeEval(attrs['width'])
285 metrics.height = safeEval(attrs['height'])
295 bitmapObject.setRows(dataRows, bitDepth=bitDepth, metrics=metrics)
298 metrics = bitmapObject.exportMetrics
306 writer.begintag('bitwiseimagedata', bitDepth=bitDepth, width=metrics.width, height=metrics.height)
308 for curRow in range(metrics.height):
309 rowData = bitmapObject.getRow(curRow, bitDepth=1, metrics=metrics, reverseBytes=True)
310 rowData = _data2binary(rowData, metrics.width)
320 metrics = SmallGlyphMetrics()
321 metrics.width = safeEval(attrs['width'])
322 metrics.height = safeEval(attrs['height'])
338 bitmapObject.setRows(dataRows, bitDepth=bitDepth, metrics=metrics, reverseBytes=True)
428 # Some of the glyphs have the metrics. This allows for metrics to be
433 # The opposite of write metrics.
451 # A closure for creating a mixin for the two types of metrics handling.
455 # Both metrics names are listed here to make meaningful error messages.
458 # Find which metrics this is for and determine the opposite name.
465 self.metrics.toXML(writer, ttFont)
473 self.metrics = metricsClass()
474 self.metrics.fromXML(name, attrs, content, ttFont)
489 def _getBitRange(self, row, bitDepth, metrics):
490 rowBits = (bitDepth * metrics.width)
494 def getRow(self, row, bitDepth=1, metrics=None, reverseBytes=False):
495 if metrics is None:
496 metrics = self.metrics
497 assert 0 <= row and row < metrics.height, "Illegal row access in bitmap"
515 bitRange = self._getBitRange(row, bitDepth, metrics)
543 def setRows(self, dataRows, bitDepth=1, metrics=None, reverseBytes=False):
544 if metrics is None:
545 metrics = self.metrics
551 numBytes = (self._getBitRange(len(dataRows), bitDepth, metrics)[0] + 7) // 8
554 bitRange = self._getBitRange(row, bitDepth, metrics)
577 def _getByteRange(self, row, bitDepth, metrics):
578 rowBytes = (bitDepth * metrics.width + 7) // 8
582 def getRow(self, row, bitDepth=1, metrics=None, reverseBytes=False):
583 if metrics is None:
584 metrics = self.metrics
585 assert 0 <= row and row < metrics.height, "Illegal row access in bitmap"
586 byteRange = self._getByteRange(row, bitDepth, metrics)
592 def setRows(self, dataRows, bitDepth=1, metrics=None, reverseBytes=False):
593 if metrics is None:
594 metrics = self.metrics
602 self.metrics = SmallGlyphMetrics()
603 dummy, data = sstruct.unpack2(smallGlyphMetricsFormat, self.data, self.metrics)
607 data = sstruct.pack(smallGlyphMetricsFormat, self.metrics)
614 self.metrics = SmallGlyphMetrics()
615 dummy, data = sstruct.unpack2(smallGlyphMetricsFormat, self.data, self.metrics)
619 data = sstruct.pack(smallGlyphMetricsFormat, self.metrics)
634 self.metrics = BigGlyphMetrics()
635 dummy, data = sstruct.unpack2(bigGlyphMetricsFormat, self.data, self.metrics)
639 data = sstruct.pack(bigGlyphMetricsFormat, self.metrics)
646 self.metrics = BigGlyphMetrics()
647 dummy, data = sstruct.unpack2(bigGlyphMetricsFormat, self.data, self.metrics)
651 data = sstruct.pack(bigGlyphMetricsFormat, self.metrics)
696 self.metrics = SmallGlyphMetrics()
697 dummy, data = sstruct.unpack2(smallGlyphMetricsFormat, self.data, self.metrics)
711 dataList.append(sstruct.pack(smallGlyphMetricsFormat, self.metrics))
723 self.metrics = BigGlyphMetrics()
724 dummy, data = sstruct.unpack2(bigGlyphMetricsFormat, self.data, self.metrics)
736 dataList.append(sstruct.pack(bigGlyphMetricsFormat, self.metrics))