| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<office:document xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" office:mimetype="application/vnd.oasis.opendocument.text" office:version="1.1"> |
| 3 |
<office:meta> |
| 4 |
<dc:creator> </dc:creator> |
| 5 |
<dc:date>2001-08-25T17:30:52.00</dc:date> |
| 6 |
<meta:creation-date>2001-08-25T17:05:16.00</meta:creation-date> |
| 7 |
<meta:print-date>2001-08-25T17:29:24.00</meta:print-date> |
| 8 |
<meta:generator>libodfgen/0.1.6</meta:generator> |
| 9 |
</office:meta> |
| 10 |
<office:font-face-decls> |
| 11 |
<style:font-face style:name="Times" svg:font-family="Times"/> |
| 12 |
<style:font-face style:name="starbats" svg:font-family="starbats"/> |
| 13 |
<style:font-face style:font-charset="x-symbol" style:name="StarSymbol" svg:font-family="StarSymbol"/> |
| 14 |
</office:font-face-decls> |
| 15 |
<office:styles> |
| 16 |
<style:default-style style:family="graphic"/> |
| 17 |
<style:default-style style:family="paragraph"> |
| 18 |
<style:paragraph-properties style:line-break="strict" style:punctuation-wrap="hanging" style:tab-stop-distance="0.5in" style:text-autospace="ideograph-alpha" style:use-window-font-color="true" style:writing-mode="page"/> |
| 19 |
</style:default-style> |
| 20 |
<style:default-style style:family="table"/> |
| 21 |
<style:default-style style:family="table-row"> |
| 22 |
<style:table-row-properties fo:keep-together="auto"/> |
| 23 |
</style:default-style> |
| 24 |
<style:default-style style:family="table-column"/> |
| 25 |
<style:default-style style:family="table-cell"/> |
| 26 |
<style:style style:class="text" style:family="paragraph" style:name="Standard"/> |
| 27 |
<style:style style:class="text" style:display-name="Text Body" style:family="paragraph" style:name="Text_Body" style:parent-style-name="Standard"/> |
| 28 |
<style:style style:class="extra" style:display-name="Table Contents" style:family="paragraph" style:name="Table_Contents" style:parent-style-name="Text_Body"/> |
| 29 |
<style:style style:class="extra" style:display-name="Table Heading" style:family="paragraph" style:name="Table_Heading" style:parent-style-name="Table_Contents"/> |
| 30 |
<style:style style:class="list" style:display-name="List" style:family="paragraph" style:name="List" style:parent-style-name="Text_Body"/> |
| 31 |
<style:style style:class="extra" style:display-name="Header" style:family="paragraph" style:name="Header" style:parent-style-name="Standard"/> |
| 32 |
<style:style style:class="extra" style:display-name="Footer" style:family="paragraph" style:name="Footer" style:parent-style-name="Standard"/> |
| 33 |
<style:style style:class="extra" style:display-name="Caption" style:family="paragraph" style:name="Caption" style:parent-style-name="Standard"/> |
| 34 |
<style:style style:class="extra" style:display-name="Footnote" style:family="paragraph" style:name="Footnote" style:parent-style-name="Standard"/> |
| 35 |
<style:style style:class="extra" style:display-name="Endnote" style:family="paragraph" style:name="Endnote" style:parent-style-name="Standard"/> |
| 36 |
<style:style style:class="extra" style:display-name="Index" style:family="paragraph" style:name="Index" style:parent-style-name="Standard"/> |
| 37 |
<style:style style:display-name="Footnote_Symbol" style:family="text" style:name="Footnote_Symbol"> |
| 38 |
<style:text-properties style:text-position="super 58%"/> |
| 39 |
</style:style> |
| 40 |
<style:style style:display-name="Endnote_Symbol" style:family="text" style:name="Endnote_Symbol"> |
| 41 |
<style:text-properties style:text-position="super 58%"/> |
| 42 |
</style:style> |
| 43 |
<style:style style:display-name="Footnote_anchor" style:family="text" style:name="Footnote_anchor"> |
| 44 |
<style:text-properties style:text-position="super 58%"/> |
| 45 |
</style:style> |
| 46 |
<style:style style:display-name="Endnote_anchor" style:family="text" style:name="Endnote_anchor"> |
| 47 |
<style:text-properties style:text-position="super 58%"/> |
| 48 |
</style:style> |
| 49 |
<text:linenumbering-configuration style:num-format="1" text:increment="5" text:number-lines="false" text:number-position="left" text:offset="0.1965in"/> |
| 50 |
<text:notes-configuration style:num-format="1" text:citation-body-style-name="Footnote_anchor" text:citation-style-name="Footnote_Symbol" text:footnotes-position="page" text:note-class="footnote" text:start-numbering-at="document" text:start-value="0"/> |
| 51 |
<text:notes-configuration style:num-format="i" text:citation-body-style-name="Endnote_anchor" text:citation-style-name="Endnote_Symbol" text:master-page-name="Endnote" text:note-class="endnote" text:start-value="0"/> |
| 52 |
</office:styles> |
| 53 |
<office:automatic-styles> |
| 54 |
<style:page-layout style:name="PL0"> |
| 55 |
<style:page-layout-properties fo:margin-bottom="1.0000in" fo:margin-left="1.0000in" fo:margin-right="1.0000in" fo:margin-top="1.0000in" fo:page-height="11.0000in" fo:page-width="8.5000in" style:footnote-max-height="0.0000in" style:print-orientation="portrait" style:writing-mode="lr-tb"> |
| 56 |
<style:footnote-sep style:adjustment="left" style:color="#000000" style:distance-after-sep="0.0398in" style:distance-before-sep="0.0398in" style:rel-width="25.0000%" style:width="0.0071in"/> |
| 57 |
</style:page-layout-properties> |
| 58 |
</style:page-layout> |
| 59 |
<style:page-layout style:name="PL1"> |
| 60 |
<style:page-layout-properties fo:margin-bottom="1.0000in" fo:margin-left="1.0000in" fo:margin-right="1.0000in" fo:margin-top="1.0000in" fo:page-height="11.0000in" fo:page-width="8.5000in" style:footnote-max-height="0.0000in" style:print-orientation="portrait" style:writing-mode="lr-tb"> |
| 61 |
<style:footnote-sep style:adjustment="left" style:color="#000000" style:rel-width="25.0000%"/> |
| 62 |
</style:page-layout-properties> |
| 63 |
</style:page-layout> |
| 64 |
<style:page-layout style:name="PL2"> |
| 65 |
<style:page-layout-properties fo:margin-bottom="72.0000pt" fo:margin-left="72.0000pt" fo:margin-right="72.0000pt" fo:margin-top="72.0000pt" fo:page-height="792.0000pt" fo:page-width="612.0000pt" style:footnote-max-height="0.0000in" style:print-orientation="portrait" style:writing-mode="lr-tb"> |
| 66 |
<style:footnote-sep style:adjustment="left" style:color="#000000" style:distance-after-sep="0.0398in" style:distance-before-sep="0.0398in" style:rel-width="25.0000%" style:width="0.0071in"/> |
| 67 |
</style:page-layout-properties> |
| 68 |
</style:page-layout> |
| 69 |
<style:style style:family="text" style:name="Span0"> |
| 70 |
<style:text-properties fo:font-size="14.0000pt" fo:font-weight="bold" style:font-name="Times" style:font-name-asian="Times" style:font-name-complex="Times" style:font-pitch="variable" style:font-size-asian="14.0000pt" style:font-size-complex="14.0000pt" style:font-weight-asian="bold" style:font-weight-complex="bold"/> |
| 71 |
</style:style> |
| 72 |
<style:style style:family="text" style:name="Span1"> |
| 73 |
<style:text-properties fo:font-size="10.0000pt" style:font-name="Times" style:font-name-asian="Times" style:font-name-complex="Times" style:font-size-asian="10.0000pt" style:font-size-complex="10.0000pt"/> |
| 74 |
</style:style> |
| 75 |
<style:style style:family="text" style:name="Span2"> |
| 76 |
<style:text-properties fo:font-size="10.0000pt" fo:font-weight="normal" style:font-name="Times" style:font-name-asian="Times" style:font-name-complex="Times" style:font-size-asian="10.0000pt" style:font-size-complex="10.0000pt" style:font-weight-asian="normal" style:font-weight-complex="normal"/> |
| 77 |
</style:style> |
| 78 |
<style:style style:family="text" style:name="Span3"> |
| 79 |
<style:text-properties fo:font-size="10.0000pt" fo:font-weight="bold" style:font-name="Times" style:font-name-asian="Times" style:font-name-complex="Times" style:font-size-asian="10.0000pt" style:font-size-complex="10.0000pt" style:font-weight-asian="bold" style:font-weight-complex="bold"/> |
| 80 |
</style:style> |
| 81 |
<style:style style:family="paragraph" style:master-page-name="PM2" style:name="S0" style:parent-style-name="Standard"> |
| 82 |
<style:paragraph-properties fo:margin-left="0.0000pt" fo:margin-right="0.0000pt" fo:text-indent="0.0000pt" style:auto-text-indent="false" style:justify-single-word="false"/> |
| 83 |
</style:style> |
| 84 |
<style:style style:family="paragraph" style:name="S1" style:parent-style-name="Standard"> |
| 85 |
<style:paragraph-properties fo:margin-left="0.0000pt" fo:margin-right="0.0000pt" fo:text-indent="0.0000pt" style:auto-text-indent="false" style:justify-single-word="false"/> |
| 86 |
</style:style> |
| 87 |
<style:style style:family="paragraph" style:name="S2" style:parent-style-name="Standard"> |
| 88 |
<style:paragraph-properties fo:break-before="page" fo:margin-left="0.0000pt" fo:margin-right="0.0000pt" fo:text-indent="0.0000pt" style:auto-text-indent="false" style:justify-single-word="false"/> |
| 89 |
</style:style> |
| 90 |
<style:style style:family="paragraph" style:name="S3" style:parent-style-name="Standard"> |
| 91 |
<style:paragraph-properties fo:margin-left="14.1500pt" fo:margin-right="0.0000pt" fo:text-indent="-14.1500pt" style:auto-text-indent="false" style:justify-single-word="false"/> |
| 92 |
</style:style> |
| 93 |
<text:list-style style:name="UL0"> |
| 94 |
<text:list-level-style-bullet text:bullet-char="" text:level="1" text:style-name="Bullet_Symbols"> |
| 95 |
<style:list-level-properties fo:text-align="left" style:font-name="starbats"/> |
| 96 |
<style:text-properties/> |
| 97 |
</text:list-level-style-bullet> |
| 98 |
</text:list-style> |
| 99 |
</office:automatic-styles> |
| 100 |
<office:master-styles> |
| 101 |
<style:master-page style:display-name="Standard" style:name="PM0" style:page-layout-name="PL0"/> |
| 102 |
<style:master-page style:display-name="EndNote" style:name="PM1" style:page-layout-name="PL1"/> |
| 103 |
<style:master-page style:name="PM2" style:page-layout-name="PL2"/> |
| 104 |
</office:master-styles> |
| 105 |
<office:body> |
| 106 |
<office:text> |
| 107 |
<text:p text:style-name="S0"> |
| 108 |
<text:span text:style-name="Span0">GNOME Print Perl script</text:span> |
| 109 |
</text:p> |
| 110 |
<text:p text:style-name="S1"> |
| 111 |
<text:span text:style-name="Span1"/> |
| 112 |
</text:p> |
| 113 |
<text:p text:style-name="S1"> |
| 114 |
<text:span text:style-name="Span1">#!/usr/bin/perl -w</text:span> |
| 115 |
</text:p> |
| 116 |
<text:p text:style-name="S1"> |
| 117 |
<text:span text:style-name="Span1"/> |
| 118 |
</text:p> |
| 119 |
<text:p text:style-name="S1"> |
| 120 |
<text:span text:style-name="Span1">#TITLE: Gnome Print sample</text:span> |
| 121 |
</text:p> |
| 122 |
<text:p text:style-name="S1"> |
| 123 |
<text:span text:style-name="Span1">#REQUIRES: Gtk Gnome GnomePrint</text:span> |
| 124 |
</text:p> |
| 125 |
<text:p text:style-name="S1"> |
| 126 |
<text:span text:style-name="Span1"/> |
| 127 |
</text:p> |
| 128 |
<text:p text:style-name="S1"> |
| 129 |
<text:span text:style-name="Span1">use Gnome::Print;</text:span> |
| 130 |
</text:p> |
| 131 |
<text:p text:style-name="S1"> |
| 132 |
<text:span text:style-name="Span1"/> |
| 133 |
</text:p> |
| 134 |
<text:p text:style-name="S1"> |
| 135 |
<text:span text:style-name="Span1">init Gnome $0, '0.1';</text:span> |
| 136 |
</text:p> |
| 137 |
<text:p text:style-name="S1"> |
| 138 |
<text:span text:style-name="Span1">Gtk::Widget->set_default_colormap(Gtk::Gdk::Rgb->get_cmap());</text:span> |
| 139 |
</text:p> |
| 140 |
<text:p text:style-name="S1"> |
| 141 |
<text:span text:style-name="Span1">Gtk::Widget->set_default_visual(Gtk::Gdk::Rgb->get_visual());</text:span> |
| 142 |
</text:p> |
| 143 |
<text:p text:style-name="S1"> |
| 144 |
<text:span text:style-name="Span1"/> |
| 145 |
</text:p> |
| 146 |
<text:p text:style-name="S1"> |
| 147 |
<text:span text:style-name="Span1">$file = shift || "duck.jpeg";</text:span> |
| 148 |
</text:p> |
| 149 |
<text:p text:style-name="S1"> |
| 150 |
<text:span text:style-name="Span1">$pixbuf = Gtk::Gdk::Pixbuf->new_from_file($file);</text:span> |
| 151 |
</text:p> |
| 152 |
<text:p text:style-name="S1"> |
| 153 |
<text:span text:style-name="Span1">@slanted = (0.9, 0.1, -0.8, 0.9, 0, 0);</text:span> |
| 154 |
</text:p> |
| 155 |
<text:p text:style-name="S1"> |
| 156 |
<text:span text:style-name="Span1"/> |
| 157 |
</text:p> |
| 158 |
<text:p text:style-name="S1"> |
| 159 |
<text:span text:style-name="Span1">$print_master = new Gnome::PrintMaster;</text:span> |
| 160 |
</text:p> |
| 161 |
<text:p text:style-name="S1"> |
| 162 |
<text:span text:style-name="Span1">$context = $print_master->get_context;</text:span> |
| 163 |
</text:p> |
| 164 |
<text:p text:style-name="S1"> |
| 165 |
<text:span text:style-name="Span1"/> |
| 166 |
</text:p> |
| 167 |
<text:p text:style-name="S1"> |
| 168 |
<text:span text:style-name="Span1">$context->beginpage("APageName");</text:span> |
| 169 |
</text:p> |
| 170 |
<text:p text:style-name="S1"> |
| 171 |
<text:span text:style-name="Span1"/> |
| 172 |
</text:p> |
| 173 |
<text:p text:style-name="S1"> |
| 174 |
<text:span text:style-name="Span1"># test gray and rgb images</text:span> |
| 175 |
</text:p> |
| 176 |
<text:p text:style-name="S1"> |
| 177 |
<text:span text:style-name="Span1">$width <text:s/>= 256;</text:span> |
| 178 |
</text:p> |
| 179 |
<text:p text:style-name="S1"> |
| 180 |
<text:span text:style-name="Span1">$height = 120;</text:span> |
| 181 |
</text:p> |
| 182 |
<text:p text:style-name="S1"> |
| 183 |
<text:span text:style-name="Span1"/> |
| 184 |
</text:p> |
| 185 |
<text:p text:style-name="S1"> |
| 186 |
<text:span text:style-name="Span1">$image = pack("C*", 0..$width-1) x $height;</text:span> |
| 187 |
</text:p> |
| 188 |
<text:p text:style-name="S1"> |
| 189 |
<text:span text:style-name="Span1">$context->gsave;</text:span> |
| 190 |
</text:p> |
| 191 |
<text:p text:style-name="S1"> |
| 192 |
<text:span text:style-name="Span1">$context->concat($width, 0, 0, -$height, 250, 200);</text:span> |
| 193 |
</text:p> |
| 194 |
<text:p text:style-name="S1"> |
| 195 |
<text:span text:style-name="Span1">$context->grayimage($image, $width, $height);</text:span> |
| 196 |
</text:p> |
| 197 |
<text:p text:style-name="S1"> |
| 198 |
<text:span text:style-name="Span1">$context->grestore;</text:span> |
| 199 |
</text:p> |
| 200 |
<text:p text:style-name="S1"> |
| 201 |
<text:span text:style-name="Span1"/> |
| 202 |
</text:p> |
| 203 |
<text:p text:style-name="S1"> |
| 204 |
<text:span text:style-name="Span1"># whack an pretty image up</text:span> |
| 205 |
</text:p> |
| 206 |
<text:p text:style-name="S1"> |
| 207 |
<text:span text:style-name="Span1">$context->moveto(250, 350);</text:span> |
| 208 |
</text:p> |
| 209 |
<text:p text:style-name="S1"> |
| 210 |
<text:span text:style-name="Span1">$context->gsave;</text:span> |
| 211 |
</text:p> |
| 212 |
<text:p text:style-name="S1"> |
| 213 |
<text:span text:style-name="Span1">$context->concat(100, 0, 0, 100, 350, 440);</text:span> |
| 214 |
</text:p> |
| 215 |
<text:p text:style-name="S1"> |
| 216 |
<text:span text:style-name="Span1">$context->pixbuf($pixbuf);</text:span> |
| 217 |
</text:p> |
| 218 |
<text:p text:style-name="S1"> |
| 219 |
<text:span text:style-name="Span1">$context->grestore;</text:span> |
| 220 |
</text:p> |
| 221 |
<text:p text:style-name="S1"> |
| 222 |
<text:span text:style-name="Span1"/> |
| 223 |
</text:p> |
| 224 |
<text:p text:style-name="S1"> |
| 225 |
<text:span text:style-name="Span1"># a line</text:span> |
| 226 |
</text:p> |
| 227 |
<text:p text:style-name="S1"> |
| 228 |
<text:span text:style-name="Span1">$context->moveto(100, 100);</text:span> |
| 229 |
</text:p> |
| 230 |
<text:p text:style-name="S1"> |
| 231 |
<text:span text:style-name="Span1">$context->lineto(200, 200);</text:span> |
| 232 |
</text:p> |
| 233 |
<text:p text:style-name="S1"> |
| 234 |
<text:span text:style-name="Span1">$context->stroke;</text:span> |
| 235 |
</text:p> |
| 236 |
<text:p text:style-name="S1"> |
| 237 |
<text:span text:style-name="Span1"/> |
| 238 |
</text:p> |
| 239 |
<text:p text:style-name="S1"> |
| 240 |
<text:span text:style-name="Span1"># Text on a slant</text:span> |
| 241 |
</text:p> |
| 242 |
<text:p text:style-name="S1"> |
| 243 |
<text:span text:style-name="Span1">$context->setfont(Gnome::Font->new_closest("Times", 'bold', 1, 20));</text:span> |
| 244 |
</text:p> |
| 245 |
<text:p text:style-name="S1"> |
| 246 |
<text:span text:style-name="Span1">$context->gsave();</text:span> |
| 247 |
</text:p> |
| 248 |
<text:p text:style-name="S1"> |
| 249 |
<text:span text:style-name="Span1">$context->moveto(150, 400);</text:span> |
| 250 |
</text:p> |
| 251 |
<text:p text:style-name="S1"> |
| 252 |
<text:span text:style-name="Span1">$context->concat(@slanted);</text:span> |
| 253 |
</text:p> |
| 254 |
<text:p text:style-name="S1"> |
| 255 |
<text:span text:style-name="Span1">$context->show("Slanted text, Times, bold 20");</text:span> |
| 256 |
</text:p> |
| 257 |
<text:p text:style-name="S1"> |
| 258 |
<text:span text:style-name="Span1">$context->grestore();</text:span> |
| 259 |
</text:p> |
| 260 |
<text:p text:style-name="S1"> |
| 261 |
<text:span text:style-name="Span1"/> |
| 262 |
</text:p> |
| 263 |
<text:p text:style-name="S1"> |
| 264 |
<text:span text:style-name="Span1"># A rotated string thing</text:span> |
| 265 |
</text:p> |
| 266 |
<text:p text:style-name="S1"> |
| 267 |
<text:span text:style-name="Span1">$context->moveto(250, 600);</text:span> |
| 268 |
</text:p> |
| 269 |
<text:p text:style-name="S1"> |
| 270 |
<text:span text:style-name="Span1">$context->setrgbcolor(1,0.1,0);</text:span> |
| 271 |
</text:p> |
| 272 |
<text:p text:style-name="S1"> |
| 273 |
<text:span text:style-name="Span1">foreach (map {$_*30} 0 .. 6) {</text:span> |
| 274 |
</text:p> |
| 275 |
<text:p text:style-name="S1"> |
| 276 |
<text:span text:style-name="Span1"><text:tab/>$context->gsave();</text:span> |
| 277 |
</text:p> |
| 278 |
<text:p text:style-name="S1"> |
| 279 |
<text:span text:style-name="Span1"><text:tab/>$context->concat(Gnome::Print->affine_rotate($_));</text:span> |
| 280 |
</text:p> |
| 281 |
<text:p text:style-name="S1"> |
| 282 |
<text:span text:style-name="Span1"><text:tab/>$context->show(" LWE August 2001 ...");</text:span> |
| 283 |
</text:p> |
| 284 |
<text:p text:style-name="S1"> |
| 285 |
<text:span text:style-name="Span1"><text:tab/>$context->grestore();</text:span> |
| 286 |
</text:p> |
| 287 |
<text:p text:style-name="S1"> |
| 288 |
<text:span text:style-name="Span1">}</text:span> |
| 289 |
</text:p> |
| 290 |
<text:p text:style-name="S1"> |
| 291 |
<text:span text:style-name="Span1">$context->showpage;</text:span> |
| 292 |
</text:p> |
| 293 |
<text:p text:style-name="S1"> |
| 294 |
<text:span text:style-name="Span1"/> |
| 295 |
</text:p> |
| 296 |
<text:p text:style-name="S1"> |
| 297 |
<text:span text:style-name="Span1">$print_master->close;</text:span> |
| 298 |
</text:p> |
| 299 |
<text:p text:style-name="S1"> |
| 300 |
<text:span text:style-name="Span1"/> |
| 301 |
</text:p> |
| 302 |
<text:p text:style-name="S1"> |
| 303 |
<text:span text:style-name="Span1"># Show the preview ...</text:span> |
| 304 |
</text:p> |
| 305 |
<text:p text:style-name="S1"> |
| 306 |
<text:span text:style-name="Span1">$preview = new Gnome::PrintMasterPreview ($print_master, 'Gnome::Print from perl');</text:span> |
| 307 |
</text:p> |
| 308 |
<text:p text:style-name="S1"> |
| 309 |
<text:span text:style-name="Span1">$preview->signal_connect('destroy', sub {Gtk->main_quit;});</text:span> |
| 310 |
</text:p> |
| 311 |
<text:p text:style-name="S1"> |
| 312 |
<text:span text:style-name="Span1">$preview->show;</text:span> |
| 313 |
</text:p> |
| 314 |
<text:p text:style-name="S1"> |
| 315 |
<text:span text:style-name="Span1"/> |
| 316 |
</text:p> |
| 317 |
<text:p text:style-name="S1"> |
| 318 |
<text:span text:style-name="Span1">main Gtk;</text:span> |
| 319 |
</text:p> |
| 320 |
<text:p text:style-name="S2"> |
| 321 |
<text:span text:style-name="Span1">UTF-8(7) <text:s/><text:s/><text:s/><text:s/><text:s/><text:s/><text:s/><text:s/><text:s/><text:s/><text:s/>Linux Programmer's Manual <text:s/><text:s/><text:s/><text:s/><text:s/><text:s/><text:s/><text:s/><text:s/><text:s/><text:s/>UTF-8(7)</text:span> |
| 322 |
</text:p> |
| 323 |
<text:p text:style-name="S1"> |
| 324 |
<text:span text:style-name="Span1"/> |
| 325 |
</text:p> |
| 326 |
<text:p text:style-name="S1"> |
| 327 |
<text:span text:style-name="Span2">NAME</text:span> |
| 328 |
</text:p> |
| 329 |
<text:p text:style-name="S1"> |
| 330 |
<text:span text:style-name="Span3">UTF-8</text:span> |
| 331 |
<text:span text:style-name="Span1"> - an ASCII compatible multibyte Unicode encoding</text:span> |
| 332 |
</text:p> |
| 333 |
<text:p text:style-name="S1"> |
| 334 |
<text:span text:style-name="Span1"/> |
| 335 |
</text:p> |
| 336 |
<text:p text:style-name="S1"> |
| 337 |
<text:span text:style-name="Span1">DESCRIPTION</text:span> |
| 338 |
</text:p> |
| 339 |
<text:p text:style-name="S1"> |
| 340 |
<text:span text:style-name="Span1"/> |
| 341 |
</text:p> |
| 342 |
<text:p text:style-name="S1"> |
| 343 |
<text:span text:style-name="Span1"><text:tab/>The <text:s/>Unicode <text:s/>character <text:s/>set occupies a 16-bit code space.The most obvious Unicode encoding (known <text:s/>as <text:s/>UCS-2) <text:s/>con-sists of a sequence of 16-bit words. Such strings can con-tain as parts of many 16-bit characters bytes like '\0' or'/' <text:s/>which have a special meaning in filenames and other Clibrary function parameters. <text:s/>In addition, the majority of UNIX tools expects ASCII files and can't read 16-bit words as characters without major modifications. For these <text:s/>reasons, UCS-2 is not a suitable external encoding of Unicode</text:span> |
| 344 |
</text:p> |
| 345 |
<text:p text:style-name="S1"> |
| 346 |
<text:span text:style-name="Span1">in filenames, text files, environment variables, etc. <text:s/>The ISO <text:s/>10646 <text:s/>Universal <text:s/>Character <text:s/>Set (UCS), a superset of Unicode, occupies even a 31-bit code space and the obvious UCS-4 <text:s/>encoding <text:s/><text:s/>for <text:s/>it (a sequence of 32-bit words) has the same problems.</text:span> |
| 347 |
</text:p> |
| 348 |
<text:p text:style-name="S1"> |
| 349 |
<text:span text:style-name="Span1"/> |
| 350 |
</text:p> |
| 351 |
<text:p text:style-name="S1"> |
| 352 |
<text:span text:style-name="Span1"><text:tab/>The UTF-8 encoding of Unicode and UCS does not have <text:s/>these problems <text:s/>and is the way to go for using the Unicode char-acter set under Unix-style operating systems.</text:span> |
| 353 |
</text:p> |
| 354 |
<text:p text:style-name="S1"> |
| 355 |
<text:span text:style-name="Span1"/> |
| 356 |
</text:p> |
| 357 |
<text:p text:style-name="S1"> |
| 358 |
<text:span text:style-name="Span1">PROPERTIES</text:span> |
| 359 |
</text:p> |
| 360 |
<text:p text:style-name="S1"> |
| 361 |
<text:span text:style-name="Span1">The UTF-8 encoding has the following nice properties:</text:span> |
| 362 |
</text:p> |
| 363 |
<text:p text:style-name="S1"> |
| 364 |
<text:span text:style-name="Span1"/> |
| 365 |
</text:p> |
| 366 |
<text:list text:style-name="UL0"> |
| 367 |
<text:list-item> |
| 368 |
<text:p text:style-name="S3"> |
| 369 |
<text:span text:style-name="Span1"> UCS characters 0x00000000 to 0x0000007f <text:s/>(the <text:s/>classical <text:s/>US-ASCII characters) are encoded simply as bytes 0x00 to <text:s/>0x7f (ASCII compatibility). This means <text:s/>that <text:s/>files <text:s/>and <text:s/>strings <text:s/>which <text:s/>contain only 7-bit ASCII characters have <text:s/>the same encoding under both ASCII and UTF-8.</text:span> |
| 370 |
</text:p> |
| 371 |
</text:list-item> |
| 372 |
<text:list-item> |
| 373 |
<text:p text:style-name="S3"> |
| 374 |
<text:span text:style-name="Span1">All UCS characters > 0x7f are <text:s/>encoded <text:s/>as <text:s/>a <text:s/>multibyte <text:s/>sequence <text:s/>consisting <text:s/>only of bytes in the range 0x80 to <text:s/>0xfd, so no ASCII byte can appear <text:s/>as <text:s/>part <text:s/>of <text:s/>another <text:s/>character <text:s/>and <text:s/>there <text:s/>are no problems with e.g. '\0' or <text:s/>'/'.</text:span> |
| 375 |
</text:p> |
| 376 |
</text:list-item> |
| 377 |
<text:list-item> |
| 378 |
<text:p text:style-name="S3"> |
| 379 |
<text:span text:style-name="Span1">The lexicographic sorting order of UCS-4 strings is preserved.</text:span> |
| 380 |
</text:p> |
| 381 |
</text:list-item> |
| 382 |
<text:list-item> |
| 383 |
<text:p text:style-name="S3"> |
| 384 |
<text:span text:style-name="Span1">All <text:s/>possible 2^31 UCS codes can be encoded using UTF-8.</text:span> |
| 385 |
</text:p> |
| 386 |
</text:list-item> |
| 387 |
<text:list-item> |
| 388 |
<text:p text:style-name="S3"> |
| 389 |
<text:span text:style-name="Span1">The bytes 0xfe and 0xff are <text:s/>never <text:s/>used <text:s/>in <text:s/>the <text:s/>UTF-8 encoding.</text:span> |
| 390 |
</text:p> |
| 391 |
</text:list-item> |
| 392 |
<text:list-item> |
| 393 |
<text:p text:style-name="S3"> |
| 394 |
<text:span text:style-name="Span1">The <text:s/>first byte of a multibyte sequence which represents a single non-ASCII UCS character is always in the <text:s/>range 0xc0 <text:s/>to <text:s/>0xfd <text:s/>and <text:s/>indicates <text:s/>how <text:s/>long this multibyte sequence is. All further bytes in a <text:s/>multibyte <text:s/>sequence are <text:s/>in <text:s/>the range 0x80 to 0xbf. This allows easy resyn- chronization and makes the encoding stateless and robust against missing bytes.</text:span> |
| 395 |
</text:p> |
| 396 |
</text:list-item> |
| 397 |
<text:list-item> |
| 398 |
<text:p text:style-name="S3"> |
| 399 |
<text:span text:style-name="Span1">UTF-8 <text:s/>encoded <text:s/>UCS <text:s/>characters <text:s/>may <text:s/>be up to six bytes long, however Unicode characters can only be up to three bytes long. As Linux uses only the 16-bit Unicode subset of UCS, under Linux, UTF-8 multibyte sequences can <text:s/>only be one, two or three bytes long.</text:span> |
| 400 |
</text:p> |
| 401 |
</text:list-item> |
| 402 |
</text:list> |
| 403 |
<text:p text:style-name="S1"> |
| 404 |
<text:span text:style-name="Span1"/> |
| 405 |
</text:p> |
| 406 |
<text:p text:style-name="S1"> |
| 407 |
<text:span text:style-name="Span1">ENCODING</text:span> |
| 408 |
</text:p> |
| 409 |
<text:p text:style-name="S1"> |
| 410 |
<text:span text:style-name="Span1">The following byte sequences are used to represent a char-</text:span> |
| 411 |
</text:p> |
| 412 |
<text:p text:style-name="S1"> |
| 413 |
<text:span text:style-name="Span1">acter. The sequence to be used depends <text:s/>on <text:s/>the <text:s/>UCS <text:s/>code</text:span> |
| 414 |
</text:p> |
| 415 |
<text:p text:style-name="S1"> |
| 416 |
<text:span text:style-name="Span1">number of the character:</text:span> |
| 417 |
</text:p> |
| 418 |
<text:p text:style-name="S1"> |
| 419 |
<text:span text:style-name="Span1"/> |
| 420 |
</text:p> |
| 421 |
<text:p text:style-name="S1"> |
| 422 |
<text:span text:style-name="Span1">0x00000000 - 0x0000007F:</text:span> |
| 423 |
</text:p> |
| 424 |
<text:p text:style-name="S1"> |
| 425 |
<text:span text:style-name="Span1"><text:s/><text:s/><text:s/>0xxxxxxx</text:span> |
| 426 |
</text:p> |
| 427 |
<text:p text:style-name="S1"> |
| 428 |
<text:span text:style-name="Span1">0x00000080 - 0x000007FF:</text:span> |
| 429 |
</text:p> |
| 430 |
<text:p text:style-name="S1"> |
| 431 |
<text:span text:style-name="Span1"><text:s/><text:s/><text:s/>110xxxxx 10xxxxxx</text:span> |
| 432 |
</text:p> |
| 433 |
<text:p text:style-name="S1"> |
| 434 |
<text:span text:style-name="Span1">0x00000800 - 0x0000FFFF:</text:span> |
| 435 |
</text:p> |
| 436 |
<text:p text:style-name="S1"> |
| 437 |
<text:span text:style-name="Span1"><text:s/><text:s/><text:s/>1110xxxx 10xxxxxx 10xxxxxx</text:span> |
| 438 |
</text:p> |
| 439 |
<text:p text:style-name="S1"> |
| 440 |
<text:span text:style-name="Span1">0x00010000 - 0x001FFFFF:</text:span> |
| 441 |
</text:p> |
| 442 |
<text:p text:style-name="S1"> |
| 443 |
<text:span text:style-name="Span1"><text:s/><text:s/><text:s/>11110xxx 10xxxxxx 10xxxxxx 10xxxxxx</text:span> |
| 444 |
</text:p> |
| 445 |
<text:p text:style-name="S1"> |
| 446 |
<text:span text:style-name="Span1">0x00200000 - 0x03FFFFFF:</text:span> |
| 447 |
</text:p> |
| 448 |
<text:p text:style-name="S1"> |
| 449 |
<text:span text:style-name="Span1"><text:s/><text:s/><text:s/>111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx</text:span> |
| 450 |
</text:p> |
| 451 |
<text:p text:style-name="S1"> |
| 452 |
<text:span text:style-name="Span1">0x04000000 - 0x7FFFFFFF:</text:span> |
| 453 |
</text:p> |
| 454 |
<text:p text:style-name="S1"> |
| 455 |
<text:span text:style-name="Span1"><text:s/><text:s/><text:s/>1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx</text:span> |
| 456 |
</text:p> |
| 457 |
<text:p text:style-name="S1"> |
| 458 |
<text:span text:style-name="Span1"/> |
| 459 |
</text:p> |
| 460 |
<text:p text:style-name="S1"> |
| 461 |
<text:span text:style-name="Span1">The <text:s/>xxx <text:s/>bit <text:s/>positions <text:s/>are <text:s/>filled with the bits of the character code number in binary representation. <text:s/>Only <text:s/>the shortest <text:s/>possible <text:s/>multibyte sequence which can represent the code number of the character can be used.</text:span> |
| 462 |
</text:p> |
| 463 |
<text:p text:style-name="S1"> |
| 464 |
<text:span text:style-name="Span1"/> |
| 465 |
</text:p> |
| 466 |
<text:p text:style-name="S1"> |
| 467 |
<text:span text:style-name="Span1">EXAMPLES</text:span> |
| 468 |
</text:p> |
| 469 |
<text:p text:style-name="S1"> |
| 470 |
<text:span text:style-name="Span1">The Unicode character 0xa9 <text:s/>= <text:s/>1010 <text:s/>1001 <text:s/>(the <text:s/>copyright</text:span> |
| 471 |
</text:p> |
| 472 |
<text:p text:style-name="S1"> |
| 473 |
<text:span text:style-name="Span1">sign) is encoded in UTF-8 as</text:span> |
| 474 |
</text:p> |
| 475 |
<text:p text:style-name="S1"> |
| 476 |
<text:span text:style-name="Span1">11000010 10101001 = 0xc2 0xa9</text:span> |
| 477 |
</text:p> |
| 478 |
<text:p text:style-name="S1"> |
| 479 |
<text:span text:style-name="Span1">and <text:s/>character <text:s/>0x2260 <text:s/>= <text:s/>0010 <text:s/>0010 <text:s/>0110 0000 (the "not</text:span> |
| 480 |
</text:p> |
| 481 |
<text:p text:style-name="S1"> |
| 482 |
<text:span text:style-name="Span1">equal" symbol) is encoded as:</text:span> |
| 483 |
</text:p> |
| 484 |
<text:p text:style-name="S1"> |
| 485 |
<text:span text:style-name="Span1">11100010 10001001 10100000 = 0xe2 0x89 0xa0</text:span> |
| 486 |
</text:p> |
| 487 |
<text:p text:style-name="S1"> |
| 488 |
<text:span text:style-name="Span1">AUTHOR: </text:span> |
| 489 |
<text:span text:style-name="Span3">Markus Kuhn </text:span> |
| 490 |
<text:span text:style-name="Span1"><[email protected]></text:span> |
| 491 |
</text:p> |
| 492 |
<text:p text:style-name="S1"> |
| 493 |
<text:span text:style-name="Span1">SEE ALSO unicode(7)</text:span> |
| 494 |
</text:p> |
| 495 |
</office:text> |
| 496 |
</office:body> |
| 497 |
</office:document> |