|
38 | 38 | % opened.
|
39 | 39 |
|
40 | 40 | % 01/03/15: Issue #20: warn users if using this function in HG2 (R2014b+)
|
| 41 | +% 27/03/15: Fixed out of memory issue with enormous EPS files (generated by print() with OpenGL renderer), related to issue #39 |
41 | 42 |
|
42 | 43 | function fstrm = fix_lines(fstrm, fname2)
|
43 | 44 |
|
|
120 | 121 | end
|
121 | 122 | end
|
122 | 123 |
|
123 |
| -% Isolate line style definition section |
124 |
| -first_sec = strfind(fstrm, '% line types:'); |
125 |
| -[second_sec, remaining] = strtok(fstrm(first_sec+1:end), '/'); |
126 |
| -[remaining, remaining] = strtok(remaining, '%'); |
127 |
| - |
128 | 124 | % Define the new styles, including the new GR format
|
129 | 125 | % Dot and dash lengths have two parts: a constant amount plus a line width
|
130 | 126 | % variable amount. The constant amount comes after dpi2point, and the
|
|
141 | 137 | '/GR { [0 dpi2point mul 4 dpi2point mul] 0 setdash 1 setlinecap } bdef'}; % Grid lines - dot spacing remains constant
|
142 | 138 |
|
143 | 139 | % Construct the output
|
144 |
| -fstrm = [fstrm(1:first_sec) second_sec sprintf('%s\r', new_style{:}) remaining]; |
| 140 | +% This is the original (memory-intensive) code: |
| 141 | +%first_sec = strfind(fstrm, '% line types:'); % Isolate line style definition section |
| 142 | +%[second_sec, remaining] = strtok(fstrm(first_sec+1:end), '/'); |
| 143 | +%[remaining, remaining] = strtok(remaining, '%'); |
| 144 | +%fstrm = [fstrm(1:first_sec) second_sec sprintf('%s\r', new_style{:}) remaining]; |
| 145 | +fstrm = regexprep(fstrm,'(% line types:.+?)/.+?%',['$1',sprintf('%s\r',new_style{:}),'%']); |
145 | 146 |
|
146 | 147 | % Write the output file
|
147 | 148 | if nargout == 0 || nargin > 1
|
|
0 commit comments