arsv / u2ps Goto Github PK
View Code? Open in Web Editor NEWunicode text to postscript converter
License: GNU General Public License v3.0
unicode text to postscript converter
License: GNU General Public License v3.0
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 -W -H -P letter --margins -72 N010.txt
Unknown option -W
-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.
Hello,
I was trying to make a port of u2ps, and ran into some problems with tests:
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?
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.
% 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
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
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?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.