1
0
mirror of https://github.com/pdewacht/brlaser synced 2025-07-20 07:39:47 +02:00

18 Commits
v4 ... v6

Author SHA1 Message Date
23117fe9e0 Bump version number 2019-09-22 21:27:36 +02:00
1b5990560c Version 6 2019-09-22 20:44:17 +02:00
504c00f68e Add Brother HL-2270DW 2019-09-22 20:09:59 +02:00
5d36382350 add gedit backup file to .gitignore (*~) 2019-09-22 20:07:52 +02:00
c08bbc3193 Add a bunch of printers
Closes #33   Brother HL-5030
Closes #39   Brother HL-2140
Closes #44   Brother HL-2220
Closes #45   Brother DCP-L2540D
Closes #46   Brother HL-2030
2019-09-22 19:34:00 +02:00
172c3bf87b Don't compress across bands (#39)
This essentially re-introduces 7ed0d6f, but with a simpler
implementation. Some printers needed it after all.
2019-09-10 23:13:15 +02:00
ff68db0f93 Version 5 2019-05-18 22:56:02 +02:00
dbc897787e Brother HL-1110 2019-05-18 22:38:27 +02:00
17a24ef7a1 Add a bunch of printer stanzas
- Brother DCP-1602 (fixes #42)
- Brother DCP-7060D (fixes #43)
- Brother DCP-L2500D (fixes #35)
- Brother DCP-L2540DW (fixes #32)
- Brother HL-L2340D (fixes #37)
- Brother MFC-1910W (fixes #36)
- Brother MFC-7365DN (fixes #30)
- Brother MFC-7840W (fixes #41)
- Brother MFC-L2710DW (fixes #34)
- Lenovo M7605D (fixes #26)
2019-05-18 22:03:30 +02:00
779f71e80f Reduce max block size to 64 lines (#40)
This fixes HL-1210W, maybe other HL printers as well?
2019-03-25 20:57:51 +01:00
7b4bf383bd O_BINARY
Because it seems people still use OS/2
2019-03-25 20:46:20 +01:00
aa5fb9e2f0 Don't build brdecode by default
It's just a dev tool
2019-03-25 20:24:43 +01:00
7e1cc6911e Update compatibility list.
- Add DCP-7080 (#24)
- Add HL-L2320D (#25)
- Add HL-1200 series (#27)
- Mark HL-L2300D as buggy.
2018-07-04 00:14:44 +02:00
4414717ed4 Avoid overlong encodings, improve compression ratio 2018-07-03 22:42:22 +02:00
41c56264a8 Revert "Do not use delta-encoding across block boundaries"
This reverts commit 7ed0d6f2e8.

This was intended as a possible fix for problems with the HL-L2300D
(#4), but it didn't help. And it worsens compression.
2018-07-03 22:37:35 +02:00
7ed0d6f2e8 Do not use delta-encoding across block boundaries
Possible a fix for issue #4

Also: in block.h, rename line_bytes_ to block_size_
2018-04-11 22:45:08 +02:00
4f2f1d606e Add Brother HL-L2360DW (Closes #22) 2018-03-17 12:15:49 +01:00
de26cc4bf0 Add Brother MFC-7240 (Closes #21) 2018-03-13 22:07:13 +01:00
10 changed files with 220 additions and 18 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
*~
build/

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1)
project(brlaser CXX)
set(BRLASER_VERSION "4")
set(BRLASER_VERSION "6")
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type selected, default to RelWithDebInfo")
@ -112,7 +112,7 @@ target_compile_options(rastertobrlaser PRIVATE ${CUPS_CFLAGS})
target_link_libraries(rastertobrlaser ${CUPS_LIBS})
target_link_libraries(rastertobrlaser ${CUPS_LDFLAGS})
add_executable(brdecode src/brdecode.cc)
add_executable(brdecode EXCLUDE_FROM_ALL src/brdecode.cc)
add_executable(test_lest test/test_lest.cc)
add_executable(test_line test/test_line.cc src/line.cc)
add_executable(test_block test/test_block.cc)

View File

@ -1,3 +1,12 @@
brlaser v6 (2019-09-22)
Added support for some more Brother HL-series printers. These printers
had glitched output in earlier releases.
brlaser v5 (2019-05-18)
Fixed problems with Brother HL-series printers in 600 dpi mode. Thanks
to Onno Kortmann for the fix.
Added several printers.
brlaser v4 (2018-02-25)
Added several printers.
Merged duplex printing support from @xc-racer99. Enabled for DCP-7065DN.

View File

@ -8,16 +8,38 @@ such as PCL or PostScript, not all do. If you have a monochrome
Brother laser printer (or multi-function device) and the other open
source drivers don't work, this one might help.
This driver is known to work with these printers:
This driver has been reported to work with these printers:
* Brother DCP-1510
* Brother DCP-1510 series
* Brother DCP-1600 series
* Brother DCP-7030
* Brother DCP-7040
* Brother DCP-7055
* Brother DCP-7055W
* Brother DCP-7060D
* Brother DCP-7065DN
* Brother HL-L2300D
* Brother DCP-7080
* Brother DCP-L2500D series
* Brother DCP-L2520D series
* Brother DCP-L2540DW series
* Brother HL-1110 series
* Brother HL-1200 series
* Brother HL-2030 series
* Brother HL-2140 series
* Brother HL-2220 series
* Brother HL-2270DW series
* Brother HL-5030 series
* Brother HL-L2300D series
* Brother HL-L2320D series
* Brother HL-L2340D series
* Brother HL-L2360D series
* Brother MFC-1910W
* Brother MFC-7240
* Brother MFC-7360N
* Brother MFC-7365DN
* Brother MFC-7840W
* Brother MFC-L2710DW series
* Lenovo M7605D
Other printers

View File

@ -87,6 +87,13 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10
PCFileName "br1510.ppd"
}
{
ModelName "DCP-1600 series"
Attribute "NickName" "" "Brother DCP-1600 series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,XL2HB;MDL:DCP-1600 series;CLS:PRINTER;CID:Brother Laser Type1;"
PCFileName "br1600.ppd"
}
{
ModelName "DCP-7030"
Attribute "NickName" "" "Brother DCP-7030, $USING"
@ -119,6 +126,14 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10
PCFileName "br7055w.ppd"
}
{
ModelName "DCP-7060D"
Attribute "NickName" "" "Brother DCP-7060D, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7060D;CLS:PRINTER;CID:Brother Laser Type1;"
Duplex rotated
PCFileName "br7060d.ppd"
}
{
ModelName "DCP-7065DN"
Attribute "NickName" "" "Brother DCP-7065DN, $USING"
@ -127,17 +142,164 @@ Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10
PCFileName "br7065dn.ppd"
}
{
ModelName "DCP-7080"
Attribute "NickName" "" "Brother DCP-7080, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7080;CLS:PRINTER;CID:Brother Laser Type1;"
PCFileName "br7080.ppd"
}
{
ModelName "DCP-7080D"
Attribute "NickName" "" "Brother DCP-7080D, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7080D;CLS:PRINTER;CID:Brother Laser Type1;"
Duplex rotated
PCFileName "br7080d.ppd"
}
{
ModelName "DCP-L2500D"
Attribute "NickName" "" "Brother DCP-L2500D series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-L2500D series;CLS:PRINTER;CID:Brother Laser Type1;"
Duplex rotated
PCFileName "brl2500d.ppd"
}
{
ModelName "DCP-L2520D"
Attribute "NickName" "" "Brother DCP-L2520D series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-L2520D series;CLS:PRINTER;CID:Brother Laser Type1;"
Duplex rotated
PCFileName "brl2520d.ppd"
}
{
ModelName "DCP-L2540DW"
Attribute "NickName" "" "Brother DCP-L2540DW series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-L2540DW series;CLS:PRINTER;CID:Brother Laser Type1;"
Duplex rotated
PCFileName "brl2540.ppd"
}
{
ModelName "HL-1110"
Attribute "NickName" "" "Brother HL-1110 series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-1110 series;CLS:PRINTER;CID:Brother Laser Type3;"
Resolution k 1 0 0 0 "300dpi/300 DPI"
PCFileName "br1110.ppd"
}
{
ModelName "HL-1200"
Attribute "NickName" "" "Brother HL-1200 series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-1200 series;CLS:PRINTER;CID:Brother Laser Type3;"
PCFileName "br1200.ppd"
}
{
ModelName "HL-2030 series"
Attribute "NickName" "" "Brother HL-2030 series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-2030 series;CLS:PRINTER;"
PCFileName "br2030.ppd"
}
{
ModelName "HL-2140 series"
Attribute "NickName" "" "Brother HL-2140 series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-2140 series;CLS:PRINTER;"
PCFileName "br2140.ppd"
}
{
ModelName "HL-2220 series"
Attribute "NickName" "" "Brother HL-2220 series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-2220 series;CLS:PRINTER;"
PCFileName "br2220.ppd"
}
{
ModelName "HL-2270DW series"
Attribute "NickName" "" "Brother HL-2270DW series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,PCL,PCLXL;MDL:HL-2270DW series;CLS:PRINTER;CID:Brother Laser Type1;"
Resolution k 1 0 0 0 "300dpi/300 DPI"
Duplex rotated
PCFileName "br2270dw.ppd"
}
{
ModelName "HL-5030 series"
Attribute "NickName" "" "Brother HL-5030 series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,PCL;MDL:HL-5030 series;CLS:PRINTER;"
PCFileName "br5030.ppd"
}
{
ModelName "HL-L2300D"
Attribute "NickName" "" "Brother HL-L2300D, $USING"
Attribute "NickName" "" "Brother HL-L2300D series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-L2300D series;CLS:PRINTER;CID:Brother Laser Type1;"
Duplex rotated
PCFileName "brl2300d.ppd"
}
{
ModelName "HL-L2320D"
Attribute "NickName" "" "Brother HL-L2320D series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:HL-L2320D series;CLS:PRINTER;CID:Brother Laser Type1;"
Duplex rotated
PCFileName "brl2320d.ppd"
}
{
ModelName "HL-L2340D"
Attribute "NickName" "" "Brother HL-L2340D series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP,URF;MDL:HL-L2340D series;CLS:PRINTER;CID:Brother Laser Type1;URF:W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ4,RS300-600,V1.3,DM1;"
Duplex rotated
PCFileName "brl2340d.ppd"
}
{
ModelName "HL-L2360D"
Attribute "NickName" "" "Brother HL-L2360D series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,PCL,PCLXL,URF;MDL:HL-L2360D series;CLS:PRINTER;CID:Brother Laser Type1;URF:W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ4,RS300-600,V1.3,DM1;"
Duplex rotated
PCFileName "brl2360d.ppd"
}
{
ModelName "MFC-1910W"
Attribute "NickName" "" "Brother MFC-1910W, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;MFG:Brother;CMD:PJL,HBP;MDL:MFC-1910W series;CLS:PRINTER;CID:Brother Laser Type1;"
PCFileName "br1910w.ppd"
}
{
ModelName "MFC-7240"
Attribute "NickName" "" "Brother MFC-7240, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;MFG:Brother;CMD:PJL,HBP;MDL:MFC-7240;CLS:PRINTER;CID:Brother Laser Type1;"
PCFileName "br7240.ppd"
}
{
ModelName "MFC-7360N"
Attribute "NickName" "" "Brother MFC-7360N, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:MFC-7360N;CLS:PRINTER;CID:Brother Laser Type1;"
PCFileName "br7360n.ppd"
}
{
ModelName "MFC-7365DN"
Attribute "NickName" "" "Brother MFC-7365DN, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:MFC-7365DN;CLS:PRINTER;CID:Brother Laser Type1;"
Resolution k 1 0 0 0 "300dpi/300 DPI"
Duplex rotated
PCFileName "br7365dn.ppd"
}
{
ModelName "MFC-L2710DW series"
Attribute "NickName" "" "Brother MFC-L2710DW series, $USING"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP,URF;MDL:MFC-L2710DW series;CLS:PRINTER;CID:Brother Laser Type1;URF:W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ3-4-5,RS300-600-1200,V1.4,DM1;"
Duplex rotated
PCFileName "brl2710.ppd"
}

View File

@ -59,7 +59,7 @@ class block {
private:
static const unsigned max_block_size_ = 16350;
static const unsigned max_lines_per_block_ = 128;
static const unsigned max_lines_per_block_ = 64;
std::vector<std::vector<uint8_t>> lines_;
int line_bytes_;

View File

@ -105,10 +105,12 @@ void job::encode_page(const page_params &page_params,
for (int i = 1; i < lines && nextline(line); ++i) {
std::vector<uint8_t> encoded = encode_line(line, reference);
if (!block.line_fits(encoded.size())) {
block.flush(out_);
}
if (block.line_fits(encoded.size())) {
block.add_line(std::move(encoded));
} else {
block.flush(out_);
block.add_line(encode_line(line));
}
std::swap(line, reference);
}

View File

@ -145,10 +145,12 @@ vector<uint8_t> encode_line(const vector<uint8_t> &line,
int num_edits = 0;
auto line_it = line.begin();
auto line_end_it =
std::mismatch(line.rbegin(), line.rend(), reference.rbegin()).first.base();
auto ref_it = reference.begin();
while (1) {
int offset = skip_to_next_mismatch(&line_it, line.end(), &ref_it);
if (line_it == line.end()) {
int offset = skip_to_next_mismatch(&line_it, line_end_it, &ref_it);
if (line_it == line_end_it) {
// No more differences, we're done.
break;
}
@ -156,17 +158,17 @@ vector<uint8_t> encode_line(const vector<uint8_t> &line,
if (++num_edits == max_edits) {
// We've run out of edits. Just output the rest of the line in a big
// substitute command.
write_substitute(offset, line_it, line.end(), &output);
write_substitute(offset, line_it, line_end_it, &output);
break;
}
int s = substitute_length(line_it, line.end(), ref_it);
int s = substitute_length(line_it, line_end_it, ref_it);
if (s > 0) {
write_substitute(offset, line_it, std::next(line_it, s), &output);
line_it += s;
ref_it += s;
} else {
int r = repeat_length(line_it, line.end());
int r = repeat_length(line_it, line_end_it);
assert(r >= 2);
write_repeat(offset, r, *line_it, &output);
line_it += r;

View File

@ -29,6 +29,10 @@
#include "job.h"
#include "debug.h"
#ifndef O_BINARY
#define O_BINARY 0
#endif
namespace {
@ -146,7 +150,7 @@ int main(int argc, char *argv[]) {
int fd = STDIN_FILENO;
if (job_filename) {
fd = open(job_filename, O_RDONLY);
fd = open(job_filename, O_RDONLY | O_BINARY);
if (fd < 0) {
fprintf(stderr, "ERROR: " PACKAGE ": Unable to open raster file\n");
return 1;

View File

@ -37,10 +37,10 @@ const lest::test specification[] = {
EXPECT(!b.empty());
},
"A block can contain 128 lines",
"A block can contain 64 lines",
[] {
block b;
for (int i = 0; i < 128; ++i) {
for (int i = 0; i < 64; ++i) {
EXPECT(b.line_fits(1));
b.add_line(vec(1));
}