hpjansson / chafa

📺🗿 Terminal graphics for the 21st century.
https://hpjansson.org/chafa/
GNU Lesser General Public License v3.0
2.84k stars 60 forks source link

feature request: provide a way of excluding specific characters #120

Closed cpackham closed 1 year ago

cpackham commented 1 year ago

I'm using chafa to produce ascii art from various logos for use on embedded devices. Sometimes this ends up interfering with automated tests that screen scrape and detect #, $ and > as prompt indicators.

I know I can exclude symbol classes with --symbols -dot but is it possible to exclude only specific characters (e.g. --symbols -$ -# ->, bash quoting issues aside).

hpjansson commented 1 year ago

Yes, you can do this using Unicode hexadecimal codes for the characters you want to exclude. For #, $ and > that's the same as ASCII codes:

--symbols -23-24-3e should do the trick.

I want to add a way to do this with lists of plain characters in brackets, e.g. --symbols -[#$>]. Let's keep this issue open for that.

clort81 commented 1 year ago

chineseOpera grasses excluding ranges works, it's a bit of effort...

clort81 commented 1 year ago

isn't this closeable? use the --symbols flag and add the unicode codepoints or ranges you want to exclude.

Here's an example:

--symbols bad+diagonal+ue080..ufd7b-ue1ed-u2683-u25a4-u2610-uECD5-u25b3-u21e6-ue84d-u0425-u0432-ue781-ue840-uecce-u0430-u041d-u2662-u255c-u207f-u25e0-uec07-u2265-u0420-u25c5-u263a-u0434-ue846-ue462-ue472-ue4d7-ue1d1-ue1e1-ue49d-ue49b-ue4a8-ue721-ue1d6-u25db-ue70c-u2025-u25ad-u222a-u25a1
hpjansson commented 1 year ago

I still haven't implemented the parsing that would let you do --symbols [abcdæøå]. Will close when that's done. Shouldn't be too long :-)