MCPcopy Index your code
hub / github.com/WhyNotHugo/python-barcode / _create_text

Method _create_text

barcode/writer.py:368–386  ·  view source on GitHub ↗
(self, xpos, ypos)

Source from the content-addressed store, hash-verified

366 self._group.appendChild(element)
367
368 def _create_text(self, xpos, ypos):
369 # check option to override self.text with self.human (barcode as
370 # human readable data, can be used to print own formats)
371 barcodetext = self.human if self.human != "" else self.text
372 for subtext in barcodetext.split("\n"):
373 element = self._document.createElement("text")
374 attributes = {
375 "x": SIZE.format(xpos),
376 "y": SIZE.format(ypos),
377 "style": (
378 f"fill:{self.foreground};"
379 f"font-size:{self.font_size}pt;text-anchor:middle;"
380 ),
381 }
382 _set_attributes(element, **attributes)
383 text_element = self._document.createTextNode(subtext)
384 element.appendChild(text_element)
385 self._group.appendChild(element)
386 ypos += pt2mm(self.font_size) + self.text_line_distance
387
388 def _finish(self):
389 if self.compress:

Callers

nothing calls this directly

Calls 2

_set_attributesFunction · 0.85
pt2mmFunction · 0.85

Tested by

no test coverage detected