Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
71 / 71 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| FontTable | |
100.00% |
71 / 71 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| write | |
100.00% |
71 / 71 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is part of PHPWord - A pure PHP library for reading and writing |
| 5 | * word processing documents. |
| 6 | * |
| 7 | * PHPWord is free software distributed under the terms of the GNU Lesser |
| 8 | * General Public License version 3 as published by the Free Software Foundation. |
| 9 | * |
| 10 | * For the full copyright and license information, please read the LICENSE |
| 11 | * file that was distributed with this source code. For the full list of |
| 12 | * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. |
| 13 | * |
| 14 | * @see https://github.com/PHPOffice/PHPWord |
| 15 | * |
| 16 | * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 |
| 17 | */ |
| 18 | |
| 19 | namespace PhpOffice\PhpWord\Writer\Word2007\Part; |
| 20 | |
| 21 | /** |
| 22 | * Word2007 font table writer: word/fontTable.xml. |
| 23 | * |
| 24 | * @todo Generate content dynamically |
| 25 | * |
| 26 | * @since 0.10.0 |
| 27 | */ |
| 28 | class FontTable extends AbstractPart |
| 29 | { |
| 30 | /** |
| 31 | * Write fontTable.xml. |
| 32 | * |
| 33 | * @return string |
| 34 | */ |
| 35 | public function write() |
| 36 | { |
| 37 | $str = ''; |
| 38 | $str .= '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'; |
| 39 | $str .= '<w:fonts ' . |
| 40 | 'xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" ' . |
| 41 | 'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">'; |
| 42 | |
| 43 | $str .= '<w:font w:name="Times New Roman">'; |
| 44 | $str .= '<w:panose1 w:val="02020603050405020304" />'; |
| 45 | $str .= '<w:charset w:val="00" />'; |
| 46 | $str .= '<w:family w:val="roman" />'; |
| 47 | $str .= '<w:pitch w:val="variable" />'; |
| 48 | $str .= '<w:sig w:usb0="E0002AFF" w:usb1="C0007841" w:usb2="00000009" w:usb3="00000000" ' . |
| 49 | 'w:csb0="000001FF" w:csb1="00000000" />'; |
| 50 | $str .= '</w:font>'; |
| 51 | |
| 52 | $str .= '<w:font w:name="Courier New">'; |
| 53 | $str .= '<w:panose1 w:val="02070309020205020404" />'; |
| 54 | $str .= '<w:charset w:val="00" />'; |
| 55 | $str .= '<w:family w:val="modern" />'; |
| 56 | $str .= '<w:pitch w:val="fixed" />'; |
| 57 | $str .= '<w:sig w:usb0="E0002AFF" w:usb1="C0007843" w:usb2="00000009" w:usb3="00000000" ' . |
| 58 | 'w:csb0="000001FF" w:csb1="00000000" />'; |
| 59 | $str .= '</w:font>'; |
| 60 | |
| 61 | $str .= '<w:font w:name="Wingdings">'; |
| 62 | $str .= '<w:panose1 w:val="05000000000000000000" />'; |
| 63 | $str .= '<w:charset w:val="02" />'; |
| 64 | $str .= '<w:family w:val="auto" />'; |
| 65 | $str .= '<w:pitch w:val="variable" />'; |
| 66 | $str .= '<w:sig w:usb0="00000000" w:usb1="10000000" w:usb2="00000000" w:usb3="00000000" ' . |
| 67 | 'w:csb0="80000000" w:csb1="00000000" />'; |
| 68 | $str .= '</w:font>'; |
| 69 | |
| 70 | $str .= '<w:font w:name="Symbol">'; |
| 71 | $str .= '<w:panose1 w:val="05050102010706020507" />'; |
| 72 | $str .= '<w:charset w:val="02" />'; |
| 73 | $str .= '<w:family w:val="roman" />'; |
| 74 | $str .= '<w:pitch w:val="variable" />'; |
| 75 | $str .= '<w:sig w:usb0="00000000" w:usb1="10000000" w:usb2="00000000" w:usb3="00000000" ' . |
| 76 | 'w:csb0="80000000" w:csb1="00000000" />'; |
| 77 | $str .= '</w:font>'; |
| 78 | |
| 79 | $str .= '<w:font w:name="Arial">'; |
| 80 | $str .= '<w:panose1 w:val="020B0604020202020204" />'; |
| 81 | $str .= '<w:charset w:val="00" />'; |
| 82 | $str .= '<w:family w:val="swiss" />'; |
| 83 | $str .= '<w:pitch w:val="variable" />'; |
| 84 | $str .= '<w:sig w:usb0="E0002AFF" w:usb1="C0007843" w:usb2="00000009" w:usb3="00000000" ' . |
| 85 | 'w:csb0="000001FF" w:csb1="00000000" />'; |
| 86 | $str .= '</w:font>'; |
| 87 | |
| 88 | $str .= '<w:font w:name="Cambria">'; |
| 89 | $str .= '<w:panose1 w:val="02040503050406030204" />'; |
| 90 | $str .= '<w:charset w:val="00" />'; |
| 91 | $str .= '<w:family w:val="roman" />'; |
| 92 | $str .= '<w:pitch w:val="variable" />'; |
| 93 | $str .= '<w:sig w:usb0="A00002EF" w:usb1="4000004B" w:usb2="00000000" w:usb3="00000000" ' . |
| 94 | 'w:csb0="0000019F" w:csb1="00000000" />'; |
| 95 | $str .= '</w:font>'; |
| 96 | |
| 97 | $str .= '<w:font w:name="Calibri">'; |
| 98 | $str .= '<w:panose1 w:val="020F0502020204030204" />'; |
| 99 | $str .= '<w:charset w:val="00" />'; |
| 100 | $str .= '<w:family w:val="swiss" />'; |
| 101 | $str .= '<w:pitch w:val="variable" />'; |
| 102 | $str .= '<w:sig w:usb0="E10002FF" w:usb1="4000ACFF" w:usb2="00000009" w:usb3="00000000" ' . |
| 103 | 'w:csb0="0000019F" w:csb1="00000000" />'; |
| 104 | $str .= '</w:font>'; |
| 105 | |
| 106 | $str .= '<w:font w:name="Garamond">'; |
| 107 | $str .= '<w:panose1 w:val="02020404030301010803" />'; |
| 108 | $str .= '<w:charset w:val="00" />'; |
| 109 | $str .= '<w:family w:val="roman" />'; |
| 110 | $str .= '<w:pitch w:val="variable" />'; |
| 111 | $str .= '<w:sig w:usb0="00000287" w:usb1="00000002" w:usb2="00000000" w:usb3="00000000" ' . |
| 112 | 'w:csb0="0000009F" w:csb1="00000000" />'; |
| 113 | $str .= '</w:font>'; |
| 114 | |
| 115 | $str .= '</w:fonts>'; |
| 116 | |
| 117 | return $str; |
| 118 | } |
| 119 | } |