MCPcopy Create free account
hub / github.com/ActiveState/code / _drawFont

Method _drawFont

recipes/Python/577674_Bitmap_Maker/recipe-577674.py:572–594  ·  view source on GitHub ↗
(self, start_x, start_y, data)

Source from the content-addressed store, hash-verified

570
571
572 def _drawFont(self, start_x, start_y, data):
573 max_width = 0
574 # empty font, like space
575 if len(data) == 0:
576 return (0, 0)
577
578 start_y += data[0]
579 for data_y in range(1, len(data)):
580
581 # calculate maximum font width
582 if len(data[data_y]) > max_width:
583 max_width = len(data[data_y])
584
585 for data_x in range(0, len(data[data_y])):
586 #d_x = start_x * 3 + data_x * 3
587 d_x = start_x + data_x
588 if data[data_y][data_x] == '1':
589 self.plotPoint(d_x, start_y + data_y)
590
591 width = max_width
592 height = len(data)
593
594 return (width, height)
595
596 def drawText(self, text, x, y):
597 offset_x = 0

Callers 1

drawTextMethod · 0.95

Calls 2

plotPointMethod · 0.95
rangeFunction · 0.85

Tested by

no test coverage detected