Comment 120 for bug 10910

Revision history for this message
In , Smontagu (smontagu) wrote :

I've been debugging this a bit. The default "US Letter" setting comes from the following lines in nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter

  nsXPIDLCString papername;
  if (NS_SUCCEEDED(CopyPrinterCharPref(pPrefs, "postscript", printerName, "paper_size", papername))) {
  nsPaperSizePS paper;

  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.