Added patch for improved asymptote support (#483503)
This commit is contained in:
parent
c170ae5ca7
commit
fbc4128c28
149
pstoedit-3.45-asy.patch
Normal file
149
pstoedit-3.45-asy.patch
Normal file
@ -0,0 +1,149 @@
|
||||
diff -ru pstoedit-3.45/src/drvasy.cpp pstoedit-3.45J/src/drvasy.cpp
|
||||
--- pstoedit-3.45/src/drvasy.cpp 2007-07-22 05:27:30.000000000 -0600
|
||||
+++ pstoedit-3.45J/src/drvasy.cpp 2007-12-08 16:22:58.000000000 -0700
|
||||
@@ -58,7 +58,8 @@
|
||||
clipmode(false),
|
||||
evenoddmode(false),
|
||||
firstpage(true),
|
||||
- imgcount(0)
|
||||
+ imgcount(0),
|
||||
+ level(0)
|
||||
{
|
||||
// Output copyright information
|
||||
outf << "// Converted from PostScript(TM) to Asymptote by pstoedit\n"
|
||||
@@ -76,6 +77,29 @@
|
||||
options=0;
|
||||
}
|
||||
|
||||
+void drvASY::save()
|
||||
+{
|
||||
+ while(gsavestack.size() && gsavestack.front()) {
|
||||
+ gsavestack.pop_front();
|
||||
+ outf << "gsave();" << endl;
|
||||
+ ++level;
|
||||
+ clipstack.push_back(false);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void drvASY::restore() {
|
||||
+ while(gsavestack.size() && !gsavestack.front()) {
|
||||
+ gsavestack.pop_front();
|
||||
+ while(clipstack.size() > 0) {
|
||||
+ if(clipstack.back())
|
||||
+ outf << "endclip();" << endl;
|
||||
+ clipstack.pop_back();
|
||||
+ }
|
||||
+ outf << "grestore();" << endl;
|
||||
+ if(level > 0) --level;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// Output a path
|
||||
void drvASY::print_coords()
|
||||
{
|
||||
@@ -84,11 +108,7 @@
|
||||
bool havecycle=false;
|
||||
bool firstpoint=false;
|
||||
|
||||
- while(gsavestack.size() && gsavestack.front()) {
|
||||
- gsavestack.pop_front();
|
||||
- outf << "gsave();" << endl;
|
||||
- clipstack.push_back(false);
|
||||
- }
|
||||
+ save();
|
||||
|
||||
if (fillmode || clipmode) {
|
||||
for (unsigned int n = 0; n < numberOfElementsInPath(); n++) {
|
||||
@@ -247,16 +267,7 @@
|
||||
outf << ");" << endl;
|
||||
}
|
||||
}
|
||||
-
|
||||
- while(gsavestack.size() && !gsavestack.front()) {
|
||||
- gsavestack.pop_front();
|
||||
- if(clipstack.size() > 0) {
|
||||
- if(clipstack.back())
|
||||
- outf << "endclip();" << endl;
|
||||
- clipstack.pop_back();
|
||||
- }
|
||||
- outf << "grestore();" << endl;
|
||||
- }
|
||||
+ restore();
|
||||
}
|
||||
|
||||
// Each page will produce a different figure
|
||||
@@ -272,6 +283,8 @@
|
||||
|
||||
void drvASY::show_image(const PSImage & imageinfo)
|
||||
{
|
||||
+ restore();
|
||||
+
|
||||
if (outBaseName == "" ) {
|
||||
errf << "images cannot be handled via standard output. Use an output file" << endl;
|
||||
return;
|
||||
@@ -285,9 +298,13 @@
|
||||
ostringstream buf;
|
||||
buf << outBaseName << "." << imgcount << ".eps";
|
||||
|
||||
- outf << "label(graphic(\"" << buf.str() << "\"),("
|
||||
+ outf << "label(graphic(\"" << buf.str() << "\",\"bb="
|
||||
+ << ll.x_ << " " << ll.y_ << " " << ur.x_ << " " << ur.y_ << "\"),("
|
||||
<< ll.x_ << "," << ll.y_ << "),align);" << endl;
|
||||
- outf << "layer();" << endl;
|
||||
+
|
||||
+ // Try to draw image in a separate layer.
|
||||
+ if(level == 0)
|
||||
+ outf << "layer();" << endl;
|
||||
|
||||
ofstream outi(buf.str().c_str());
|
||||
if (!outi) {
|
||||
@@ -304,6 +321,8 @@
|
||||
// Output a text string
|
||||
void drvASY::show_text(const TextInfo & textinfo)
|
||||
{
|
||||
+ restore();
|
||||
+
|
||||
// Change fonts
|
||||
string thisFontName(textinfo.currentFontName.value());
|
||||
string thisFontWeight(textinfo.currentFontWeight.value());
|
||||
@@ -361,7 +380,8 @@
|
||||
if(prevFontAngle != 0.0) outf << "rotate(" << prevFontAngle << ")*(";
|
||||
bool texify=false;
|
||||
bool quote=false;
|
||||
- for (const char *c = textinfo.thetext.value(); *c; c++) {
|
||||
+ const char *c=textinfo.thetext.value();
|
||||
+ if(*c) for (; *c; c++) {
|
||||
if (*c >= ' ' && *c != '\\' && *c <= '~') {
|
||||
if(!texify) {
|
||||
if(quote) outf << "\"+";
|
||||
@@ -383,7 +403,7 @@
|
||||
}
|
||||
outf << "\\char" << (int) *c;
|
||||
}
|
||||
- }
|
||||
+ } else outf << "\"\"";
|
||||
if(quote) outf << "\"";
|
||||
if(texify) outf << ")";
|
||||
if(prevFontAngle != 0.0) outf << ")";
|
||||
diff -ru pstoedit-3.45/src/drvasy.h pstoedit-3.45J/src/drvasy.h
|
||||
--- pstoedit-3.45/src/drvasy.h 2007-07-22 05:27:40.000000000 -0600
|
||||
+++ pstoedit-3.45J/src/drvasy.h 2007-12-08 16:22:51.000000000 -0700
|
||||
@@ -58,6 +58,8 @@
|
||||
|
||||
private:
|
||||
void print_coords();
|
||||
+ void save();
|
||||
+ void restore();
|
||||
// Previous values of graphics state variables
|
||||
string prevFontName;
|
||||
string prevFontWeight;
|
||||
@@ -80,6 +82,9 @@
|
||||
|
||||
int imgcount;
|
||||
|
||||
+ unsigned int level;
|
||||
+ // gsave nesting level
|
||||
+
|
||||
std::list<bool> clipstack;
|
||||
std::list<bool> gsavestack;
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
Name: pstoedit
|
||||
Version: 3.45
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Summary: Translates PostScript and PDF graphics into other vector formats
|
||||
|
||||
Group: Applications/Productivity
|
||||
@ -10,6 +10,7 @@ Source0: http://download.sourceforge.net/pstoedit/pstoedit-%{version}.tar
|
||||
Patch0: pstoedit-3.44-cxxflags.patch
|
||||
Patch1: pstoedit-3.45-quiet.patch
|
||||
Patch2: pstoedit-3.45-gcc43.patch
|
||||
Patch3: pstoedit-3.45-asy.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Requires: ghostscript
|
||||
BuildRequires: gd-devel
|
||||
@ -44,6 +45,7 @@ applications
|
||||
%patch0 -p1 -b .cxxflags
|
||||
%patch1 -p1 -b .quiet
|
||||
%patch2 -p1 -b .gcc43
|
||||
%patch3 -p1 -b .asy
|
||||
dos2unix doc/*.htm doc/readme.txt
|
||||
|
||||
%build
|
||||
@ -88,6 +90,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/aclocal/*.m4
|
||||
|
||||
%changelog
|
||||
* Sat Feb 7 2009 Denis Leroy <denis@poolshark.org> - 3.45-5
|
||||
- Added patch for improved asymptote support (#483503)
|
||||
|
||||
* Wed Sep 24 2008 Denis Leroy <denis@poolshark.org> - 3.45-4
|
||||
- Fixed cxxflags patch fuziness issue
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user