@@ -598,10 +598,25 @@ cupsdCreateCommonData(void)
598598 /* printer-strings-languages-supported */
599599 for (lang = Languages , attr = NULL ; lang ; lang = lang -> next )
600600 {
601+ char templang [256 ], // Temporary language tag0
602+ * tempptr , // Pointer into temporary language
603+ * langptr ; // Pointer into language tag
604+
605+ // Convert locale ID to a language tag...
606+ for (tempptr = templang , langptr = lang -> language ; * langptr && tempptr < (templang + sizeof (templang ) - 1 ); langptr ++ )
607+ {
608+ if (* langptr == '_' )
609+ * tempptr ++ = '-' ;
610+ else
611+ * tempptr ++ = tolower (* langptr & 255 );
612+ }
613+ * tempptr = '\0' ;
614+
615+ // Add it to the list of supported languages...
601616 if (attr )
602- ippSetString (CommonData , & attr , ippGetCount (attr ), lang -> language );
617+ ippSetString (CommonData , & attr , ippGetCount (attr ), templang );
603618 else
604- attr = ippAddString (CommonData , IPP_TAG_PRINTER , IPP_TAG_LANGUAGE , "printer-strings-languages-supported" , NULL , lang -> language );
619+ attr = ippAddString (CommonData , IPP_TAG_PRINTER , IPP_TAG_LANGUAGE , "printer-strings-languages-supported" , NULL , templang );
605620 }
606621
607622 /* server-is-sharing-printers */
@@ -4054,6 +4069,13 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
40544069 {
40554070 finishings [num_finishings ++ ] = IPP_FINISHINGS_BOOKLET_MAKER ;
40564071 }
4072+ else if (!strcmp (name , "*ColorModel" ))
4073+ {
4074+ if (!strcmp (value , "Gray" ))
4075+ ippAddString (col , IPP_TAG_ZERO , IPP_CONST_TAG (IPP_TAG_KEYWORD ), "print-color-mode" , NULL , "monochrome" );
4076+ else
4077+ ippAddString (col , IPP_TAG_ZERO , IPP_CONST_TAG (IPP_TAG_KEYWORD ), "print-color-mode" , NULL , "color" );
4078+ }
40574079 else if ((!strcmp (name , "*FoldType" ) || !strcmp (name , "*PunchMedia" ) || !strcmp (name , "*StapleLocation" )) && num_finishings < (int )(sizeof (finishings ) / sizeof (finishings [0 ])))
40584080 {
40594081 finishings [num_finishings ++ ] = ippEnumValue ("finishings" , value );
@@ -4091,7 +4113,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
40914113 else
40924114 ippAddInteger (col , IPP_TAG_ZERO , IPP_TAG_ENUM , "print-quality" , IPP_QUALITY_NORMAL );
40934115 }
4094- else if (!strcmp (name , "Duplex" ))
4116+ else if (!strcmp (name , "* Duplex" ))
40954117 {
40964118 if (!strcmp (value , "None" ))
40974119 ippAddString (col , IPP_TAG_ZERO , IPP_TAG_KEYWORD , "sides" , NULL , "one-sided" );
@@ -4103,7 +4125,7 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
41034125 else
41044126 {
41054127 // Something else...
4106- ippAddString (col , IPP_TAG_ZERO , IPP_TAG_KEYWORD , name , NULL , value );
4128+ ippAddString (col , IPP_TAG_ZERO , IPP_TAG_KEYWORD , name + 1 , NULL , value );
41074129 }
41084130 }
41094131
0 commit comments