forked from pool/a2ps-h
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
26
a2ps-h-font.patch
Normal file
26
a2ps-h-font.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
--- a2ps-h.py.orig Fri Jan 26 12:12:32 2001
|
||||
+++ a2ps-h.py Fri Jan 26 11:41:50 2001
|
||||
@@ -24,15 +24,15 @@
|
||||
def tmpnam():
|
||||
return "/tmp/a2ps-h-tmp"
|
||||
|
||||
-hps = '/Gulim-Medium-KSC-EUC-H'
|
||||
-hbps = '/Gulim-Medium-KSC-EUC-H'
|
||||
-hbops = '/Gulim-Medium-KSC-EUC-H'
|
||||
-hops = '/Gulim-Medium-KSC-EUC-H'
|
||||
+hps = '/Munhwa-Regular-KSC-EUC-H'
|
||||
+hbps = '/Munhwa-Regular-KSC-EUC-H'
|
||||
+hbops = '/Munhwa-Regular-KSC-EUC-H'
|
||||
+hops = '/Munhwa-Regular-KSC-EUC-H'
|
||||
|
||||
-hps = '/Gulim-Regular'
|
||||
-hbps = '/Gulim-Regular'
|
||||
-hbops = '/Gulim-Regular'
|
||||
-hops = '/Gulim-Regular'
|
||||
+hps = '/SMgoJ'
|
||||
+hbps = '/SMgoJ'
|
||||
+hbops = '/SMgoJ'
|
||||
+hops = '/SMgoJ'
|
||||
|
||||
def startswith(s, needle):
|
||||
if len(needle) > len(s): return 0
|
21
a2ps-h.changes
Normal file
21
a2ps-h.changes
Normal file
@@ -0,0 +1,21 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 25 21:45:41 CET 2006 - mls@suse.de
|
||||
|
||||
- converted neededforbuild to BuildRequires
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 23 13:52:37 CET 2004 - hmacht@suse.de
|
||||
|
||||
- building as non-root
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 13 12:55:58 CEST 2003 - ro@suse.de
|
||||
|
||||
- added directory to filelist
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 26 12:18:31 CET 2001 - violiet@suse.de
|
||||
|
||||
- NEW a2ps-h package version to 20010113
|
||||
- change hangul PostScript font.
|
||||
|
231
a2ps-h.py
Normal file
231
a2ps-h.py
Normal file
@@ -0,0 +1,231 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
#
|
||||
# (C) Mizi Research
|
||||
# distributed under GPL
|
||||
#
|
||||
# Author: Hwang, ChiDeok (hwang@mizi.co.kr)
|
||||
# 2000.03.14
|
||||
#
|
||||
# ChangeLog:
|
||||
# -o option<6F><6E> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>쳪 argument<6E><74> <20>־<EFBFBD><D6BE><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
# ps <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴ<EFBFBD> <20><><EFBFBD><EFBFBD> a2ps <20><> <20>θ<EFBFBD><CEB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
# argument<6E><74> <20><> <20>־<EFBFBD><D6BE><EFBFBD> <20><><EFBFBD><EFBFBD> stdin<69><6E><EFBFBD><EFBFBD> <20>о<EFBFBD><D0BE>帲. (2000/03/16)
|
||||
# string<6E><67>ȯ<EFBFBD><C8AF> postscript language<67><65><EFBFBD><EFBFBD> <20>ϵ<EFBFBD><CFB5><EFBFBD> <20><><EFBFBD><EFBFBD>. (2000/03/20)
|
||||
# string<6E><67>ȯ<EFBFBD><C8AF> <20>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (2000/03/23)
|
||||
# stdin<69><6E><EFBFBD>κ<EFBFBD><CEBA><EFBFBD> <20><> <20><><EFBFBD>뵵 <20>ʿ<EFBFBD><CABF>ϸ<EFBFBD> a2ps<70><73> <20><><EFBFBD><EFBFBD> (2000/12/28)
|
||||
# mutt<74><74> <20>Բ<EFBFBD> <20><> <20><> <20>ֵ<EFBFBD><D6B5><EFBFBD> -m<>ɼ<EFBFBD><C9BC><EFBFBD> <20>߰<EFBFBD> (2000/01/03)
|
||||
|
||||
import string,sys,os
|
||||
|
||||
try:
|
||||
from os import tmpnam # python2.0
|
||||
except:
|
||||
def tmpnam():
|
||||
return "/tmp/a2ps-h-tmp"
|
||||
|
||||
hps = '/Gulim-Medium-KSC-EUC-H'
|
||||
hbps = '/Gulim-Medium-KSC-EUC-H'
|
||||
hbops = '/Gulim-Medium-KSC-EUC-H'
|
||||
hops = '/Gulim-Medium-KSC-EUC-H'
|
||||
|
||||
hps = '/Gulim-Regular'
|
||||
hbps = '/Gulim-Regular'
|
||||
hbops = '/Gulim-Regular'
|
||||
hops = '/Gulim-Regular'
|
||||
|
||||
def startswith(s, needle):
|
||||
if len(needle) > len(s): return 0
|
||||
return s[:len(needle)] == needle
|
||||
|
||||
def trans_file(filename):
|
||||
if type(filename) == type([]):
|
||||
lines = filename
|
||||
else:
|
||||
lines = open(filename).readlines()
|
||||
for i in range(len(lines)):
|
||||
if startswith(lines[i], '% Check PostScript language '):
|
||||
print show_override
|
||||
print lines[i],
|
||||
elif startswith(lines[i], '% Dictionary for ISO-8859-1'):
|
||||
print lines[i],
|
||||
print lines[i+1],
|
||||
print hangul_font
|
||||
lines = lines[i+10:]
|
||||
break
|
||||
else:
|
||||
print lines[i],
|
||||
for line in lines: print line,
|
||||
|
||||
hangul_font = """\
|
||||
16 dict begin
|
||||
/FontName /fCourier def /FontType 0 def
|
||||
/WMode 0 def /FMapType 3 def /FontMatrix matrix def
|
||||
/Encoding [0 1] def
|
||||
/FDepVector [ /Courier findfont %(hps)s findfont ] def
|
||||
FontName currentdict
|
||||
end
|
||||
definefont /fCourier exch def
|
||||
|
||||
16 dict begin
|
||||
/FontName /fCourier-Bold def /FontType 0 def
|
||||
/WMode 0 def /FMapType 3 def /FontMatrix matrix def
|
||||
/Encoding [0 1] def
|
||||
/FDepVector [ /Courier-Bold findfont %(hbps)s findfont ] def
|
||||
FontName currentdict
|
||||
end
|
||||
definefont /fCourier-Bold exch def
|
||||
|
||||
16 dict begin
|
||||
/FontName /fCourier-BoldOblique def /FontType 0 def
|
||||
/WMode 0 def /FMapType 3 def /FontMatrix matrix def
|
||||
/Encoding [0 1] def
|
||||
/FDepVector [ /Courier-BoldOblique findfont %(hbops)s findfont ] def
|
||||
FontName currentdict
|
||||
end
|
||||
definefont /fCourier-BoldOblique exch def
|
||||
|
||||
16 dict begin
|
||||
/FontName /fCourier-Oblique def /FontType 0 def
|
||||
/WMode 0 def /FMapType 3 def /FontMatrix matrix def
|
||||
/Encoding [0 1] def
|
||||
/FDepVector [ /Courier-Oblique findfont %(hops)s findfont ] def
|
||||
FontName currentdict
|
||||
end
|
||||
definefont /fCourier-Oblique exch def
|
||||
|
||||
16 dict begin
|
||||
/FontName /fHelvetica def /FontType 0 def
|
||||
/WMode 0 def /FMapType 3 def /FontMatrix matrix def
|
||||
/Encoding [0 1] def
|
||||
/FDepVector [ /Helvetica findfont %(hps)s findfont ] def
|
||||
FontName currentdict
|
||||
end
|
||||
definefont /fHelvetica exch def
|
||||
|
||||
16 dict begin
|
||||
/FontName /fHelvetica-Bold def /FontType 0 def
|
||||
/WMode 0 def /FMapType 3 def /FontMatrix matrix def
|
||||
/Encoding [0 1] def
|
||||
/FDepVector [ /Helvetica-Bold findfont %(hbps)s findfont ] def
|
||||
FontName currentdict
|
||||
end
|
||||
definefont /fHelvetica-Bold exch def
|
||||
|
||||
16 dict begin
|
||||
/FontName /fTimes-Bold def /FontType 0 def
|
||||
/WMode 0 def /FMapType 3 def /FontMatrix matrix def
|
||||
/Encoding [0 1] def
|
||||
/FDepVector [ /Times-Bold findfont %(hbps)s findfont ] def
|
||||
FontName currentdict
|
||||
end
|
||||
definefont /fTimes-Bold exch def
|
||||
|
||||
16 dict begin
|
||||
/FontName /fTimes-Roman def /FontType 0 def
|
||||
/WMode 0 def /FMapType 3 def /FontMatrix matrix def
|
||||
/Encoding [0 1] def
|
||||
/FDepVector [ /Times-Roman findfont %(hps)s findfont ] def
|
||||
FontName currentdict
|
||||
end
|
||||
definefont /fTimes-Roman exch def
|
||||
""" % locals()
|
||||
|
||||
show_override = """\
|
||||
%
|
||||
%%Copyright: (c) 2000, 2001 Chideok Hwang
|
||||
/han-trans {
|
||||
dup length 3 mul string /mystr exch def
|
||||
/mylen 0 def
|
||||
/in-hangul false def
|
||||
{
|
||||
dup 128 gt {
|
||||
in-hangul {
|
||||
% c
|
||||
mystr exch mylen exch put
|
||||
/mylen mylen 1 add def
|
||||
} {
|
||||
/in-hangul true def
|
||||
% 255 1 c
|
||||
mystr mylen (\\377\\1) putinterval
|
||||
mystr exch mylen 2 add exch put
|
||||
/mylen mylen 3 add def
|
||||
} ifelse
|
||||
} {
|
||||
in-hangul not {
|
||||
% c
|
||||
mystr exch mylen exch put
|
||||
/mylen mylen 1 add def
|
||||
} {
|
||||
/in-hangul false def
|
||||
% 255 0 c
|
||||
mystr mylen (\\377\\0) putinterval
|
||||
mystr exch mylen 2 add exch put
|
||||
/mylen mylen 3 add def
|
||||
} ifelse
|
||||
} ifelse
|
||||
} forall
|
||||
mystr 0 mylen getinterval
|
||||
} bind def
|
||||
|
||||
/origshow {show} bind def
|
||||
/show {han-trans origshow} bind def
|
||||
/origstringwidth {stringwidth} bind def
|
||||
/stringwidth { han-trans origstringwidth } bind def
|
||||
|
||||
%\
|
||||
"""
|
||||
|
||||
def run_a2ps(input_file):
|
||||
ps = os.popen('a2ps --output=- ' + input_file)
|
||||
return ps.readlines()
|
||||
|
||||
def run_a2ps_from_stdin(contents):
|
||||
infile_name = tmpnam()
|
||||
infile = open(infile_name, 'w')
|
||||
infile.write(contents)
|
||||
del infile # flush
|
||||
a2ps_args = ' --center-title="' + title + '" ' + \
|
||||
'--footer="<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><DEBD><EFBFBD>" ' + \
|
||||
'--output=- '+ infile_name
|
||||
ps = os.popen('a2ps ' + a2ps_args, 'r')
|
||||
outlines = ps.readlines()
|
||||
os.remove(infile_name)
|
||||
return outlines
|
||||
|
||||
try:
|
||||
i = sys.argv.index('-o')
|
||||
sys.stdout = open(sys.argv[i+1], 'w')
|
||||
del sys.argv[i:i+2]
|
||||
except: pass
|
||||
|
||||
if '-h' in sys.argv:
|
||||
sys.exit(0)
|
||||
|
||||
if '-m' in sys.argv:
|
||||
# called from mutt
|
||||
i = sys.argv.index('-m')
|
||||
del sys.argv[i]
|
||||
assert len(sys.argv) == 1
|
||||
input_buf = sys.stdin.read()
|
||||
magic = input_buf[:5];
|
||||
import re
|
||||
title = re.search('^Subject:(.*)$', input_buf, re.M).group(1)
|
||||
input_file = None
|
||||
elif len(sys.argv) == 1:
|
||||
input_buf = sys.stdin.read()
|
||||
magic = input_buf[:5]
|
||||
title = 'From Stdin'
|
||||
input_file = None
|
||||
else:
|
||||
input_file = sys.argv[1]
|
||||
magic = open(input_file).read(5)
|
||||
|
||||
if magic != '%!PS-':
|
||||
if input_file:
|
||||
input_lines = run_a2ps(input_file)
|
||||
else:
|
||||
input_lines = run_a2ps_from_stdin(input_buf)
|
||||
|
||||
trans_file(input_lines)
|
||||
|
69
a2ps-h.spec
Normal file
69
a2ps-h.spec
Normal file
@@ -0,0 +1,69 @@
|
||||
#
|
||||
# spec file for package a2ps-h (Version 20010113)
|
||||
#
|
||||
# Copyright (c) 2004 SuSE Linux AG, Nuernberg, Germany.
|
||||
# This file and all modifications and additions to the pristine
|
||||
# package are under the same license as the package itself.
|
||||
#
|
||||
# Please submit bugfixes or comments via http://www.suse.de/feedback/
|
||||
#
|
||||
|
||||
# norootforbuild
|
||||
# usedforbuild aaa_base acl attr bash bind-utils bison bzip2 coreutils cpio cpp cracklib cvs cyrus-sasl db devs diffutils e2fsprogs file filesystem fillup findutils flex gawk gdbm-devel glibc glibc-devel glibc-locale gpm grep groff gzip info insserv kbd less libacl libattr libgcc libselinux libstdc++ libxcrypt m4 make man mktemp module-init-tools ncurses ncurses-devel net-tools netcfg openldap2-client openssl pam pam-modules patch permissions popt procinfo procps psmisc pwdutils rcs readline sed sendmail strace syslogd sysvinit tar tcpd texinfo timezone unzip util-linux vim zlib zlib-devel autoconf automake binutils gcc gdbm gettext libtool perl rpm
|
||||
|
||||
Name: a2ps-h
|
||||
License: GPL
|
||||
Group: Hardware/Printing
|
||||
Requires: python
|
||||
Autoreqprov: on
|
||||
Version: 20010113
|
||||
Release: 490
|
||||
Summary: a2ps support for Korean PostScript filter. (python version)
|
||||
Source0: a2ps-h.py
|
||||
Source1: a2ps-h-font.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildArchitectures: noarch
|
||||
|
||||
%description
|
||||
a2ps support for Korean PostScript filter. (python version)
|
||||
|
||||
|
||||
|
||||
Authors:
|
||||
--------
|
||||
Hwang, ChiDeok <hwang@mizi.co.kr>
|
||||
|
||||
%prep
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
if [ -n "%{?buildroot}" ] ; then
|
||||
[ %{buildroot} != "/" ] && rm -rf %{buildroot}
|
||||
fi
|
||||
mkdir -p %{buildroot}%{_prefix}/bin
|
||||
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}
|
||||
install -m 555 %{SOURCE0} %{buildroot}%{_prefix}/bin/a2ps-h.py
|
||||
head -n 18 %{SOURCE0} > %{buildroot}%{_defaultdocdir}/%{name}/Copyright
|
||||
find %{buildroot}%{_prefix}/bin -name a2ps-h.py -exec patch {} %{SOURCE1} \;
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%dir %{_defaultdocdir}/%{name}
|
||||
%{_defaultdocdir}/%{name}/Copyright
|
||||
%attr(555, root, root) %{_prefix}/bin/a2ps-h.py
|
||||
|
||||
%changelog -n a2ps-h
|
||||
* Wed Jan 25 2006 - mls@suse.de
|
||||
- converted neededforbuild to BuildRequires
|
||||
* Mon Feb 23 2004 - hmacht@suse.de
|
||||
- building as non-root
|
||||
* Fri Jun 13 2003 - ro@suse.de
|
||||
- added directory to filelist
|
||||
* Fri Jan 26 2001 - violiet@suse.de
|
||||
- NEW a2ps-h package version to 20010113
|
||||
- change hangul PostScript font.
|
Reference in New Issue
Block a user