Giter VIP home page Giter VIP logo

u2ps's Introduction

About
~~~~~
u2ps is text to postscript converter similar to a2ps,
with emphasis on Unicode support.

Key features:

* utf8 support implemented (mostly) in PostScript
* clean, readable and reasonably small output files
* font subset embedding for Type 1 and Type 42 (TTF) fonts
* ANSI control sequences support (color and font variants)

Things missing at present:

- proper combining mark positioning
- reordering and ligatures
- bidi support

The tool should be usable on any reasonably sane system with
Ghostscript installed.

As long as the input does not stray too far from common left-to-right
scripts and usable fonts are available, u2ps should work well.

Current version is probably the last one using mostly-postscript
mostly-font-agnostic approach; check TODO for further development ideas.


Installation
~~~~~~~~~~~~
Common C library, make and cc are needed to build u2ps.
Font reduction needs ghostscript at runtime.

	./configure --prefix=...
	make
	make install

Unless told otherwise, u2ps defaults to FreeMono font.
Make sure to have it installed.

For hacking/debugging, run "./configure devel" instead, the resulting
executable will work right from the source directory.


Documentation
~~~~~~~~~~~~~
See man page and text files in doc/ directory.


Sample usage
~~~~~~~~~~~~
The files in text/ directory may be used as a showcase for u2ps features.
Assuming u2ps is built in devel mode (./configure devel), run

    ./u2ps text/ansi.txt
    ./u2ps text/alph.txt
    ./u2ps text/utf8.txt
    ./u2ps -2 -f FreeMono -f Kochi -f Tlwg text/alph.txt
    ./u2ps -2 -f FreeMono -f Kochi -f Tlwg text/utf8.txt

The last two commands assume Kochi-Mincho (http://en.osdn.jp/projects/efont/)
and Tlwg (http://linux.thai.net/projects/fonts-tlwg) fonts are installed
in the system and Ghostscript knows where to find them.

Sample usage with individual font setting:

    ./u2ps -2 -f FreeMono -fC:SawarabiGothic-Medium text/alph.txt

This works for fonts not known to u2ps.


Github note
~~~~~~~~~~~
This is a modernized version of my old project from Berlios,
now rewritten in C, with lots of incompatible changes.

Check perl branch for the original code if you need it.


License
~~~~~~~
GPL v3, see LICENSE file


Credits
~~~~~~~
Written by Alex Suykov <[email protected]>
with patches from Pierre Dehaen <[email protected]>
and Ionel Mugurel Ciobîcă <[email protected]>

u2ps's People

Contributors

arsv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

u2ps's Issues

-M and --margins seem to have no effect

-M and --margins seem to have no effect on the output.
I tried both positive numbers and negative numbers.
I tried single numbers, a pair of numbers, and four numbers.

Problems with tests

Hello,

I was trying to make a port of u2ps, and ran into some problems with tests:

  • The *.c tests seem to be straightforward enough -- just {,g}make
    them and execute.
  • I don't quite understand how the *.ps tests are supposed to work.
    Do I need to invoke gs with some specific arguments, or
    environment to run these?
  • The *.sh tests seem to be failing for me, but that's probably due to
    the way gs is compiled on my system. I did, however, notice a bashism
    on the line 10 of px_reduce_rgl.sh: ">&/dev/null". Would you consider
    instead making it ">/dev/null 2>&1"?

Would you please consider writing a bit of documentation for the tests
(like a few comments should be enough), and writing a make target to
run them automatically?

how do I manage word splitting at the end of the line?

First of all, thank you for developing this tool.
I have a text file which has long lines. I use -w switch to split long line into new line, however sometimes it splits a word incorrectly.
How do I disable word splitting in u2ps?
Regards.

Ghostscript 9.27: Unrecoverable error, exit code 1

% cd /tmp
% git clone https://github.com/arsv/u2ps
% cd u2ps
% ./configure
% make
% path+=`pwd`
%  ./u2ps /tmp/test.c /tmp/test.ps
GPL Ghostscript 9.27: Unrecoverable error, exit code 1
gs failed, aborting

bad file produced

input file:

// комментарий

int main()
{
	return 0;
}

u2ps works wo errors:

% ./u2ps /tmp/test.c /tmp/test.ps

printing test.ps on produces blank file.

evince says Loading... permanently.

zathura says Loading... permanently and

undefined -21
error: Rendering failed (page 1)

in the loop on the console

http://sergio.outerface.net/misc/test.ps

debian sid, fonts-freefont-ttf is installed

u2ps issuing a message "DEBUG: FC_WEIGHT didn't match"

After building and installing, as a simple test:

$ u2ps README
DEBUG: FC_WEIGHT didn't match
$

Was expecting PostScript on stdout, but that's all there is.
I added the -v flag and got:

$ u2ps -v README
Terminal area 481x732pt, final font size 1000cpt, 80 cols 73 rows
Font R aspect 600cpt xscale 1000mil name FreeMono
Font I aspect 600cpt xscale 1000mil name FreeMonoOblique
Font B aspect 600cpt xscale 1000mil name FreeMonoBold
Font O aspect 600cpt xscale 1000mil name FreeMonoBoldOblique
DEBUG: FC_WEIGHT didn't match

Is there a debug flag I should turn on to show what's being executed?

compiling on cygwin64

Hello!

I just tried it, and I found I had to add the -std=c99 option for the compiler to work. I also found that the header definition of the struct runopts.stdout conflicted with other definitions of stdout elsewhere; I fixed the issue by renaming it to runopts.stdouts everywhere it appeared.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.