if (paper.Find(papername)) {
DO_PR_DEBUG_LOG(("setting default paper size to '%s' (%g mm/%g mm)\n", paper.Name(), paper.Width_mm(), paper.Height_mm()));
aPrintSettings->SetPaperSizeUnit(nsIPrintSettings::kPaperSizeMillimeters);
aPrintSettings->SetPaperWidth(paper.Width_mm());
aPrintSettings->SetPaperHeight(paper.Height_mm());
aPrintSettings->SetPaperName(NS_ConvertASCIItoUTF16(paper.Name()).get());
}
It would be better to just call SetPaperName with null and let gtk_paper_size_new set it to the locale default. Better still would be to pull in the system settings for the printer, but I'm not sure how to do that.
I've been debugging this a bit. The default "US Letter" setting comes from the following lines in nsPrinterEnumer atorGTK: :InitPrintSetti ngsFromPrinter
nsXPIDLCString papername; CopyPrinterChar Pref(pPrefs, "postscript", printerName, "paper_size", papername))) {
if (NS_SUCCEEDED(
nsPaperSizePS paper;
if (paper. Find(papername) ) { PR_DEBUG_ LOG(("setting default paper size to '%s' (%g mm/%g mm)\n",
paper.Name( ), paper.Width_mm(), paper.Height_ mm())); ngs->SetPaperSi zeUnit( nsIPrintSetting s::kPaperSizeMi llimeters) ; ngs->SetPaperWi dth(paper. Width_mm( )); ngs->SetPaperHe ight(paper. Height_ mm()); ngs->SetPaperNa me(NS_ConvertAS CIItoUTF16( paper.Name( )).get( ));
DO_
aPrintSetti
aPrintSetti
aPrintSetti
aPrintSetti
}
It would be better to just call SetPaperName with null and let gtk_paper_size_new set it to the locale default. Better still would be to pull in the system settings for the printer, but I'm not sure how to do that.