2

What I have: Text files containing straight ASCII with some Unicode special characters and box characters. UTF-8 encoding is used. I am running Ubuntu MATÉ 16.04.

What I want: The text files converted to PDF format using a monospaced font, so every character is the same width. Here is an example:

desired result

Here is the input text file used to create the above:

Special Symbols:

    │1│2│3│4│5│6│7│8│9│0│A│B│C│D│E│F│G│H│I│
    │♈│♉│♊│♋│♌│♍│♎│♏│♐│♑│♒│♓│☉│☽│☿│♀│♂│♃│♄│

    │J│K│L│M│N│P│Q│R│S│T│U│V│W│X│Y│Z│a│b│c│
    │♅│♆│♇│⚷│⚳│⚴│⚵│⚶│⚸│◐│🌑│⨁│☌│⚺│⟂│∠│⚹│□│△│

    │d│e│f│g│h│i│j│k│m│n│p│q│r│s│t│
    │⚼│±│⚻│☍│∥│∦│☌│☍│⛔│☊│☋│°│′│″│🡒│

Box Characters:

    ┌─┬─┐
    │ │ │
    ├─┼─┤
    │ │ │
    └─┴─┘
    ┏━┳━┓
    ┃ ┃ ┃
    ┣━╋━┫
    ┃ ┃ ┃
    ┗━┻━┛
    ┌─┰─┐
    │ ┃ │
    ├─╂─┤
    │ ┃ │
    └─┸─┘
    ┌─┰─┐
    │ ┃ │
    ┝━╋━┥
    │ ┃ │
    └─┸─┘
    ┏━┯━┓
    ┃ │ ┃
    ┣━┿━┫
    ┃ │ ┃
    ┗━┷━┛
    ┏━┯━┓
    ┃ │ ┃
    ┠─┼─┨
    ┃ │ ┃
    ┗━┷━┛

What I have tried:

LibreOffice - I usually open a text file with LibreOffice and export as PDF, and everything is fine. However, no matter what font I use, the result is not good: Some of the output characters are wrong, or, most often, the characters are not all the same width, even when the font is named Something Mono.

txt2pdf - A very handy conversion program, but it depends totally on a specified font file. So without a font file which correctly supports the special characters and box characters as monospaced, txt2pdf cannot do its job.

The text editors joe (Joe's Own Editor), vim, and emacs (terminal version) all display the above input file exactly like the above desired output. Even cat displays everything properly. So the terminal must have a font which does everything I want, but what is this font? Where is it? Can I get LibreOffice, txt2pdf, or some conversion program to use it?

  • When it comes to special symbols, monospace fonts aren't really monospace any more. Terminal emulators just force the glyph into the grid, perhaps overflowing to the next cell (as seen in the screenshot) or cropping them a little bit. Also some terminal emulators, e.g. gnome-terminal which you tagged the question with, use special code for manually painting the box drawing characters. – egmont Nov 29 '18 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.