Changing font functionality #104
Labels
No labels
api-inconsistency
automerge
bug
contributions welcome
documentation
duplicate
enhancement
good first issue
invalid
more-information-needed
question
sync
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
WhyNotHugo/python-barcode#104
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Looking through the documentation and the code in I found the font_path argument that either defaults to a supplied font or can be passed a path to a different font. I've tried several different variations of passing a font to it and even modified writer.py directly to use a different font. Neither of those had any effect on the font that appears below the barcode. Can you provide an example of changing the font?
I encountered this as well behavior as well. It only applies if you are writing SVGs though. If you write raster files (PNGs, JPGs, etc), the
font_pathoption does exactly what you expect.Looking at the
SVGWriterclass in class in barcode/writer.py it's pretty obvious why:As hacky workaround since in my use case I needed bunch of arbitrarily scalable barcodes with non-ambiguous font (a lot of fonts
0and capitolOlook identical), I just had it write thefont_pathoption as the XHTMLfont-familyoption:CAUTION: I am not clear on how that would interact with the SVG sizing system in the package so I didn't commit and PR this change. I wanted to take a closer look and do this more smartly if need be. Regardless, I am more than happy to work with the team on giving SVG barcodes font customizability.