Repository navigation
docs(examples): add text capabilities example - #801
Open
hasansezertasan wants to merge 1 commit into
Open
hasansezertasan wants to merge 1 commit into
hasansezertasan wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Show bold, underline, inversion, alignment, fonts, sizes, smoothing, flipping and horizontal tabs in one runnable example. Closes python-escpos#220
hasansezertasan
force-pushed
the
feature/issue-220-text-capabilities-example
branch
from
October 27, 2026 05:55
91442ee to
072687f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,
Dummyprinter 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
Dummyprinter and checked that the output contains the expected escape sequences (bold, underline levels, invert, alignment, size, flip, tab stops).ruff check,ruff format --checkandtox -e mypypass.I did not add it to the "Run examples" step in CI, to keep this PR separate from the workflow changes in #800.