Skip to content

docs(examples): add text capabilities example - #801

Open
hasansezertasan wants to merge 1 commit into
python-escpos:masterfrom
hasansezertasan:feature/issue-220-text-capabilities-example
Open

hasansezertasan wants to merge 1 commit into
python-escpos:masterfrom
hasansezertasan:feature/issue-220-text-capabilities-example

Conversation

@hasansezertasan

Copy link
Copy Markdown
Contributor

Adds examples/text_capabilities.py, a short runnable example that prints a titled sample line for each text formatting option: bold, underline (1 and 2 dots), bold with underline, inverted text, left/center/right alignment, fonts A and B, double width and height, custom size, smooth, flip, and horizontal tabs.

It follows the conventions of the other examples (PEP 723 header, Dummy printer with the USB line commented out) and works on a real printer by swapping the printer line. Settings a printer doesn't support are usually ignored by it, which the docstring mentions.

Closes #220

Testing

Ran the example against the Dummy printer and checked that the output contains the expected escape sequences (bold, underline levels, invert, alignment, size, flip, tab stops). ruff check, ruff format --check and tox -e mypy pass.

I did not add it to the "Run examples" step in CI, to keep this PR separate from the workflow changes in #800.

@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.33%. Comparing base (106e251) to head (072687f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #801   +/-   ##
=======================================
  Coverage   79.33%   79.33%           
=======================================
  Files          21       21           
  Lines        1742     1742           
  Branches      241      241           
=======================================
  Hits         1382     1382           
  Misses        282      282           
  Partials       78       78           
Flag Coverage Δ
unittests 79.33% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Show bold, underline, inversion, alignment, fonts, sizes, smoothing,
flipping and horizontal tabs in one runnable example.

Closes python-escpos#220
@hasansezertasan
hasansezertasan force-pushed the feature/issue-220-text-capabilities-example branch from 91442ee to 072687f Compare October 27, 2026 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an example which shows text capabilities of the library

1 participant