~ubuntu-branches/ubuntu/precise/gutenprint/precise

« back to all changes in this revision

Viewing changes to src/main/print-escp2.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2009-08-14 10:06:24 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090814100624-agjl4bv8obqsjmkn
Tags: 5.2.4-0ubuntu1
* New upstream release
   - Added support for Canon PIXMA iX4000, Canon SELPHY CP-520, EPSON 
     Stylus Photo R2880, EPSON Stylus DX4000
   - Corrections for Epson PM-D600, Epson Stylus Photo R2400, EPSON Artisan
     700/800, Stylus Photo P/TX700/800 series
   - Name corrections for all Ricoh anmd OEM printers and for the
     EPSON Stylus Photo PX700W,EPSON Stylus Photo TX700W, EPSON Stylus Photo
     PX800FW, EPSON Stylus Photo TX800FW
   - The EPSON inkjet utility, escputil, now correctly prints the color name
     for low ink warnings.
   - Printing resolution names have been fixed in non-English locales
     in CUPS PPD files.
   - A Russian translation has been added.  The Danish and Italian
     translations have been updated.
   - Support has been added for L-size paper with tear-off borders.
   - The ordering of inks in quadtone ink sets on Epson printers has
     been corrected.  In addition, support has been added for MIS
     quadtone and 6 tone inks.
   - It is now possible to adjust the ink parameters for quadtone
     inks in CUPS.  Previously, these parameters could only be
     adjusted in the enhanced Print plugin for GIMP and other native
     Gutenprint applications.
   - Updating CUPS PPD files is now faster.
* debian/patches/20_fix_gimpprint_menu_entry.dpatch: Removed, was already
  deactivated for longer time.
* debian/patches/25_sync-ricoh-printer-names-with-openprinting.dpatch:
  Removed, applied upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * "$Id: print-escp2.c,v 1.416 2008/11/22 20:34:29 rlk Exp $"
 
2
 * "$Id: print-escp2.c,v 1.424 2009/07/21 11:07:06 rlk Exp $"
3
3
 *
4
4
 *   Print plug-in EPSON ESC/P2 driver for the GIMP.
5
5
 *
317
317
    STP_PARAMETER_LEVEL_INTERNAL, 0, 0, STP_CHANNEL_NONE, 0, 0
318
318
  },
319
319
  {
 
320
    "RawChannelNames", N_("Raw Channel Names"), N_("Advanced Printer Functionality"),
 
321
    N_("Raw Channel Names"),
 
322
    STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
 
323
    STP_PARAMETER_LEVEL_INTERNAL, 0, 0, STP_CHANNEL_NONE, 0, 0
 
324
  },
 
325
  {
320
326
    "ChannelNames", N_("Channel Names"), N_("Advanced Printer Functionality"),
321
327
    N_("Channel Names"),
322
328
    STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE,
740
746
  },
741
747
  {
742
748
    {
 
749
      "HGray5Value", N_("Hextone Gray 5 Value"), N_("Advanced Ink Adjustment"),
 
750
      N_("Hextone Gray 5 (Darkest) Value"),
 
751
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
752
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
753
    }, 0.0, 5.0, 1.0, 1
 
754
  },
 
755
  {
 
756
    {
 
757
      "HGray5Trans", N_("Hextone Gray 5 Transition"), N_("Advanced Ink Adjustment"),
 
758
      N_("Hextone Gray 5 (Darkest) Transition"),
 
759
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
760
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
761
    }, 0.0, 5.0, 1.0, 1
 
762
  },
 
763
  {
 
764
    {
 
765
      "HGray5Scale", N_("Hextone Gray 5 Density Scale"), N_("Advanced Ink Adjustment"),
 
766
      N_("Hextone Gray 5 (Darkest) Density Scale"),
 
767
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
768
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
769
    }, 0.0, 5.0, 1.0, 1
 
770
  },
 
771
  {
 
772
    {
 
773
      "HGray4Value", N_("Hextone Gray 4 Value"), N_("Advanced Ink Adjustment"),
 
774
      N_("Hextone Gray 4 Value"),
 
775
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
776
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
777
    }, 0.0, 5.0, 1.0, 1
 
778
  },
 
779
  {
 
780
    {
 
781
      "HGray4Trans", N_("Hextone Gray 4 Transition"), N_("Advanced Ink Adjustment"),
 
782
      N_("Hextone Gray 4 Transition"),
 
783
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
784
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
785
    }, 0.0, 5.0, 1.0, 1
 
786
  },
 
787
  {
 
788
    {
 
789
      "HGray4Scale", N_("Hextone Gray 4 Density Scale"), N_("Advanced Ink Adjustment"),
 
790
      N_("Hextone Gray 4 Density Scale"),
 
791
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
792
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
793
    }, 0.0, 5.0, 1.0, 1
 
794
  },
 
795
  {
 
796
    {
 
797
      "HGray3Value", N_("Hextone Gray 3 Value"), N_("Advanced Ink Adjustment"),
 
798
      N_("Hextone Gray 3 Value"),
 
799
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
800
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
801
    }, 0.0, 5.0, 1.0, 1
 
802
  },
 
803
  {
 
804
    {
 
805
      "HGray3Trans", N_("Hextone Gray 3 Transition"), N_("Advanced Ink Adjustment"),
 
806
      N_("Hextone Gray 3 Transition"),
 
807
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
808
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
809
    }, 0.0, 5.0, 1.0, 1
 
810
  },
 
811
  {
 
812
    {
 
813
      "HGray3Scale", N_("Hextone Gray 3 Density Scale"), N_("Advanced Ink Adjustment"),
 
814
      N_("Hextone Gray 3 Density Scale"),
 
815
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
816
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
817
    }, 0.0, 5.0, 1.0, 1
 
818
  },
 
819
  {
 
820
    {
 
821
      "HGray2Value", N_("Hextone Gray 2 Value"), N_("Advanced Ink Adjustment"),
 
822
      N_("Hextone Gray 2 Value"),
 
823
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
824
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
825
    }, 0.0, 5.0, 1.0, 1
 
826
  },
 
827
  {
 
828
    {
 
829
      "HGray2Trans", N_("Hextone Gray 2 Transition"), N_("Advanced Ink Adjustment"),
 
830
      N_("Hextone Gray 2 Transition"),
 
831
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
832
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
833
    }, 0.0, 5.0, 1.0, 1
 
834
  },
 
835
  {
 
836
    {
 
837
      "HGray2Scale", N_("Hextone Gray 2 Density Scale"), N_("Advanced Ink Adjustment"),
 
838
      N_("Hextone Gray 2 Density Scale"),
 
839
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
840
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
841
    }, 0.0, 5.0, 1.0, 1
 
842
  },
 
843
  {
 
844
    {
 
845
      "HGray1Value", N_("Hextone Gray 1 Value"), N_("Advanced Ink Adjustment"),
 
846
      N_("Hextone Gray 1 (Lightest) Value"),
 
847
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
848
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
849
    }, 0.0, 5.0, 1.0, 1
 
850
  },
 
851
  {
 
852
    {
 
853
      "HGray1Trans", N_("Hextone Gray 1 Transition"), N_("Advanced Ink Adjustment"),
 
854
      N_("Hextone Gray 1 (Lightest) Transition"),
 
855
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
856
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
857
    }, 0.0, 5.0, 1.0, 1
 
858
  },
 
859
  {
 
860
    {
 
861
      "HGray1Scale", N_("Hextone Gray 1 Density Scale"), N_("Advanced Ink Adjustment"),
 
862
      N_("Hextone Gray 1 (Lightest) Density Scale"),
 
863
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
 
864
      STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0
 
865
    }, 0.0, 5.0, 1.0, 1
 
866
  },
 
867
  {
 
868
    {
743
869
      "BlackTrans", N_("GCR Transition"), N_("Advanced Output Control"),
744
870
      N_("Adjust the gray component transition rate"),
745
871
      STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT,
796
922
{
797
923
  {
798
924
    {
 
925
      "QualityEnhancement", N_("Quality Enhancement"), N_("Advanced Printer Functionality"),
 
926
      N_("Enhance print quality by additional passes"),
 
927
      STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
 
928
      STP_PARAMETER_LEVEL_ADVANCED2, 0, 1, STP_CHANNEL_NONE, 1, 0
 
929
    }, 0, 4, 0
 
930
  },
 
931
  {
 
932
    {
799
933
      "PaperThickness", N_("Paper Thickness"), N_("Advanced Printer Functionality"),
800
934
      N_("Set printer paper thickness"),
801
935
      STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
837
971
  {
838
972
    {
839
973
      "FeedAdjustment", N_("Feed Adjustment"), N_("Advanced Printer Functionality"),
 
974
      /* xgettext:no-c-format */
840
975
      N_("Set paper feed adjustment (0.01% units)"),
841
976
      STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE,
842
977
      STP_PARAMETER_LEVEL_ADVANCED3, 0, 1, STP_CHANNEL_NONE, 1, 0
1544
1679
  return &(ink_list->inknames[0]);
1545
1680
}
1546
1681
 
 
1682
static const inkname_t *
 
1683
get_inktype_only(const stp_vars_t *v)
 
1684
{
 
1685
  const char    *ink_type = stp_get_string_parameter(v, "InkType");
 
1686
 
 
1687
  if (!ink_type)
 
1688
    return NULL;
 
1689
  else
 
1690
    return get_inktype(v);
 
1691
}
 
1692
 
 
1693
static int
 
1694
printer_supports_inkset(const stp_vars_t *v, inkset_id_t inkset)
 
1695
{
 
1696
  const inkgroup_t *ink_group = escp2_inkgroup(v);
 
1697
  int i;
 
1698
  for (i = 0; i < ink_group->n_inklists; i++)
 
1699
    {
 
1700
      const inklist_t *ink_list = &(ink_group->inklists[i]);
 
1701
      if (ink_list)
 
1702
        {
 
1703
          int j;
 
1704
          for (j = 0; j < ink_list->n_inks; j++)
 
1705
            {
 
1706
              if (ink_list->inknames[j].inkset == inkset)
 
1707
                {
 
1708
                  return 1;
 
1709
                }
 
1710
            }
 
1711
        }
 
1712
    }
 
1713
  return 0;
 
1714
}
 
1715
 
1547
1716
static const stp_vars_t *
1548
1717
get_media_adjustment(const stp_vars_t *v)
1549
1718
{
1680
1849
                         stp_parameter_t *description,
1681
1850
                         int expected_channels)
1682
1851
{
1683
 
  const inkname_t *ink_name = get_inktype(v);
 
1852
  const inkname_t *ink_name = get_inktype_only(v);
1684
1853
  description->is_active = 0;
1685
 
  if (ink_name && 
 
1854
  if (!ink_name &&
 
1855
      ((expected_channels == 4 && printer_supports_inkset(v, INKSET_QUADTONE)) ||
 
1856
       (expected_channels == 6 && printer_supports_inkset(v, INKSET_HEXTONE))))
 
1857
    fill_value_parameters(v, description, STP_ECOLOR_K);
 
1858
  else if (ink_name && 
1686
1859
      (ink_name->channels[STP_ECOLOR_K].n_subchannels ==
1687
1860
       expected_channels))
1688
1861
    fill_value_parameters(v, description, STP_ECOLOR_K);
1727
1900
                              stp_parameter_t *description,
1728
1901
                              int expected_channels)
1729
1902
{
1730
 
  const inkname_t *ink_name = get_inktype(v);
 
1903
  const inkname_t *ink_name = get_inktype_only(v);
1731
1904
  description->is_active = 0;
 
1905
  if (!ink_name &&
 
1906
      ((expected_channels == 4 && printer_supports_inkset(v, INKSET_QUADTONE)) ||
 
1907
       (expected_channels == 6 && printer_supports_inkset(v, INKSET_HEXTONE))))
 
1908
    fill_transition_parameters(v, description, STP_ECOLOR_K);
1732
1909
  if (ink_name && 
1733
1910
      (ink_name->channels[STP_ECOLOR_K].n_subchannels ==
1734
1911
       expected_channels))
1768
1945
                              stp_parameter_t *description,
1769
1946
                              int expected_channels)
1770
1947
{
1771
 
  const inkname_t *ink_name = get_inktype(v);
 
1948
  const inkname_t *ink_name = get_inktype_only(v);
1772
1949
  description->is_active = 0;
 
1950
  if (!ink_name &&
 
1951
      ((expected_channels == 4 && printer_supports_inkset(v, INKSET_QUADTONE)) ||
 
1952
       (expected_channels == 6 && printer_supports_inkset(v, INKSET_HEXTONE))))
 
1953
    fill_transition_parameters(v, description, STP_ECOLOR_K);
1773
1954
  if (ink_name &&
1774
1955
      (ink_name->channels[STP_ECOLOR_K].n_subchannels ==
1775
1956
       expected_channels))
1941
2122
  return NULL;
1942
2123
}
1943
2124
 
 
2125
static const inkname_t *
 
2126
get_raw_inktype(const stp_vars_t *v)
 
2127
{
 
2128
  if (strcmp(stp_get_string_parameter(v, "InputImageType"), "Raw") == 0)
 
2129
    {
 
2130
      const inklist_t *inks = stp_escp2_inklist(v);
 
2131
      int ninktypes = inks->n_inks;
 
2132
      int i;
 
2133
      const char *channel_name = stp_get_string_parameter(v, "RawChannels");
 
2134
      const channel_count_t *count;
 
2135
      if (!channel_name)
 
2136
        goto none;
 
2137
      count = get_channel_count_by_name(channel_name);
 
2138
      if (!count)
 
2139
        goto none;
 
2140
      for (i = 0; i < ninktypes; i++)
 
2141
        if (inks->inknames[i].inkset == INKSET_EXTENDED &&
 
2142
            (inks->inknames[i].channel_count == count->count))
 
2143
          return &(inks->inknames[i]);
 
2144
    }
 
2145
 none:
 
2146
  return get_inktype(v);
 
2147
}
 
2148
 
1944
2149
static void
1945
2150
escp2_parameters(const stp_vars_t *v, const char *name,
1946
2151
                 stp_parameter_t *description)
2455
2660
      const inklist_t *inks = stp_escp2_inklist(v);
2456
2661
      int ninktypes = inks->n_inks;
2457
2662
      description->bounds.str = stp_string_list_create();
2458
 
      if (ninktypes > 1)
 
2663
      if (ninktypes >= 1)
2459
2664
        {
2460
2665
          stp_string_list_add_string(description->bounds.str, "None", "None");
2461
2666
          for (i = 0; i < ninktypes; i++)
2470
2675
          description->deflt.str =
2471
2676
            stp_string_list_param(description->bounds.str, 0)->name;
2472
2677
        }
2473
 
      if (ninktypes <= 1)
 
2678
      else
2474
2679
        description->is_active = 0;
2475
2680
    }
 
2681
  else if (strcmp(name, "RawChannelNames") == 0)
 
2682
    {
 
2683
      const inkname_t *ink_name = get_raw_inktype(v);
 
2684
      if (ink_name)
 
2685
        {
 
2686
          description->bounds.str = stp_string_list_create();
 
2687
          for (i = 0; i < ink_name->channel_count; i++)
 
2688
            {
 
2689
              int j;
 
2690
              const ink_channel_t *ic = &(ink_name->channels[i]);
 
2691
              if (ic)
 
2692
                for (j = 0; j < ic->n_subchannels; j++)
 
2693
                  if (ic->subchannels[j].name)
 
2694
                    stp_string_list_add_string(description->bounds.str,
 
2695
                                               ic->subchannels[j].name,
 
2696
                                               gettext(ic->subchannels[j].text));
 
2697
            }
 
2698
          for (i = 0; i < ink_name->aux_channel_count; i++)
 
2699
            {
 
2700
              int j;
 
2701
              const ink_channel_t *ic = &(ink_name->aux_channels[i]);
 
2702
              if (ic)
 
2703
                for (j = 0; j < ic->n_subchannels; j++)
 
2704
                  if (ic->subchannels[j].name)
 
2705
                    stp_string_list_add_string(description->bounds.str,
 
2706
                                               ic->subchannels[j].name,
 
2707
                                               gettext(ic->subchannels[j].text));
 
2708
            }
 
2709
          description->deflt.str =
 
2710
            stp_string_list_param(description->bounds.str, 0)->name;
 
2711
        }
 
2712
    }
2476
2713
  else if (strcmp(name, "MultiChannelLimit") == 0)
2477
2714
    {
2478
2715
      description->is_active = 0;
2500
2737
      if (stp_escp2_has_media_feature(v, name))
2501
2738
        description->is_active = 1;
2502
2739
    }
 
2740
  else if (strcmp(name, "QualityEnhancement") == 0)
 
2741
    {
 
2742
      description->is_active = 1;
 
2743
    }
2503
2744
}
2504
2745
 
2505
2746
const res_t *
2790
3031
          switch (ink_type->inkset)
2791
3032
            {
2792
3033
            case INKSET_QUADTONE:
 
3034
            case INKSET_HEXTONE:
2793
3035
              return "Grayscale";
2794
3036
            case INKSET_OTHER:
2795
3037
            case INKSET_CMYK:
3638
3880
  pd->nozzle_start = 0;
3639
3881
  pd->min_nozzles = 1;
3640
3882
  pd->use_black_parameters = 0;
 
3883
  pd->extra_vertical_passes = 1;
3641
3884
}
3642
3885
 
3643
3886
static void
3665
3908
 
3666
3909
  pd->printer_weave = get_printer_weave(v);
3667
3910
 
 
3911
  pd->extra_vertical_passes = 1 << stp_get_int_parameter(v, "QualityEnhancement");
3668
3912
  if (stp_escp2_has_cap(v, MODEL_FAST_360, MODEL_FAST_360_YES) &&
3669
3913
      (pd->inkname->inkset == INKSET_CMYK || pd->physical_channels == 1) &&
3670
3914
      pd->res->hres == pd->physical_xdpi && pd->res->vres == 360)
3806
4050
    }
3807
4051
  else
3808
4052
    {
3809
 
      pd->page_extra_height = 0;
 
4053
      if (input_slot)
 
4054
        pd->page_extra_height = input_slot->extra_height *
 
4055
          pd->page_management_units / escp2_base_separation(v);
 
4056
      else
 
4057
        pd->page_extra_height = 0;
3810
4058
      pd->paper_extra_bottom = escp2_paper_extra_bottom(v);
3811
4059
    }
3812
4060
  internal_imageable_area(v, 0, 0, &pd->page_left, &pd->page_right,
4051
4299
     pd->nozzles,
4052
4300
     pd->nozzle_separation * pd->res->vres / escp2_base_separation(v),
4053
4301
     pd->horizontal_passes,
4054
 
     pd->res->vertical_passes,
 
4302
     pd->res->vertical_passes * pd->extra_vertical_passes,
4055
4303
     1,
4056
4304
     pd->channels_in_use,
4057
4305
     pd->bitwidth,
4135
4383
      stp_eprintf(v, "Warning: Quadtone inkset only available in MONO\n");
4136
4384
      stp_set_string_parameter(v, "PrintingMode", "BW");
4137
4385
    }
 
4386
  if (pd->inkname && pd->inkname->inkset == INKSET_HEXTONE &&
 
4387
      strcmp(stp_get_string_parameter(v, "PrintingMode"), "BW") != 0)
 
4388
    {
 
4389
      stp_eprintf(v, "Warning: Hextone inkset only available in MONO\n");
 
4390
      stp_set_string_parameter(v, "PrintingMode", "BW");
 
4391
    }
4138
4392
  pd->channels_in_use = count_channels(pd->inkname, pd->use_aux_channels);
4139
4393
 
4140
4394
  setup_basic(v);