Make Fl_GTK_Printer_Driver recognize more paper sizes

also, make clear the B* paper size names are from JIS not ISO.
This commit is contained in:
ManoloFLTK 2024-04-08 17:24:38 +02:00
parent 2662cad50b
commit ba7b2427b6
2 changed files with 17 additions and 11 deletions

View File

@ -126,17 +126,17 @@ const Fl_Paged_Device::page_format Fl_Paged_Device::page_formats[NO_PAGE_FORMATS
{ 105, 148, "A9"},
// B* // index(Bi) = i+10
{2920, 4127, "B0"},
{2064, 2920, "B1"},
{1460, 2064, "B2"},
{1032, 1460, "B3"},
{ 729, 1032, "B4"},
{ 516, 729, "B5"},
{ 363, 516, "B6"},
{ 258, 363, "B7"},
{ 181, 258, "B8"},
{ 127, 181, "B9"},
{ 91, 127, "B10"},
{2920, 4127, "B0(JIS)"},
{2064, 2920, "B1(JIS)"},
{1460, 2064, "B2(JIS)"},
{1032, 1460, "B3(JIS)"},
{ 729, 1032, "B4(JIS)"},
{ 516, 729, "B5(JIS)"},
{ 363, 516, "B6(JIS)"},
{ 258, 363, "B7(JIS)"},
{ 181, 258, "B8(JIS)"},
{ 127, 181, "B9(JIS)"},
{ 91, 127, "B10(JIS)"},
// others
{ 459, 649, "EnvC5"}, // envelope

View File

@ -40,6 +40,9 @@ class Fl_Posix_Printer_Driver : public Fl_PostScript_File_Device {
#define GTK_PAPER_NAME_LEGAL "na_legal"
#define GTK_PAPER_NAME_A3 "iso_a3"
#define GTK_PAPER_NAME_A5 "iso_a5"
#define GTK_PAPER_NAME_JB5 "jis_b5"
#define GTK_PAPER_NAME_TABLOID "na_ledger"
#define GTK_PAPER_NAME_DLE "iso_dl"
#define GTK_RESPONSE_NONE 0
#define GTK_RESPONSE_OK -5
#define GTK_PRINT_PAGES_RANGES 2
@ -156,6 +159,9 @@ int Fl_GTK_Printer_Driver::begin_job(int pagecount, int *firstpage, int *lastpag
else if (strcmp(pname, GTK_PAPER_NAME_LEGAL) == 0) format = Fl_Paged_Device::LEGAL;
else if (strcmp(pname, GTK_PAPER_NAME_A3) == 0) format = Fl_Paged_Device::A3;
else if (strcmp(pname, GTK_PAPER_NAME_A5) == 0) format = Fl_Paged_Device::A5;
else if (strcmp(pname, GTK_PAPER_NAME_JB5) == 0) format = Fl_Paged_Device::B5;
else if (strcmp(pname, GTK_PAPER_NAME_TABLOID) == 0) format = Fl_Paged_Device::TABLOID;
else if (strcmp(pname, GTK_PAPER_NAME_DLE) == 0) format = Fl_Paged_Device::DLE;
GtkPrinter *gprinter = CALL_GTK(gtk_print_unix_dialog_get_selected_printer)(pdialog); //2.10
psettings = CALL_GTK(gtk_print_unix_dialog_get_settings)(pdialog); //2.10
const char* p = CALL_GTK(gtk_print_settings_get)(psettings, "output-uri"); //2.10