Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: experimental/PdfViewer/pdfspec_autogen.py

Issue 17294008: load font manually, for now Type0 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « experimental/PdfViewer/pdf_viewer_main.cpp ('k') | experimental/PdfViewer/spec2def.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import datatypes 1 import datatypes
2 2
3 def buildPdfSpec(pdfspec): 3 def buildPdfSpec(pdfspec):
4 pdfspec.addClass('StreamCommonDictionary', 'Dictionary', 'Entries common to al l stream dictionaries')\ 4 pdfspec.addClass('StreamCommonDictionary', 'Dictionary', 'Entries common to al l stream dictionaries')\
5 .required('NULL')\ 5 .required('NULL')\
6 .field('Length')\ 6 .field('Length')\
7 .name('Length')\ 7 .name('Length')\
8 .type('integer')\ 8 .type('integer')\
9 .comment('(Required) The number of bytes from the beginning of the lin e fol-\nlowing the keyword stream to the last byte just before the keyword\nends tream. (There may be an additional EOL marker, preceding\nendstream, that is not included in the count and is not logically part\nof the stream data.) See "Stre am Extent," above, for further discus-\nsion.')\ 9 .comment('(Required) The number of bytes from the beginning of the lin e fol-\nlowing the keyword stream to the last byte just before the keyword\nends tream. (There may be an additional EOL marker, preceding\nendstream, that is not included in the count and is not logically part\nof the stream data.) See "Stre am Extent," above, for further discus-\nsion.')\
10 .done().done()\ 10 .done().done()\
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 .field('Type')\ 1452 .field('Type')\
1453 .name('Type')\ 1453 .name('Type')\
1454 .type('name')\ 1454 .type('name')\
1455 .comment('(Optional) The type of PDF object that this dictionary descr ibes; if\npresent, must be XObject for an image XObject.')\ 1455 .comment('(Optional) The type of PDF object that this dictionary descr ibes; if\npresent, must be XObject for an image XObject.')\
1456 .done().done()\ 1456 .done().done()\
1457 .required('NULL')\ 1457 .required('NULL')\
1458 .field('Subtype')\ 1458 .field('Subtype')\
1459 .name('Subtype')\ 1459 .name('Subtype')\
1460 .type('name')\ 1460 .type('name')\
1461 .comment('(Required) The type of XObject that this dictionary describe s; must be\nImage for an image XObject.')\ 1461 .comment('(Required) The type of XObject that this dictionary describe s; must be\nImage for an image XObject.')\
1462 .must(datatypes.PdfName('Image'))\ 1462 .must([datatypes.PdfName('Image')])\
1463 .done().done()\ 1463 .done().done()\
1464 .required('NULL')\ 1464 .required('NULL')\
1465 .field('Width')\ 1465 .field('Width')\
1466 .name('Width')\ 1466 .name('Width')\
1467 .type('integer')\ 1467 .type('integer')\
1468 .comment('(Required) The width of the image, in samples.')\ 1468 .comment('(Required) The width of the image, in samples.')\
1469 .done().done()\ 1469 .done().done()\
1470 .required('NULL')\ 1470 .required('NULL')\
1471 .field('Height')\ 1471 .field('Height')\
1472 .name('Height')\ 1472 .name('Height')\
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 .field('Type')\ 1579 .field('Type')\
1580 .name('Type')\ 1580 .name('Type')\
1581 .type('name')\ 1581 .type('name')\
1582 .comment('(Optional) The type of PDF object that this dictionary descr ibes; if present,\nmust be XObject for a form XObject.')\ 1582 .comment('(Optional) The type of PDF object that this dictionary descr ibes; if present,\nmust be XObject for a form XObject.')\
1583 .done().done()\ 1583 .done().done()\
1584 .required('NULL')\ 1584 .required('NULL')\
1585 .field('Subtype')\ 1585 .field('Subtype')\
1586 .name('Subtype')\ 1586 .name('Subtype')\
1587 .type('name')\ 1587 .type('name')\
1588 .comment('(Required) The type of XObject that this dictionary describe s; must be Form\nfor a form XObject.')\ 1588 .comment('(Required) The type of XObject that this dictionary describe s; must be Form\nfor a form XObject.')\
1589 .must(datatypes.PdfName('Form'))\ 1589 .must([datatypes.PdfName('Form')])\
1590 .done().done()\ 1590 .done().done()\
1591 .optional()\ 1591 .optional()\
1592 .field('FormType')\ 1592 .field('FormType')\
1593 .name('FormType')\ 1593 .name('FormType')\
1594 .type('integer')\ 1594 .type('integer')\
1595 .comment('(Optional) A code identifying the type of form XObject that this dictionary\ndescribes. The only valid value defined at the time of publicat ion is 1. Default\nvalue: 1.')\ 1595 .comment('(Optional) A code identifying the type of form XObject that this dictionary\ndescribes. The only valid value defined at the time of publicat ion is 1. Default\nvalue: 1.')\
1596 .done().done()\ 1596 .done().done()\
1597 .optional()\ 1597 .optional()\
1598 .field('Name')\ 1598 .field('Name')\
1599 .name('Name')\ 1599 .name('Name')\
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 .field('Type')\ 1730 .field('Type')\
1731 .name('Type')\ 1731 .name('Type')\
1732 .type('name')\ 1732 .type('name')\
1733 .comment('(Required) The type of PDF object that this dictionary descr ibes; must be\nFont for a font dictionary.')\ 1733 .comment('(Required) The type of PDF object that this dictionary descr ibes; must be\nFont for a font dictionary.')\
1734 .done().done()\ 1734 .done().done()\
1735 .required('NULL')\ 1735 .required('NULL')\
1736 .field('Subtype')\ 1736 .field('Subtype')\
1737 .name('Subtype')\ 1737 .name('Subtype')\
1738 .type('name')\ 1738 .type('name')\
1739 .comment('(Required) The type of font; must be Type1 for a Type 1 font .')\ 1739 .comment('(Required) The type of font; must be Type1 for a Type 1 font .')\
1740 .must([datatypes.PdfName('Type1')])\
1740 .done().done()\ 1741 .done().done()\
1741 .optional()\ 1742 .optional()\
1742 .field('Name')\ 1743 .field('Name')\
1743 .name('Name')\ 1744 .name('Name')\
1744 .type('name')\ 1745 .type('name')\
1745 .comment('(Required in PDF 1.0; optional otherwise) The name by which this font is ref-\nerenced in the Font subdictionary of the current resource dic tionary.\nNote: This entry is obsolescent and its use is no longer recommended. (See\nimplementation note 42 in Appendix H.)')\ 1746 .comment('(Required in PDF 1.0; optional otherwise) The name by which this font is ref-\nerenced in the Font subdictionary of the current resource dic tionary.\nNote: This entry is obsolescent and its use is no longer recommended. (See\nimplementation note 42 in Appendix H.)')\
1746 .done().done()\ 1747 .done().done()\
1747 .required('NULL')\ 1748 .required('NULL')\
1748 .field('BaseFont')\ 1749 .field('BaseFont')\
1749 .name('BaseFont')\ 1750 .name('BaseFont')\
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 .comment('(Optional) A specification of the font\'s character encoding , if different from\nits built-in encoding. The value of Encoding may be either the name of a pre-\ndefined encoding (MacRomanEncoding, MacExpertEncoding, or Wi nAnsi-\nEncoding, as described in Appendix D) or an encoding dictionary that\nsp ecifies differences from the font\'s built-in encoding or from a specified pre-\ ndefined encoding (see Section 5.5.5, "Character Encoding").')\ 1782 .comment('(Optional) A specification of the font\'s character encoding , if different from\nits built-in encoding. The value of Encoding may be either the name of a pre-\ndefined encoding (MacRomanEncoding, MacExpertEncoding, or Wi nAnsi-\nEncoding, as described in Appendix D) or an encoding dictionary that\nsp ecifies differences from the font\'s built-in encoding or from a specified pre-\ ndefined encoding (see Section 5.5.5, "Character Encoding").')\
1782 .done().done()\ 1783 .done().done()\
1783 .optional()\ 1784 .optional()\
1784 .field('ToUnicode')\ 1785 .field('ToUnicode')\
1785 .name('ToUnicode')\ 1786 .name('ToUnicode')\
1786 .type('stream')\ 1787 .type('stream')\
1787 .comment('(Optional; PDF 1.2) A stream containing a CMap file that map s character\ncodes to Unicode values (see Section 5.9, "ToUnicode CMaps").')\ 1788 .comment('(Optional; PDF 1.2) A stream containing a CMap file that map s character\ncodes to Unicode values (see Section 5.9, "ToUnicode CMaps").')\
1788 .done().done()\ 1789 .done().done()\
1789 .done() 1790 .done()
1790 1791
1791 pdfspec.addClass('Type3FontDictionary', 'FontDictionary', 'Entries in a Type 3 font dictionary')\ 1792 pdfspec.addClass('Type3FontDictionary', 'Type0FontDictionary', 'Entries in a T ype 3 font dictionary')\
1792 .required('NULL')\ 1793 .required('NULL')\
1793 .field('Type')\ 1794 .field('Type')\
1794 .name('Type')\ 1795 .name('Type')\
1795 .type('name')\ 1796 .type('name')\
1796 .comment('(Required) The type of PDF object that this dictionary descr ibes; must be\nFont for a font dictionary.')\ 1797 .comment('(Required) The type of PDF object that this dictionary descr ibes; must be\nFont for a font dictionary.')\
1797 .done().done()\ 1798 .done().done()\
1798 .required('NULL')\ 1799 .required('NULL')\
1799 .field('Subtype')\ 1800 .field('Subtype')\
1800 .name('Subtype')\ 1801 .name('Subtype')\
1801 .type('name')\ 1802 .type('name')\
1802 .comment('(Required) The type of font; must be Type3 for a Type 3 font .')\ 1803 .comment('(Required) The type of font; must be Type3 for a Type 3 font .')\
1804 .must([datatypes.PdfName('Type3')])\
1803 .done().done()\ 1805 .done().done()\
1804 .optional()\ 1806 .optional()\
1805 .field('Name')\ 1807 .field('Name')\
1806 .name('Name')\ 1808 .name('Name')\
1807 .type('name')\ 1809 .type('name')\
1808 .comment('(Required in PDF 1.0; optional otherwise) See Table 5.8 on p age 317.')\ 1810 .comment('(Required in PDF 1.0; optional otherwise) See Table 5.8 on p age 317.')\
1809 .done().done()\ 1811 .done().done()\
1810 .required('NULL')\ 1812 .required('NULL')\
1811 .field('FontBBox')\ 1813 .field('FontBBox')\
1812 .name('FontBBox')\ 1814 .name('FontBBox')\
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 .field('Type')\ 1870 .field('Type')\
1869 .name('Type')\ 1871 .name('Type')\
1870 .type('name')\ 1872 .type('name')\
1871 .comment('(Required) The type of PDF object that this dictionary descr ibes; must be\nFont for a CIDFont dictionary.')\ 1873 .comment('(Required) The type of PDF object that this dictionary descr ibes; must be\nFont for a CIDFont dictionary.')\
1872 .done().done()\ 1874 .done().done()\
1873 .required('NULL')\ 1875 .required('NULL')\
1874 .field('Subtype')\ 1876 .field('Subtype')\
1875 .name('Subtype')\ 1877 .name('Subtype')\
1876 .type('name')\ 1878 .type('name')\
1877 .comment('(Required) The type of CIDFont; CIDFontType0 or CIDFontType2 .')\ 1879 .comment('(Required) The type of CIDFont; CIDFontType0 or CIDFontType2 .')\
1880 .must([datatypes.PdfName('CIDFontType0'), datatypes.PdfName('CIDFontTy pe2')])\
1878 .done().done()\ 1881 .done().done()\
1879 .required('NULL')\ 1882 .required('NULL')\
1880 .field('BaseFont')\ 1883 .field('BaseFont')\
1881 .name('BaseFont')\ 1884 .name('BaseFont')\
1882 .type('name')\ 1885 .type('name')\
1883 .comment('(Required) The PostScript name of the CIDFont. For Type 0 CI DFonts, this\nis usually the value of the CIDFontName entry in the CIDFont progr am. For\nType 2 CIDFonts, it is derived the same way as for a simple TrueType fo nt;\nsee Section 5.5.2, "TrueType Fonts." In either case, the name can have a su b-\nset prefix if appropriate; see Section 5.5.3, "Font Subsets."')\ 1886 .comment('(Required) The PostScript name of the CIDFont. For Type 0 CI DFonts, this\nis usually the value of the CIDFontName entry in the CIDFont progr am. For\nType 2 CIDFonts, it is derived the same way as for a simple TrueType fo nt;\nsee Section 5.5.2, "TrueType Fonts." In either case, the name can have a su b-\nset prefix if appropriate; see Section 5.5.3, "Font Subsets."')\
1884 .done().done()\ 1887 .done().done()\
1885 .required('NULL')\ 1888 .required('NULL')\
1886 .field('CIDSystemInfo')\ 1889 .field('CIDSystemInfo')\
1887 .name('CIDSystemInfo')\ 1890 .name('CIDSystemInfo')\
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 .field('Type')\ 1967 .field('Type')\
1965 .name('Type')\ 1968 .name('Type')\
1966 .type('name')\ 1969 .type('name')\
1967 .comment('(Required) The type of PDF object that this dictionary descr ibes; must be\nFont for a font dictionary.')\ 1970 .comment('(Required) The type of PDF object that this dictionary descr ibes; must be\nFont for a font dictionary.')\
1968 .done().done()\ 1971 .done().done()\
1969 .required('NULL')\ 1972 .required('NULL')\
1970 .field('Subtype')\ 1973 .field('Subtype')\
1971 .name('Subtype')\ 1974 .name('Subtype')\
1972 .type('name')\ 1975 .type('name')\
1973 .comment('(Required) The type of font; must be Type0 for a Type 0 font .')\ 1976 .comment('(Required) The type of font; must be Type0 for a Type 0 font .')\
1977 .must([datatypes.PdfName('Type0')])\
1974 .done().done()\ 1978 .done().done()\
1975 .required('NULL')\ 1979 .required('NULL')\
1976 .field('BaseFont')\ 1980 .field('BaseFont')\
1977 .name('BaseFont')\ 1981 .name('BaseFont')\
1978 .type('name')\ 1982 .type('name')\
1979 .comment('(Required) The PostScript name of the font. In principle, th is is an arbitrary\nname, since there is no font program associated directly wit h a Type 0 font\ndictionary. The conventions described here ensure maximum compa tibility\nwith existing Acrobat products.\nIf the descendant is a Type 0 CIDFont , this name should be the concatenation\nof the CIDFont\'s BaseFont name, a hyph en, and the CMap name given in the\nEncoding entry (or the CMapName entry in the CMap program itself). If the\ndescendant is a Type 2 CIDFont, this name should be the same as the\nCIDFont\'s BaseFont name.')\ 1983 .comment('(Required) The PostScript name of the font. In principle, th is is an arbitrary\nname, since there is no font program associated directly wit h a Type 0 font\ndictionary. The conventions described here ensure maximum compa tibility\nwith existing Acrobat products.\nIf the descendant is a Type 0 CIDFont , this name should be the concatenation\nof the CIDFont\'s BaseFont name, a hyph en, and the CMap name given in the\nEncoding entry (or the CMapName entry in the CMap program itself). If the\ndescendant is a Type 2 CIDFont, this name should be the same as the\nCIDFont\'s BaseFont name.')\
1980 .done().done()\ 1984 .done().done()\
1981 .required('NULL')\ 1985 .required('NULL')\
1982 .field('Encoding')\ 1986 .field('Encoding')\
1983 .name('Encoding')\ 1987 .name('Encoding')\
(...skipping 3374 matching lines...) Expand 10 before | Expand all | Expand 10 after
5358 pdfspec.addClass('OpiVersionDictionary', 'Dictionary', 'Entry in an OPI versio n dictionary')\ 5362 pdfspec.addClass('OpiVersionDictionary', 'Dictionary', 'Entry in an OPI versio n dictionary')\
5359 .required('NULL')\ 5363 .required('NULL')\
5360 .field('version_number')\ 5364 .field('version_number')\
5361 .name('version_number')\ 5365 .name('version_number')\
5362 .type('dictionary')\ 5366 .type('dictionary')\
5363 .comment('(Required; PDF 1.2) An OPI dictionary specifying the attribu tes of this proxy\n(see Tables 9.50 and 9.51). The key for this entry must be th e name 1.3 or 2.0,\nidentifying the version of OPI to which the proxy correspond s.')\ 5367 .comment('(Required; PDF 1.2) An OPI dictionary specifying the attribu tes of this proxy\n(see Tables 9.50 and 9.51). The key for this entry must be th e name 1.3 or 2.0,\nidentifying the version of OPI to which the proxy correspond s.')\
5364 .done().done()\ 5368 .done().done()\
5365 .done() 5369 .done()
5366 5370
5367 5371
OLDNEW
« no previous file with comments | « experimental/PdfViewer/pdf_viewer_main.cpp ('k') | experimental/PdfViewer/spec2def.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698