Difference between revisions of "DefaultPaperSize"

From Apache OpenOffice Wiki
Jump to: navigation, search
Line 42: Line 42:
  
 
== CLDR ==
 
== CLDR ==
At [http://www.unicode.org/cldr/data/charts/supplemental/territory_language_information.html unicode.org] the only locales listed as using Letter are the US and Canada. (Puerto Rico, Mexico, Venezuela are all listed as A4). While [http://en.wikipedia.org/wiki/Paper_size Wikipedia] also agrees that only the US and Canada officially don't use A4 but that in Mexico, Colombia, Chile and the Philippines Letter is also commonly used
+
At [http://www.unicode.org/cldr/data/charts/supplemental/territory_language_information.html unicode.org] the only locales listed as using Letter are the US and Canada. (Puerto Rico, Mexico, Venezuela are all listed as A4). While [http://en.wikipedia.org/wiki/Paper_size Wikipedia] also agrees that only the US and Canada officially don't use A4 but that in Mexico, Colombia, Chile and the Philippines Letter is also commonly used. Meanwhile at [http://msdn.microsoft.com/en-us/library/cc195164.aspx Microsoft] the list of Letter nations is, the US, Canada, Argentina, Brazil, Chile, Mexico, Venezuela and "Latin American countries"
  
 
== Summary ==
 
== Summary ==

Revision as of 14:32, 31 July 2008

Default Paper Size on Linux

In OpenOffice.org VCL has a concept of a default paper size for a printer, and most applications then have a parallel concept of a default paper size for pages in a documents.

The VCL paper size for a printer can be seen in the UI in file->printer settings->properties->paper size The Application paper size for a page can be seen in the UI in e.g. writer from format->page

The VCL paper size doesn't matter greatly as its overridden by most OpenOffice.org applications, only simple applications like Math have no page style to override it.

VCL Default Paper Size

On Linux this default paper size is determined in psprint/source/printer/printerinfomanager.cxx as PrinterInfoManager::initSystemDefaultPaper the algorithm is

  • ask paperconf if it exists
    • paperconf checks $PAPERSIZE as "Letter" vs "A4", falling back to the contents of the file at $PAPERCONF, falling back to the contents of /etc/papersize, falling back to a default of "Letter"
  • otherwise check LC_PAPER and use mapping one
  • otherwise check osl_getProcessLocale and use mapping one
    • osl_getProcessLocale ends up in sal/osl/unx/nlsupport.c taking the value of LC_CTYPE

mapping one

All locales are A4 except for: en_US, en_CA, fr_CA, en

Application Default Paper Size

The default paper size is derived effectively from DefaultLocale by SvxPaperInfo::GetDefaultSvxPaper in svx/source/items/paperinf.cxx using mapping two. DefaultLocale is set during first-start from

  • getLangFromEnvironment in i18npool/source/isolang/inunx.cxx
    • LC_ALL, LC_CTYPE, LANG

mapping two

All locales are A4 except for: en_US, en_CA, fr_CA, es_MX, es_VE

GTK

For comparison gtk has gtk_paper_size_get_default which takes this from the locale as well, using mapping three.

  • LC_PAPER, LC_MESSAGES (gtk/gtkpapersize.c)

mapping three

All locales are A4 except for: en_US, en_CA, es_PR, es_US


CLDR

At unicode.org the only locales listed as using Letter are the US and Canada. (Puerto Rico, Mexico, Venezuela are all listed as A4). While Wikipedia also agrees that only the US and Canada officially don't use A4 but that in Mexico, Colombia, Chile and the Philippines Letter is also commonly used. Meanwhile at Microsoft the list of Letter nations is, the US, Canada, Argentina, Brazil, Chile, Mexico, Venezuela and "Latin American countries"

Summary

Mapping locales to page size is done inconsistently. In OOo we should at least have one place that does it, not two. And reconcile the locales that have Letter as an appropriate default. We should also agree that when taking a locale setting to use to look up a default paper size that we try LC_PAPER first, and then decide what we take as the next one.

paperconf's own default of using Letter as a final fallback sucks as most people use A4, ideally paperconf could be convinced to use an agreed mapping from the locale in the absence of a deliberate setting

Personal tools