Get rid of PageSize rounding
Until January 31, 2020, the foomatic parser didn't recognize values with
fractional numbers like "9.6 2834.65" in PageSize values, so we were rounding
here. With the fix from here:
https://github.com/OpenPrinting/foomatic-db-engine/commit/75de02d
we can get rid of the rounding in ptouch-driver, and the page sizes will be a
lot more accurate.
Andreas Gruenbacher authored 4 years ago
Didier Raboud committed 3 years ago
197 | 197 | $printer->appendChild($id); |
198 | 198 | } |
199 | 199 | } |
200 | foreach my $option ($dom->findnodes('/option')) { | |
201 | next unless $option->findvalue('./arg_shortname/en') eq 'PageSize'; | |
202 | foreach my $enum ($option->findnodes('./enum_vals/enum_val')) { | |
203 | foreach my $driverval ($enum->findnodes('./ev_driverval')) { | |
204 | # Until January 31, 2020, the foomatic parser didn't | |
205 | # recognize values with fractional numbers like | |
206 | # "9.6 2834.65" in PageSize values. Until that fix is | |
207 | # available widely enough, round the numbers. | |
208 | if ($driverval->textContent =~ | |
209 | /^\s*(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)\s*$/) { | |
210 | $driverval->removeChildNodes(); | |
211 | $driverval->appendText(round($1) . ' ' . round($2)); | |
212 | } | |
213 | } | |
214 | } | |
215 | } | |
216 | 200 | } |
217 | 201 | } |
218 | 202 |