diff --git a/lib/freetype/docs/css/freetype.css b/lib/freetype/docs/css/freetype.css new file mode 100644 index 000000000..6b5651686 --- /dev/null +++ b/lib/freetype/docs/css/freetype.css @@ -0,0 +1,247 @@ +body { + background-color: #FFFFFF; + background-repeat: no-repeat; + color: #000000; + font-family: verdana, geneva, arial, helvetica, sans-serif; +} +body.top { + background-color: #FFFFFF; + background-repeat: no-repeat; + color: #000000; + padding-top: 250px; + margin-left: 50px; + font-family: verdana, geneva, arial, helvetica, sans-serif; +} +body.z { + background-color: #FFFFFF; + color: #000000; + margin-left: 10%; + margin-right: 10%; + padding: 0; + font-family: verdana, geneva, arial, helvetica, sans-serif; +} +body.front { + background-color: #FFFFFF; + color: #000000; + margin: 0; + padding: 0; + font-family: verdana, geneva, arial, helvetica, sans-serif; +} + +div.version { + margin-bottom: 7ex; +} + +p { + font-size: 10pt; + text-align: justify; +} +p.center { + text-align: center; +} +p.link { + text-align: left; + padding-left: 0.5em; + width: 13.5em; +} +p.label { + text-align: left; + padding-left: 0.5em; + margin-bottom: 1.5ex; + background-color: #06425F; + line-height: 3ex; +} + +h1 { + font-size: 180%; +} +h1.section { + color: #06425F; + font-family: verdana, geneva, arial, helvetica, sans-serif; + font-size: 180%; + margin-top: 2em; +} +h1.zsection { + color: black; + background-color: #CCCCEE; + text-align: center; + font-family: verdana, geneva, arial, helvetica, sans-serif; + font-size: 180%; + padding: 0.3em; + border: none; + width: 100%; +} +h1.intro { + font-size: 24pt; + font-weight: bold; + font-family: sans-serif; + color: #FFFFFF; + text-align: center; + margin-top: 0.3em; + margin-left: 1em; + margin-right: 1em; +} +h2 { + font-size: 150%; +} +h2.section { + color: black; + background-color: #CCCCEE; + text-align: center; + font-family: verdana, geneva, arial, helvetica, sans-serif; + font-size: 120%; + padding: 0.2em; + border: solid; + border-width: 1px; + width: 100%; +} +h3 { + font-size: 120%; +} +h4 { + font-size: 100%; +} + +pre.code { + font-family: "andale mono", lucida, "courier new", courier, monospace; + font-size: small; + color: blue; +} +pre.code i { + font-family: "andale mono", lucida, "courier new", courier, monospace; + font-style: normal; + font-size: small; + color: gray; +} + +table.menu { + border: 0; + border-spacing: 0; + padding: 0; + margin-bottom: 3ex; +} + +tr.menurow { + background-color: #000080; + color: #000000; + vertical-align: middle; +} + +td { + font-family: verdana, geneva, arial, helvetica, sans-serif; + font-size: 10pt; +} +td.menu { + font-family: verdana, geneva, arial, helvetica, sans-serif; + font-size: 10pt; + padding-left: 25px; + padding-right: 25px; + vertical-align: top; +} +td.menucell { + color: #FFFFFF; + background-color: #000080; + font-family: verdana, geneva, arial, helvetica, sans-serif; + font-size: 10pt; +} +td.locationcell { + color: #000000; + background-color: #FFFFFF; + font-family: verdana, geneva, arial, helvetica, sans-serif; + font-size: small; + font-weight: bold; +} +td.titlebar { + color: #000000; + background-color: #C5CAE2; + font-family: verdana, geneva, arial, helvetica, sans-serif; +} + +a:link { + background-color: transparent; + color: #000080; + font-weight: bold; + text-decoration: none; +} +a:visited { + background-color: transparent; + color: #800080; + font-weight: bold; + text-decoration: none; +} +a:active { + background-color: transparent; + color: #FE0000; + font-weight: bold; + text-decoration: none; +} +a:hover { + background-color: transparent; + color: #1919AA; + font-weight: bold; + text-decoration: underline; +} +a.sidebar:link { + background-color: transparent; + color: #000080; + font-weight: normal; + text-decoration: none; +} +a.sidebar:visited { + background-color: transparent; + color: #000080; + font-weight: normal; + text-decoration: none; +} +a.sidebar:active { + background-color: transparent; + color: #FE0000; + font-weight: normal; + text-decoration: none; +} +a.sidebar:hover { + background-color: transparent; + color: #1919AA; + font-weight: normal; + text-decoration: underline; +} +a.menulink { + color: #EEEEEE; + background-color: #000080; + text-decoration: none; + font-family: verdana, geneva, arial, helvetica, sans-serif; + font-size: 10pt; +} +a.menulink:visited { + color: #EEEEEE; + background-color: #000080; + text-decoration: none; +} +a.menulink:hover { + color: #FFFFFF; + background-color: #000080; + text-decoration: none; +} +a.label:link {color: #FFFFFF} +a.label:visited {color: #FFFFFF} +a.label:active {color: #FFFFFF} +a.label:hover {color: #FFFFFF} +a.index:link { + text-decoration: none; + color: #666666 +} +a.index:visited { + text-decoration: none; + color: #666666 +} +a.index:active { + text-decoration: none; + color: #666666 +} +a.index:hover { + text-decoration: underline; + color: #000000 +} + +tt.code { color: gray; } +em.warning { color: red; } diff --git a/lib/freetype/docs/css/freetype2.css b/lib/freetype/docs/css/freetype2.css new file mode 100644 index 000000000..64d755fc5 --- /dev/null +++ b/lib/freetype/docs/css/freetype2.css @@ -0,0 +1,369 @@ +/* freetype2.css */ + +/* the column container layout is based on */ +/* http://matthewjamestaylor.com/blog/perfect-multi-column-liquid-layouts */ + + +/* use Droid fonts */ +@import url("http://fonts.googleapis.com/css?family=Droid+Serif:r,i,b,bi"); +@import url("http://fonts.googleapis.com/css?family=Droid+Sans:r,b"); +@import url("http://fonts.googleapis.com/css?family=Droid+Sans+Mono"); + + +/* top-level appearance */ +body { + width: 100%; + margin: 0em; + padding: 0em; + border: 0em; + text-align: left; + font-size: large; + font-family: "Droid Serif", "serif"; + line-height: 140%; } + +/* table of contents column; */ +/* width and offsets must be synchronized with col2 below */ +#TOC { + background: #F8F8F8; + position: fixed; + font-family: "Droid Sans", "sans-serif"; + font-size: 115%; + left: 0em; + width: 10em; } + +#TOC-bottom { + background: #F8F8F8; + left: 0em; + width: 11.5em; } + +/* don't display list markers in TOC */ +#TOC ul { + list-style: none; + text-align: center; + margin: 0em; + padding: 0em; } +/* separate items with line */ +#TOC ul li { + display: block; + padding-top: 0.5ex; + padding-bottom: 0.5ex; + border-bottom: 1px solid #CCCCCC; } +/* give more vertical spacing for funding icons */ +#TOC ul li.funding { + padding-top: 1ex; + padding-bottom: 1ex; } +#TOC ul li.funding p { + margin-top: 1.5ex; + margin-bottom: 1.5ex; } + +/* this is gray getting black */ +#TOC a:link { + color: #666666; } +#TOC a:visited { + color: #666666; } +#TOC a:active { + color: #666666; } +#TOC a:hover { + color: #000000; } + +/* this is pale red getting red + + #TOC a.emphasis:link { + color: #FF6666; } + #TOC a.emphasis:visited { + color: #FF6666; } + #TOC a.emphasis:active { + color: #FF6666; } + #TOC a.emphasis:hover { + color: #FF0000; } +*/ + +#TOC a.emphasis:link { + color: #666666; } +#TOC a.emphasis:visited { + color: #666666; } +#TOC a.emphasis:active { + color: #666666; } +#TOC a.emphasis:hover { + color: #000000; } + +#TOC a.current:link { + color: #000000; } +#TOC a.current:visited { + color: #000000; } +#TOC a.current:active { + color: #000000; } +#TOC a.current:hover { + color: #000000; } + +/* top bar */ +#top h1 { + position: absolute; + top: 25px; + left: 20px; + margin: 0em; + padding: 0em; + border: 0em; } +.bar { + clear: both; + color: white; + background: #06435E + url("../image/fond3.png") + no-repeat + right + top; + text-align: left; + font-family: "Droid Sans", "sans-serif"; + font-weight: bold; + padding: 0em; + margin: 0em; + border: 0em; + height: 134px; + vertical-align: bottom; } + +#top a { + color: white; + /* pale underline for links */ + text-decoration: none; + border-bottom: 2px solid #16536E; } +#top a:link { + color: white; } +#top a:visited { + color: white; } +#top a:active { + color: white; } +#top a:hover { + color: #CCCCCC; } + +/* column container */ +.colmask { + /* this fixes the IE7 overflow hidden bug */ + /* and stops the layout jumping out of place */ + position: relative; + clear: both; + float: left; + width: 100%; + /* this chops off any overhanging
s */ + overflow: hidden; } +/* two-column left menu settings (col1 is right, col2 is left) */ +.leftmenu .colright { + float: left; + width: 200%; + position: relative; + left: 11.5em; /* pad2_l + wd2 + pad2_r */ + background: white; } +.leftmenu .col1wrap { + float: right; + width: 50%; + position: relative; + right: 12em; } /* pad2_l + wd2 + pad2_r */ +.leftmenu .col1 { + margin: 0 1em /* pad2_r */ + 0 12em; /* pad2_l + wd2 + pad2_r + pad1_l */ + position: relative; + right: 100%; + width: 45em; + max-width: 66%; + /* overflow: hidden; */ + padding-left: 2em; } +.leftmenu .col2 { + float: left; + width: 10em; /* wd2 */ + position: relative; + right: 11em; } /* wd2 + pad2_r */ + +/* table of contents */ +#contents ul { + list-style: none; } + +blockquote { + font-style: italic; } + +code { + font-family: "Droid Sans Mono", "monospace"; } + +tt { + font-family: "Droid Sans Mono", "monospace"; } + +pre { + font-family: "Droid Sans Mono", "monospace"; + margin-left: 1.5em; } +pre.example { + color: purple; + font-family: "Droid Sans Mono", "monospace"; + margin-left: 1.5em; } + +span.comment { + color: gray; } +span.important { + font-weight: bold; } + +a { + color: #0000EF; + font-weight: bold; + /* no underline for links */ + text-decoration: none; } +a:link { + color: #000080; } +a:visited { + color: #800080; } +a:active { + color: #FE0000; } +a:hover { + color: #1919AA; } + +h1 { + margin-top: 6ex; } +h2 { + margin-top: 5ex; } +h3 { + margin-top: 4ex; } +h4 { + margin-top: 3ex; } +h5 { } +h6 { } + +h1.title { + text-align: center; } +h1.header { + margin-top: 1ex; + line-height: 200%; } +h2.author { + text-align: center; } +h3.date { + text-align: center; } +h3 + div.date { + margin-top: -3ex; + margin-bottom: 3ex; } +h4 + div.date { + margin-top: -3ex; } + +/* images */ +img.with-border { + padding: 0.5em; } +#TOC img.with-border { + padding: 0.3em; } + +/* figures */ +div.figure { + text-align: center; + margin-top: 5ex; + margin-bottom: 5ex; } +p.caption { + font-size: smaller; } + +/* tables */ +table { + border-collapse: collapse; + /* the next two lines center the table horizontally */ + margin-left: auto; + margin-right: auto; + margin-top: 5ex; + margin-bottom: 5ex; } +td { + padding-left: 0.8em; + padding-right: 0.8em; } +thead { + /* a horizontal rule between table head and body */ + border-bottom: solid thin; } +th { + padding-left: 0.8em; + padding-right: 0.8em; + /* some vertical space before the horizontal rule */ + padding-bottom: 1ex; } +tbody tr:first-child td { + /* some vertical space after the horizontal rule */ + padding-top: 1ex; } + +dl { + margin-left: 1em; } + +dt { + font-weight: bold; } + +/* if we have paragraphs in definition lists, */ +/* suppress the very first vertical space */ +dd > p:first-child { + margin-top: 0ex; } +dd > p { + margin-bottom: 0ex; } + +/* indented text */ +div.quote { + margin-left: 1.5em; } + +/* list for subsections */ +li.tertiary { + font-size: smaller; + text-align: left; + margin-left: 2em; } + +/* list with item headers */ +li.emph p:first-child { + font-weight: bold; } + +ol.algorithm { + font-family: "Droid Sans Mono", "monospace"; } + +/* miscellaneous */ +div.date { + color: #666666; + font-size: smaller; } +div.webmaintainer { + margin-top: 5ex; + font-style: italic; + font-size: 70%; } +div.updated { + margin-top: 5ex; + font-style: italic; + font-size: 70%; } +p.warning { + color: red; } +p.large { + font-size: larger; } +p.note { + font-style: italic; } + +/* +@media screen and (max-width: 40.5em) { + #TOC, + .colmask, + .leftmenu .colright, + .leftmenu .col1wrap, + .leftmenu .col1 { + float: none; + clear: none; + position: relative; + width: 100%; + left: 0em; + right: 100%; + max-width: 100%; + margin: 0em; + padding: 0em; + font-family: "sans-serif"; + } + + #TOC-bottom { + display: none; + } + + #wrapper { + display: table; + line-height: 130%; + padding: 0em 1em; + } + + #TOC { + display: table-header-group; + } + + .colmask { + display: table-footer-group; + } + + #TOC br { + display: none; } +} +*/ + +/* end of file */ diff --git a/lib/freetype/docs/css/freetype2_-30.css b/lib/freetype/docs/css/freetype2_-30.css new file mode 100644 index 000000000..401cdaba3 --- /dev/null +++ b/lib/freetype/docs/css/freetype2_-30.css @@ -0,0 +1,12 @@ +/* freetype2_-30.css */ + +@import "freetype2.css"; + +.bar { + background: #065E4E + url("../image/fond3_-30.png") + no-repeat + right + top; } +#top a { + border-bottom: 2px solid #166E5E; } diff --git a/lib/freetype/docs/css/freetype2_-60.css b/lib/freetype/docs/css/freetype2_-60.css new file mode 100644 index 000000000..d3f44adad --- /dev/null +++ b/lib/freetype/docs/css/freetype2_-60.css @@ -0,0 +1,12 @@ +/* freetype2_-60.css */ + +@import "freetype2.css"; + +.bar { + background: #065E23 + url("../image/fond3_-60.png") + no-repeat + right + top; } +#top a { + border-bottom: 2px solid #166E33; } diff --git a/lib/freetype/docs/css/freetype2_-90.css b/lib/freetype/docs/css/freetype2_-90.css new file mode 100644 index 000000000..86b4a7a72 --- /dev/null +++ b/lib/freetype/docs/css/freetype2_-90.css @@ -0,0 +1,12 @@ +/* freetype2_-90.css */ + +@import "freetype2.css"; + +.bar { + background: #155E06 + url("../image/fond3_-90.png") + no-repeat + right + top; } +#top a { + border-bottom: 2px solid #256E16; } diff --git a/lib/freetype/docs/css/freetype2_30.css b/lib/freetype/docs/css/freetype2_30.css new file mode 100644 index 000000000..28acb435c --- /dev/null +++ b/lib/freetype/docs/css/freetype2_30.css @@ -0,0 +1,12 @@ +/* freetype2_30.css */ + +@import "freetype2.css"; + +.bar { + background: #06175E + url("../image/fond3_30.png") + no-repeat + right + top; } +#top a { + border-bottom: 2px solid #16276E; } diff --git a/lib/freetype/docs/css/freetype2_60.css b/lib/freetype/docs/css/freetype2_60.css new file mode 100644 index 000000000..064ed4c10 --- /dev/null +++ b/lib/freetype/docs/css/freetype2_60.css @@ -0,0 +1,12 @@ +/* freetype2_60.css */ + +@import "freetype2.css"; + +.bar { + background: #21065E + url("../image/fond3_60.png") + no-repeat + right + top; } +#top a { + border-bottom: 2px solid #31166E; } diff --git a/lib/freetype/docs/css/freetype2_90.css b/lib/freetype/docs/css/freetype2_90.css new file mode 100644 index 000000000..af2bc7946 --- /dev/null +++ b/lib/freetype/docs/css/freetype2_90.css @@ -0,0 +1,12 @@ +/* freetype2_90.css */ + +@import "freetype2.css"; + +.bar { + background: #4C065E + url("../image/fond3_90.png") + no-repeat + right + top; } +#top a { + border-bottom: 2px solid #5C166E; } diff --git a/lib/freetype/docs/documentation.html b/lib/freetype/docs/documentation.html new file mode 100644 index 000000000..b7ece3a2f --- /dev/null +++ b/lib/freetype/docs/documentation.html @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + FreeType Documentation + + + + +
+

FreeType Documentation

+
+ + +
+ +
+
+
+
+ + + + +
+

Note that the FreeType documentation is also available as + a single archive from + our download page.

+
+ + + + + + + + + +
+

Last update: 05-Oct-2015

+
+
+
+ + + + +
+
+
+
+ + + + +
+ +
+ +
+ +
+
+ + + diff --git a/lib/freetype/docs/ft2faq.html b/lib/freetype/docs/ft2faq.html new file mode 100644 index 000000000..db6d7dcd4 --- /dev/null +++ b/lib/freetype/docs/ft2faq.html @@ -0,0 +1,717 @@ + + + + + + + + + FreeType 2 FAQ + + + + + + + + + + + + + + + + +
+ + FreeType Homepage + +
+

FREETYPE 2 FAQ

+
+     General +       Compilation & + Configuration +       The FreeType 2 + auto-hinter +       Other +       | +        FreeType 2 + documentation +
+ + + + + +
+

Table of Contents

+ + + +

+ Top

+ +
+ +

+ + General questions + +

+ + +

+ What is FreeType 2? +

+ +

It is a software library that can be used by all kinds of + applications to access the contents of font files. Most notably, it + supports the following ‘features’:

+ +
    +
  • +

    It provides a uniform interface to access font files. It + supports both bitmap and scalable formats, including TrueType, + OpenType, Type1, CID, CFF, Windows FON/FNT, X11 PCF, and + others.

    +
  • + +
  • +

    It supports high-speed anti-aliased glyph bitmap generation + with 256 gray levels.

    +
  • + +
  • +

    It is extremely modular, each font format being supported by a + specific module. A build of the library can be tailored to + support only the formats you need, thus reducing code size (a + minimal anti-aliasing build of FreeType can be less than 30KB)

    +
  • +
+ +
+ + +

+ What can I do with FreeType 2? +

+ +

FreeType 2 is already used in many products. For example, it + serves as a font rendering engine

+ +
    +
  • + in graphics subsystem and libraries to display text +
  • +
  • + in text layout and pagination services to measure and eventually + render text +
  • +
  • + in font inspection and conversion tools +
  • +
+ +

Generally speaking, the library allows you to access and manage + the contents of font files in a very easy way.

+ +
+ + +

+ What can I not do with FreeType 2? +

+ +

FreeType 2 doesn't try to perform a number of sophisticated + things, because it focuses on being an excellent font + service.

+ +

This means that the following features are not supported directly + by the library, even though they can be more or less implemented on + top of it, or by using it:

+ +
    +
  • +

    rendering glyphs to arbitrary surfaces
    + FreeType 2 doesn't try to be a graphics library and thus only + supports two pixel formats when rendering glyphs: monochrome 1-bit + bitmaps, or 8-bit gray-level pixmaps.

    + +

    If you need to draw glyphs to other kinds of surfaces (for + example, a 24-bit RGB pixmap), you need to use your favorite + graphics library to do just that.

    + +

    Note however that in the case of rendering scalable glyph + outlines to anti-aliased pixmaps, an application can also provide + its own rendering callback in order to draw or compose directly + the anti-aliased glyph on any target surface.

    +
  • + +
  • +

    glyph caching
    + Each time you request a glyph image from a font, FreeType 2 + does it by parsing the relevant portion of the font file or font + stream and interpreting it according to its font format. This can + be very slow for certain formats, including scalable ones like + TrueType or Type 1.

    + +

    Any decent text-rendering sub-system must thus be capable of + caching glyph data in order to reach appropriate rendering + speed.

    + +

    Note that we provide a caching sub-system with + FreeType 2 since version 2.0.1 which has become quite stable + at the time of this writing (version 2.2.1). However, it might + not suit your needs.

    +
  • + +
  • +

    text layout
    + The library doesn't support text layout operations. Sophisticated + features like glyph substitution, positioning (kerning), + justification, bi-directional ordering, etc.m are not part of a + font service in itself. They must be handled one level + higher.

    +
  • +
+ +
+ + +

+ How portable is FreeType 2? +

+ +

The FreeType 2 source code is extremely portable for the + following reasons:

+ +
    +
  • +

    Everything is written in standard ANSI C.

    +
  • +
  • +

    We are very pedantic to avoid any kinds of compiler warnings. + The current source code has been compiled with many compilers + without producing a single warning.

    +
  • +
  • +

    The library doesn't use any static writable data at all, making + it an ideal choice on various embedded systems (e.g., it can be + run from ROM directly). It is completely thread-safe too.

    +
  • +
+ +

We have made great efforts to ensure that the library is efficient, + compact, and customizable.

+ +
+ + +

+ What are the differences between FreeType 1.x and + FreeType 2? +

+ +

The biggest differences are as follows.

+ +
    +
  • +

    FreeType 1 only supports the TrueType format, while + FreeType 2 supports a lot more.

    +
  • + +
  • +

    The FreeType 2 API is simpler as well as more powerful + than the FreeType 1 API.

    +
  • + +
  • +

    FreeType 1 includes an extension to support OpenType text + layout processing. This support hasn't become part of + FreeType 2; a much improved version is now part of the Pango library.

    +
  • +
+ +
+ + +

+ Is FreeType 2 backwards compatible with FreeType 1.x? +

+ +

Short answer: No. However, transition from 1.x to 2 should be + rather straightforward.

+ +

The FreeType 2 API is a lot simpler than the one in 1.x + while being much more powerful. We thus encourage you to adapt your + source code to it as this should not involve much work.

+ +
+ + +

+ Can I use FreeType 2 to edit fonts or create new ones? +

+ +

No. The library has been specifically designed to read + font files with small code size and very low memory usage.

+ +

A good, freely available font editor is FontForge.

+ +

+ Top

+ +
+ +

+ + Compilation & Configuration + +

+ + +

+ How do I compile the FreeType 2 library? +

+ +

The library can be compiled in various ways, and detailed + documentation is available in documentation directory of the + FreeType 2 source tree.

+ +

For compilation on the command line, GNU make is necessary; other + build tools won't work. The source bundle also comes with project + files for some graphical IDEs like Visual C; note, however, that those + files are sometimes not up to date since it is contributed code not + used by the core developers.

+ +
+ + +

+ How do I configure my build of the library? +

+ +

This is fully described in the file CUSTOMIZATION in + FreeType's documentation directory. Basically, you have to edit the + header file ftoption.h for compile-time options and to select + the modules with the file modules.cfg. Finally, it is + possible to replace the standard system interface (dealing with memory + allocation and stream I/O) with a custom one.

+ +
+ + +

+ Why does FreeType render differently on different platforms? +

+ +

Different distributions compile FreeType with different options. + The developer version of a distribution's FreeType package, which is + needed to compile your program against FreeType, includes the file + ftoption.h. Compare each platform's copy of + ftoption.h to find the differences.

+ +

+ Top

+ +
+ +

+ + The FreeType 2 auto-hinter + +

+ + +

+ How does the auto-hinter work? +

+ +

Please note that the name of auto-hinter module is + autofit, which is a reimplementation of the old autohint + module.

+ +

A rather complete description of the hinting algorithm (which is + slightly out of date regarding the internal structures) can be found + in the TUG-boat article Real-Time + Grid Fitting of Typographic Outlines.

+ +

The auto-hinter performs grid-fitting on scalable font formats that + use Bézier outlines as their primary glyph image format (this + means nearly all scalable font formats today). If a given font driver + doesn't provide its own hinter, the auto-hinter is used by default. + If a format-specific hinter is provided, it is still possible to use + the auto-hinter using the FT_LOAD_FORCE_AUTOHINT bit flag + when calling FT_Load_Glyph().

+ +

Currently, the auto-hinter doesn't use external hints to do its + job, as it automatically computes global metrics (when it + ‘opens’ a font for the first time) and glyph + ‘hints’ from their outline. + +


+ + +

+ Why doesn't the auto-hinter work well with my script? +

+ +

The auto-hinter was first designed to manage and hint Latin-based + fonts, as they consist of most of the fonts available today. It now + supports Asian fonts, but not other complex scripts like Arabic.

+ +

Hinting various scripts isn't really more difficult than Latin, + just different, with a set of different constraints, which must be + hard-coded into the autofit module. Volunteers welcome!

+ +

+ Top

+ +
+ +

+ + Other questions + +

+ + +

+ Can I use FreeType to draw text on a pixmap with arbitrary depth? +

+ +

Not directly, as FreeType is a font library, not a general-purpose + graphics library or text rendering service. However, note that the + anti-aliased renderer allows you to convert a vectorial glyph outline + into a list of ‘spans’ (i.e., horizontal pixel segments + with the same coverage) that can be rendered through user-provided + callbacks.

+ +

By providing the appropriate span callback, you can render + anti-aliased text to any kind of surface. You can also use any + colour, fill pattern or fill image if you want to. This process is + called direct rendering.

+ +

A complete example is given at the end of the FreeType 2 tutorial. + +

Note that direct rendering is not available with + monochrome output, as the current renderer uses a two-pass algorithm + to generate glyphs with correct drop-out control.

+ +
+ + +

+ How can I set the colour of text rendered by FreeType? +

+ +

Basically, you can't do that, because FreeType is simply a font + library. In general, you need to use your favorite graphics library + to draw the FreeType glyphs with the appropriate colour.

+ +

Note that for anti-aliased glyphs, you can ‘set the + colour’ by using direct rendering as described in this answer.

+ +
+ + +

+ I set the pixel size to 8×8, but the resulting glyphs are + larger (or smaller) than that. Why? +

+ +

A lot of people have difficulties to understand this topic, because + they think of glyphs as fixed-width or fixed-height + ‘cells’, like those of fonts used in terminals/consoles. + This assumption is not valid with most ‘modern’ font + formats, even for bitmapped-based ones like PCF or + BDF.

+ +

Be aware that the character size that is set either + through FT_Set_Char_Size() or FT_Set_Pixel_Sizes() + isn't directly related to the dimension of the generated glyph + bitmaps!

+ +

Rather, the character size is indeed the size of an abstract + square, called the EM, used by typographers to design + fonts. Scaling two distinct fonts to the same character size, be it + expressed in points or pixels, generally results in bitmaps with + distinct dimensions!

+ +

Note that historically, the EM corresponded to the width of a + capital ‘M’ in Latin typefaces. However, later + improvements in typography led to designs that greatly deviate from + this rule. Today, it is not possible to connect the EM size to a + specific font ‘feature’ in a reliable way.

+ +
+ + +

+ How can I compute the bounding box of a text string without loading + its glyphs before? +

+ +

This is not possible in general. Reason is that hinting distorts + the glyph shape for optimal rasterization, and this process sometimes + creates outlines which have considerably different metrics. The + TrueType format provides the (optional) ‘hdmx’ table which + contains device horizontal metrics for selected pixel sizes, but even + here the vertical metrics are missing.

+ +

It is probably best to use both a glyph and a metrics cache to + avoid recomputation.

+ +
+ + +

+ Which anti-aliasing algorithm is used by FreeType 2? +

+ +

The algorithm has been specifically designed for FreeType. It is + based on ideas that were originally found in the implementation of the + libArt graphics library to + compute the exact pixel coverage of a vector image with no + sub-sampling and filtering.

+ +

However, these two implementations are radically distinct and use + vastly different models. The FreeType 2 renderer is optimized + specifically for rendering small complex shapes, like glyphs, at very + high speed while using very few memory. On the other hand, libArt has + been designed for general shape and polygon processing, especially + large ones.

+ +

The FreeType 2 anti-aliasing renderer is indeed + faster than the monochrome renderer for small character sizes + (typically <20 pixels). The reason is that the monochrome + renderer must perform two passes on the outline in order to perform + drop-out control according to the TrueType specification.

+ +
+ + +

+ When will FreeType 2 support OpenType? +

+ +

Well, the engine already reads OpenType/CFF files perfectly. What + it doesn't do is handling ‘OpenType Layout’ tables.

+ +

FreeType 1 comes with a set of extensions that are used to + load and manage OpenType Layout tables. It even has a demonstration + program named ftstrtto to show its capabilities. However, + this code is no longer maintained, and we strongly advise to not use + it.

+ +

For FreeType 2, we have decided that the layout operations + provided through these tables are better placed in a specific + text-layout library like Pango.

+ +

+ Top

+
+ +Last update: 25-Feb-2011 + + + + + + + + + +
+     General +       Compilation & + Configuration +       The FreeType 2 + auto-hinter +       Other +       | +        FreeType  + documentation +
+ + FreeType Homepage + +
+ + + diff --git a/lib/freetype/docs/glyphs/glyphs-1.html b/lib/freetype/docs/glyphs/glyphs-1.html index e9d781027..ccee2699a 100644 --- a/lib/freetype/docs/glyphs/glyphs-1.html +++ b/lib/freetype/docs/glyphs/glyphs-1.html @@ -1,200 +1,271 @@ - - + + + + + content="text/html; charset=utf-8"> + + + - FreeType Glyph Conventions + + + + + + + + + + FreeType Glyph Conventions / I - -

- FreeType Glyph Conventions -

+ -

- Version 2.1 -

- -

- Copyright 1998-2000 David Turner (david@freetype.org)
- Copyright 2000 The FreeType Development Team (devel@freetype.org) -

- -
- - -
- -
- - - - - - -
-   - - Contents - - Next -
-
- -


- - - -
-

- I. Basic typographic concepts -

-
- - -

- 1. Font files, format and information -

- -

A font is a collection of various character images that can be used - to display or print text. The images in a single font share some common - properties, including look, style, serifs, etc. Typographically - speaking, one has to distinguish between a font family and its - multiple font faces, which usually differ in style though come - from the same template.

- - For example, "Palatino Regular" and "Palatino Italic" are two distinct - faces from the same famous family, called "Palatino" - itself.

- -

The single term font is nearly always used in ambiguous ways - to refer to either a given family or given face, depending on the - context. For example, most users of word-processors use "font" to - describe a font family (e.g. "Courier", "Palatino", etc.); however most - of these families are implemented through several data files depending - on the file format: For TrueType, this is usually one per face (i.e. - arial.ttf for "Arial Regular", ariali.ttf for "Arial - Italic", etc.). The file is also called a "font" but really contains a - font face.

- -

A digital font is thus a data file that may contain one - or more font faces. For each of these, it contains character - images, character metrics, as well as other kind of information - important to the layout of text and the processing of specific character - encodings. In some awkward formats, like Adobe's Type 1, a single - font face is described through several files (i.e. one contains the - character images, another one the character metrics). We will ignore - this implementation issue in most parts of this document and consider - digital fonts as single files, though FreeType 2.0 is able to - support multiple-files fonts correctly.

- -

As a convenience, a font file containing more than one face is called - a font collection. This case is rather rare but can be seen in - many Asian fonts, which contain images for two or more representation - forms of a given scripts (usually for horizontal and vertical - layout.

+
+

FreeType Glyph + Conventions / I

+
- -

- 2. Character images and mappings -

+
-

The character images are called glyphs. A single character - can have several distinct images, i.e. several glyphs, depending on - script, usage or context. Several characters can also take a single - glyph (good examples are Roman ligatures like "fi" and "fl" which can be - represented by a single glyph). The relationships between characters - and glyphs can be very complex, but won't be discussed in this document. - Moreover, some formats use more or less awkward schemes to store and - access glyphs. For the sake of clarity, we only retain the following - notions when working with FreeType:

- -
    -
  • -

    A font file contains a set of glyphs; each one can be stored as a - bitmap, a vector representation or any other scheme (most scalable - formats use a combination of mathematical representation and control - data/programs). These glyphs can be stored in any order in the font - file, and is typically accessed through a simple glyph index.

    -
  • -
  • -

    The font file contains one or more tables, called a character - map (or charmap in short), which is used to convert character - codes for a given encoding (e.g. ASCII, Unicode, DBCS, Big5, etc..) - into glyph indices relative to the font file. A single font face - may contain several charmaps. For example, most TrueType fonts - contain an Apple-specific charmap as well as a Unicode charmap, - which makes them usable on both Mac and Windows platforms.

    -
  • -
+
+
+
+
- -

- 3. Character and font metrics -

+ -

Each glyph image is associated with various metrics which are used to - describe how must be placed and managed when rendering text. These - are described in more details in section III, they relate to - glyph placement, cursor advances as well as text layout. They are - extremely important to compute the flow of text when rendering a string - of text.

+
+

I. Basic Typographic Concepts

-

Each scalable format also contains some global metrics, expressed in - notional units, to describe some properties of all glyphs in the same - face. Examples for global metrics are the maximum glyph bounding box, - the ascender, descender and text height for the font.

+

1. Font files, format and + information

-

Though these metrics also exist for non-scalable formats, they only - apply for a set of given character dimensions and resolutions, and - are usually expressed in pixels then.

+

A font is a collection of various character + images that can be used to display or print text. The + images in a single font share some common properties, + including look, style, serifs, etc. Typographically + speaking, one has to distinguish between a font + family and its multiple font faces, which + usually differ in style though come from the same + template.

+ +

For example, ‘Palatino Regular’ and + ‘Palatino Italic’ are two distinct + faces from the same family, called + ‘Palatino’ itself.

+ +

The single term ‘font’ is nearly always used + in ambiguous ways to refer to either a given family or + given face, depending on the context. For example, most + users of word-processors use ‘font’ to + describe a font family (e.g. ‘Courier’, + ‘Palatino’, etc.); however, most of these + families are implemented through several data files + depending on the file format: For TrueType, this is + usually one per face (i.e. arial.ttf for + ‘Arial Regular’, ariali.ttf for + ‘Arial Italic’, etc.). The file is also + called a ‘font’ but really contains a font + face.

+ +

A digital font is thus a data file that may + contain one or more font faces. For each of + these, it contains character images, character metrics, as + well as other kind of information important to the layout + of text and the processing of specific character + encodings. In some formats, like Adobe's Type 1, a + single font face is described through several files (i.e., + one contains the character images, another one the + character metrics). We will ignore this implementation + issue in most parts of this document and consider digital + fonts as single files, though FreeType 2 is able to + support multiple-files fonts correctly.

+ +

As a convenience, a font file containing more than one + face is called a font collection. This case is + rather rare but can be seen in many Asian fonts, which + contain images for two or more representation forms of a + given scripts (usually for horizontal and vertical + layout.

-


+

2. Character images and + mappings

-
- - - - - - -
-   - - Contents - - Next -
-
+

The character images are called glyphs. A + single character can have several distinct images, + i.e. several glyphs, depending on script, usage or + context. Several characters can also take a single glyph + (good examples are Roman ligatures like ‘fi’ + and ‘fl’ which can be represented by a single + glyph). The relationship between characters and glyphs + can be very complex but won't be discussed in this + document. Moreover, some formats use more or less + complicated schemes to store and access glyphs. For the + sake of clarity, we only retain the following notions when + working with FreeType:

-
-
+ + + +

3. Character and font metrics

+ +

Each glyph image is associated with various metrics which + describe how to place and manage it when rendering text; + see section III for more. + Metrics relate to glyph placement, cursor advances as well + as text layout. They are extremely important to compute + the flow of text when rendering a string of text.

+ +

Each scalable format also contains some global metrics, + expressed in notional (i.e. font) units, to describe some + properties of all glyphs in the same face. Examples for + global metrics are the maximum glyph bounding box, the + ascender, descender, and text height of the font.

+ +

Non-scalable formats contain metrics also. However, they + only apply to a set of given character dimensions and + resolutions, and are usually expressed in pixels then.

+
+ + + +
+

Last update: 07-Dec-2014

+
+ + + + + + +
+
+ + + + + + +
+ +
+ + + +
+
- diff --git a/lib/freetype/docs/glyphs/glyphs-2.html b/lib/freetype/docs/glyphs/glyphs-2.html index 9d99ba01a..60ff4c508 100644 --- a/lib/freetype/docs/glyphs/glyphs-2.html +++ b/lib/freetype/docs/glyphs/glyphs-2.html @@ -1,395 +1,472 @@ - - + + + + + content="text/html; charset=utf-8"> + + + - FreeType Glyph Conventions + + + + + + + + + + FreeType Glyph Conventions / II - -

- FreeType Glyph Conventions -

+ -

- Version 2.1 -

- -

- Copyright 1998-2000 David Turner (david@freetype.org)
- Copyright 2000, 2007 The FreeType Development Team (devel@freetype.org) -

- -
- - -
- -
- - - - - - -
- Previous - - Contents - - Next -
-
- -


- - - -
-

- II. Glyph Outlines -

-
- -

This section describes the way scalable representations of glyph images, - called outlines, are used by FreeType as well as client applications.

- - -

- 1. Pixels, points and device resolutions -

- -

Though it is a very common assumption when dealing with computer - graphics programs, the physical dimensions of a given pixel (be it for - screens or printers) are not squared. Often, the output device, be it a - screen or printer, exhibits varying resolutions in both horizontal and - vertical direction, and this must be taken care of when rendering - text.

- -

It is thus common to define a device's characteristics through two - numbers expressed in dpi (dots per inch). For example, a - printer with a resolution of 300x600 dpi has 300 pixels per - inch in the horizontal direction, and 600 in the vertical one. The - resolution of a typical computer monitor varies with its size - (15" and 17" monitors don't have the same pixel sizes at - 640x480), and of course the graphics mode resolution.

- -

As a consequence, the size of text is usually given in - points, rather than device-specific pixels. Points are a - simple physical unit, where 1 point = 1/72th of - an inch, in digital typography. As an example, most Roman books are - printed with a body text whose size is somewhere between 10 and - 14 points.

- -

It is thus possible to compute the size of text in pixels from the - size in points with the following formula:

- -
- pixel_size = point_size * resolution / 72 -
- -

The resolution is expressed in dpi. Since horizontal and - vertical resolutions may differ, a single point size usually defines a - different text width and height in pixels.

- -

Unlike what is often thought, the "size of text in pixels" is not - directly related to the real dimensions of characters when they are - displayed or printed. The relationship between these two concepts is a - bit more complex and relate to some design choices made by the font - designer. This is described in more detail in the next sub-section (see - the explanations on the EM square).

+
+

FreeType Glyph + Conventions / II

+
- -

- 2. Vectorial representation -

+
-

The source format of outlines is a collection of closed paths called - contours. Each contour delimits an outer or inner - region of the glyph, and can be made of either line - segments or Bézier arcs.

- -

The arcs are defined through control points, and can be - either second-order (these are conic Béziers) or - third-order (cubic Béziers) polynomials, depending on - the font format. Note that conic Béziers are usually called - quadratic Béziers in the literature. Hence, each point - of the outline has an associated flag indicating its type (normal or - control point). And scaling the points will scale the whole - outline.

- -

Each glyph's original outline points are located on a grid of - indivisible units. The points are usually stored in a font file as - 16-bit integer grid coordinates, with the grid origin's being at (0,0); - they thus range from -16384 to 16383. (Even though point - coordinates can be floats in other formats such as Type 1, we will - restrict our analysis to integer values for simplicity).

- -

The grid is always oriented like the traditional mathematical - two-dimensional plane, i.e., the X axis from the left to the - right, and the Y axis from bottom to top.

- -

In creating the glyph outlines, a type designer uses an imaginary - square called the EM square. Typically, the EM square can be - thought of as a tablet on which the characters are drawn. The square's - size, i.e., the number of grid units on its sides, is very important for - two reasons:

- -
    -
  • -

    It is the reference used to scale the outlines to a given text - dimension. For example, a size of 12pt at 300x300 dpi - corresponds to 12*300/72 = 50 pixels. This is the - size the EM square would appear on the output device if it was - rendered directly. In other words, scaling from grid units to - pixels uses the formula:

    - -

    - pixel_size = point_size * resolution / 72
    - pixel_coord = grid_coord * pixel_size / EM_size -

    -
  • -
  • -

    The greater the EM size is, the larger resolution the designer - can use when digitizing outlines. For example, in the extreme - example of an EM size of 4 units, there are only 25 point - positions available within the EM square which is clearly not - enough. Typical TrueType fonts use an EM size of 2048 units; - Type 1 PostScript fonts have a fixed EM size of 1000 grid - units but point coordinates can be expressed as floating values.

    -
  • -
- -

Note that glyphs can freely extend beyond the EM square if the font - designer wants so. The EM is used as a convenience, and is a valuable - convenience from traditional typography.

- -

Grid units are very often called font units or EM - units.

- -

As said before, pixel_size computed in the above formula - does not relate directly to the size of characters on the screen. It - simply is the size of the EM square if it was to be displayed. Each - font designer is free to place its glyphs as it pleases him within the - square. This explains why the letters of the following text have not - the same height, even though they are displayed at the same point size - with distinct fonts: - -

- Comparison of font heights -

- -

As one can see, the glyphs of the Courier family are smaller than - those of Times New Roman, which themselves are slightly smaller than - those of Arial, even though everything is displayed or printed at a size - of 16 points. This only reflects design choices.

+
+
+
+
- -

- 3. Hinting and Bitmap rendering -

+ -

The outline as stored in a font file is called the "master" outline, - as its points coordinates are expressed in font units. Before it can be - converted into a bitmap, it must be scaled to a given size/resolution. - This is done through a very simple transformation, but always creates - undesirable artifacts, e.g. stems of different widths or heights in - letters like "E" or "H".

+
+

II. Glyph Outlines

-

As a consequence, proper glyph rendering needs the scaled points to - be aligned along the target device pixel grid, through an operation - called grid-fitting (often called hinting). One of its - main purposes is to ensure that important widths and heights are - respected throughout the whole font (for example, it is very often - desirable that the "I" and the "T" have their central vertical line of - the same pixel width), as well as to manage features like stems and - overshoots, which can cause problems at small pixel sizes.

+

This section describes the way scalable representations + of glyph images, called outlines, are used by FreeType as + well as client applications.

-

There are several ways to perform grid-fitting properly; most - scalable formats associate some control data or programs with each glyph - outline. Here is an overview:

+

1. Pixels, points and device + resolutions

-
    -
  • -

    explicit grid-fitting

    +

    Though it is a very common assumption when dealing with + computer graphics programs, the physical dimensions of a + given pixel (be it for screens or printers) are not + squared. Often, the output device, be it a screen device + or a printer, exhibits varying resolutions in both + horizontal and vertical directions, and this must be taken + care of when rendering text.

    -

    The TrueType format defines a stack-based virtual machine, for - which programs can be written with the help of more than - 200 opcodes (most of these relating to geometrical operations). - Each glyph is thus made of both an outline and a control program to - perform the actual grid-fitting in the way defined by the font - designer.

    -
  • -
  • -

    implicit grid-fitting (also called hinting)

    +

    It is thus common to define a device's characteristics + through two numbers expressed in dpi (dots per + inch). For example, a printer with a resolution of + 300×600 dpi has 300 pixels per inch in the + horizontal direction, and 600 in the vertical one. The + resolution of a typical computer monitor varies with its + size (10″ and 25″ monitors don't + have the same pixel sizes at 1024×768), and of + course the graphics mode resolution.

    -

    The Type 1 format takes a much simpler approach: Each glyph - is made of an outline as well as several pieces called - hints which are used to describe some important features of - the glyph, like the presence of stems, some width regularities, and - the like. There aren't a lot of hint types, and it is up to the - final renderer to interpret the hints in order to produce a fitted - outline.

    -
  • -
  • -

    automatic grid-fitting

    +

    As a consequence, the size of text is usually given in + points, rather than device-specific pixels. + Points are a physical unit, where 1 point + equals 1/72th of an inch in digital typography. As an + example, most books using the Latin script are printed + with a body text size somewhere between 10 and + 14 points.

    -

    Some formats simply include no control information with each - glyph outline, apart font metrics like the advance width and height. It - is then up to the renderer to "guess" the more interesting features - of the outline in order to perform some decent grid-fitting.

    -
  • -
+

It is thus possible to compute the size of text in pixels + from the size in points with the following formula:

-

The following table summarises the pros and cons of each scheme.

- -
- - - - - - - - +

The resolution is expressed in dpi. Since + horizontal and vertical resolutions may differ, a single + point size usually defines a different text width and + height in pixels.

- - - - - +

The arcs are defined through control points, and + can be either second-order (these are conic + Béziers) or third-order (cubic + Béziers) polynomials, depending on the font format. + Note that conic Béziers are usually called + quadratic Béziers in the literature. + Hence, FreeType associates each point of the outline with + flag to indicate its type (normal or control point). And + scaling the points will scale the whole outline.

- +

The grid is always oriented like the traditional + mathematical two-dimensional plane, i.e., + the X axis goes from the left to the right, + and the Y axis from bottom to top.

+ +

In creating the glyph outlines, a type designer uses an + imaginary square called the EM square. + Typically, the EM square can be thought of as a tablet on + which the characters are drawn. The square's size, i.e., + the number of grid units on its sides, is very important + for two reasons:

- - +

+ pixel_size = point_size * resolution / 72
+ pixel_coord = grid_coord * pixel_size / EM_size +

+ +
  • +

    The greater the EM size is, the larger resolution the + designer can use when digitizing outlines. For + example, in the extreme example of an EM size of + 4 units, there are only 25 point positions + available within the EM square which is clearly not + enough. Typical TrueType fonts use an EM size of + 2048 units; Type 1 or CFF PostScript fonts + traditionally use an EM size of 1000 grid units + (but point coordinates can be expressed as floating + values).

    +
  • + - - +

    Note that glyphs can freely extend beyond the EM square + if the font designer wants so. The EM square is thus just + a convention in traditional typography.

    - +

    As said before, pixel_size computed in the + above formula does not directly relate to the size of + characters on the screen. It simply is the size of the + EM square if it was to be displayed. Each font designer + is free to place its glyphs as it pleases him within the + square. This explains why the letters of the following + text have not the same height, even though they are + displayed at the same point size with distinct + fonts:

    - - -
    - grid-fitting scheme + pixel_size = point_size * resolution / 72
    -
    -
    - advantages -
    -
    -
    - disadvantages -
    -
    -
    - explicit -
    -
    -

    Quality. Excellent results at small sizes are possible. - This is very important for screen display.

    +

    Unlike what is often thought, the ‘size of text + in pixels’ is not directly related to the real + dimensions of characters when they are displayed or + printed. The relationship between these two concepts is + a bit more complex and depend on some design choices + made by the font designer. This is described in more + detail in the next sub-section (see the explanations on + the EM square).

    -

    Consistency. All renderers produce the same glyph - bitmaps.

    -
    -

    Speed. Interpreting bytecode can be slow if the glyph - programs are complex.

    +

    2. Vectorial representation

    -

    Size. Glyph programs can be long.

    +

    The source format of outlines is a collection of closed paths called + contours. Each contour delimits an outer or + inner region of the glyph, and can be made of + either line segments or Bézier + arcs.

    -

    Technical difficulty. - It is extremely difficult to write good hinting - programs. Very few tools available.

    -
    -
    - implicit -
    -
    -

    Size. Hints are usually much smaller than explicit glyph - programs.

    +

    Each glyph's original outline points are located on a + grid of indivisible units. The points are usually stored + in a font file as 16-bit integer grid coordinates, with + the grid's origin being at (0,0); they thus range from + -32768 to 32767. (Even though point coordinates can + be floats in other formats such as Type 1, we will + restrict our analysis to integer values for + simplicity).

    -

    Speed. - Grid-fitting is usually a fast process.

    -
    -

    Quality. Often questionable at small sizes. Better with - anti-aliasing though.

    +
      +
    • +

      It is the reference size used to scale the outlines + to a given text dimension. For example, a size of + 12pt at 300×300 dpi corresponds to + 12*300/72 = 50 pixels. This is the + size the EM square would appear on the output device + if it was rendered directly. In other words, scaling + from grid units to pixels uses the formula:

      -

      Inconsistency. Results can vary between different - renderers, or even distinct versions of the same engine.

      -
    -
    - automatic -
    -
    -

    Size. No need for control information, resulting in - smaller font files.

    +

    Grid units are very often called font units + or EM units.

    -

    Speed. Depends on the grid-fitting algorithm. Usually - faster than explicit grid-fitting.

    -
    -

    Quality. Often questionable at small sizes. Better with - anti-aliasing though.

    +

    + Comparison of font heights +

    -

    Speed. Depends on the grid-fitting algorithm.

    +

    As one can see, the glyphs of the Courier family are + smaller than those of Times New Roman, which themselves + are slightly smaller than those of Arial, even though + everything is displayed or printed at a size of + 16 points. This only reflects design choices.

    -

    Inconsistency. Results can vary between different - renderers, or even distinct versions of the same engine.

    -
    -
    -


    +

    3. Hinting and Bitmap rendering

    -
    - - - - - - -
    - Previous - - Contents - - Next -
    -
    +

    The outline as stored in a font file is called the + ‘master’ outline, as its points coordinates + are expressed in font units. Before it can be converted + into a bitmap, it must be scaled to a given size and + resolution. This is done with a very simple + transformation, but always creates undesirable artifacts, + in particular stems of different widths or heights in + letters like ‘E’ or ‘H’.

    -
    -
    +

    As a consequence, proper glyph rendering needs the scaled + points to be aligned along the target device pixel grid, + through an operation called grid-fitting (often + called hinting). One of its main purposes is to + ensure that important widths and heights are respected + throughout the whole font (for example, it is very often + desirable that the ‘I’ and the ‘T’ + have their central vertical line of the same pixel width), + as well as to manage features like stems and overshoots, + which can cause problems at small pixel sizes.

    + +

    There are several ways to perform grid-fitting properly; + most scalable formats associate some control data or + programs with each glyph outline. Here is an + overview:

    + + + +

    The following table summarizes the pros and cons of each + scheme.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + grid-fitting scheme + + advantages + + disadvantages +
    +

    explicit

    +
    +

    Quality. Excellent results at small sizes + are possible. This is very important for screen + display.

    + +

    Consistency. All renderers produce the + same glyph bitmaps (at least in theory).

    +
    +

    Speed. Interpreting bytecode can be slow + if the glyph programs are complex.

    + +

    Size. Glyph programs can be long.

    + +

    Technical difficulty. It is extremely + difficult to write good hinting programs. Very + few tools available.

    +
    +

    implicit

    +
    +

    Size. Hints are usually much smaller than + explicit glyph programs.

    + +

    Speed. Grid-fitting is usually a fast + process.

    +
    +

    Quality. Often questionable at small + sizes. Better with anti-aliasing though.

    + +

    Inconsistency. Results can vary between + different renderers, or even distinct versions of + the same engine.

    +
    +

    automatic

    +
    +

    Size. No need for control information, + resulting in smaller font files.

    + +

    Speed. Depends on the grid-fitting + algorithm. Usually faster than explicit + grid-fitting.

    +
    +

    Quality. Often questionable at small + sizes. Better with anti-aliasing though.

    + +

    Speed. Depends on the grid-fitting + algorithm.

    + +

    Inconsistency. Results can vary between + different renderers, or even distinct versions + of the same engine.

    +
    + + + + +
    +

    Last update: 07-Dec-2014

    +
    + + + + + + +
    +
    + + + + + + +
    + +
    + + + +
    +
    diff --git a/lib/freetype/docs/glyphs/glyphs-3.html b/lib/freetype/docs/glyphs/glyphs-3.html index 32f367ea0..7793f1b27 100644 --- a/lib/freetype/docs/glyphs/glyphs-3.html +++ b/lib/freetype/docs/glyphs/glyphs-3.html @@ -1,430 +1,519 @@ - - + + + + + content="text/html; charset=utf-8"> + + + - FreeType Glyph Conventions + + + + + + + + + + FreeType Glyph Conventions / III - - -

    - FreeType Glyph Conventions -

    - -

    - Version 2.1 -

    - -

    - Copyright 1998-2000 David Turner (david@freetype.org)
    - Copyright 2000 The FreeType Development Team (devel@freetype.org) -

    - -
    - - -
    - -
    - - - - - - -
    - Previous - - Contents - - Next -
    -
    - -


    - - - -
    -

    - III. Glyph metrics -

    -
    - - -

    - 1. Baseline, pens and layouts -

    - -

    The baseline is an imaginary line that is used to "guide" glyphs when - rendering text. It can be horizontal (e.g. Roman, Cyrillic, Arabic, - etc.) or vertical (e.g. Chinese, Japanese, Korean, etc). Moreover, to - render text, a virtual point, located on the baseline, called the pen - position or origin, is used to locate glyphs.

    - -

    Each layout uses a different convention for glyph placement:

    - -
      -
    • -

      With horizontal layout, glyphs simply "rest" on the baseline. - Text is rendered by incrementing the pen position, either to the - right or to the left.

      - -

      The distance between two successive pen positions is - glyph-specific and is called the advance width. Note that - its value is always positive, even for right-to-left - oriented alphabets, like Arabic. This introduces some differences - in the way text is rendered.

      - -

      The pen position is always placed on the baseline.

      - -

      - horizontal layout -

      -
    • -
    • -

      With a vertical layout, glyphs are centered around the - baseline:

      - -

      - vertical layout -

      -
    • -
    - - -
    -

    - 2. Typographic metrics and bounding boxes -

    - -

    A various number of face metrics are defined for all glyphs in a - given font.

    - -
      -
    • -

      Ascent

      - -

      The distance from the baseline to the highest/upper grid - coordinate used to place an outline point. It is a positive value, - due to the grid's orientation with the Y axis - upwards.

      -
    • - -
    • -

      Descent

      - -

      The distance from the baseline to the lowest grid coordinate used - to place an outline point. This is a negative value, due to the - grid's orientation.

      -
    • - -
    • -

      Linegap

      - -

      The distance that must be placed between two lines of text. The - baseline-to-baseline distance should be computed as: - -

      - ascent - descent + linegap -

      - -

      if you use the typographic values.

      -
    • -
    - -

    Other, simpler metrics are:

    - -
      -
    • -

      The glyph's bounding box, also called bbox

      - -

      This is an imaginary box that encloses all glyphs from the font, - usually as tightly as possible. It is represented by four fields, - namely xMin, yMin, xMax, and - yMax, that can be computed for any outline. Their values - can be in font units (if measured in the original outline) or in - fractional/integer pixel units (when measured on scaled - outlines).

      - -

      Note that if it wasn't for grid-fitting, you wouldn't need to - know a box's complete values, but only its dimensions to know how - big is a glyph outline/bitmap. However, correct rendering of hinted - glyphs needs the preservation of important grid alignment on each - glyph translation/placement on the baseline.

      -
    • - -
    • -

      Internal leading

      - -

      This concept comes directly from the world of traditional - typography. It represents the amount of space within the - leading which is reserved for glyph features that lay - outside of the EM square (like accentuation). It usually can be - computed as:

      - -

      - internal leading = ascent - descent - EM_size -

      -
    • - -
    • -

      External leading

      - -

      This is another name for the line gap.

      -
    • -
    - - -
    -

    - 3. Bearings and Advances -

    - - Each glyph has also distances called bearings and - advances. Their definition is constant, but their values - depend on the layout, as the same glyph can be used to render text - either horizontally or vertically: - -
      -
    • -

      Left side bearing or bearingX

      - -

      The horizontal distance from the current pen position to the - glyph's left bbox edge. It is positive for horizontal layouts, and - in most cases negative for vertical ones.

      -
    • - -
    • -

      Top side bearing or bearingY

      - -

      The vertical distance from the baseline to the top of the glyph's - bbox. It is usually positive for horizontal layouts, and negative - for vertical ones.

      -
    • - -
    • -

      Advance width or advanceX

      - -

      The horizontal distance the pen position must be incremented (for - left-to-right writing) or decremented (for right-to-left writing) by - after each glyph is rendered when processing text. It is always - positive for horizontal layouts, and null for vertical ones.

      -
    • - -
    • -

      Advance height advanceY

      - -

      The vertical distance the pen position must be decremented by - after each glyph is rendered. It is always null for horizontal - layouts, and positive for vertical layouts.

      -
    • - -
    • -

      Glyph width

      - -

      The glyph's horizontal extent. For unscaled font coordinates, it - is bbox.xMax-bbox.xMin. For scaled glyphs, its computation - requests specific care, described in the grid-fitting chapter - below.

      -
    • - -
    • -

      Glyph height - -

      The glyph's vertical extent. For unscaled font coordinates, it is - bbox.yMax-bbox.yMin. For scaled glyphs, its computation - requests specific care, described in the grid-fitting chapter - below.

      -
    • - -
    • -

      Right side bearing

      - -

      Only used for horizontal layouts to describe the distance from - the bbox's right edge to the advance width. It is in most cases a - non-negative number:

      - -

      - advance_width - left_side_bearing - (xMax-xMin) -

      -
    • -
    - -

    Here is a picture giving all the details for horizontal metrics: - -

    - horizontal glyph metrics -

    - -

    And here is another one for the vertical metrics:

    - -

    - vertical glyph metrics -

    - - -
    -

    - 4. The effects of grid-fitting -

    - -

    Because hinting aligns the glyph's control points to the pixel grid, - this process slightly modifies the dimensions of character images in - ways that differ from simple scaling.

    - -

    For example, the image of the lowercase "m" letter sometimes fits a - square in the master grid. However, to make it readable at small pixel - sizes, hinting tends to enlarge its scaled outline in order to keep its - three legs distinctly visible, resulting in a larger character - bitmap.

    - -

    The glyph metrics are also influenced by the grid-fitting process: - -

      -
    • - The image's width and height are altered. Even if this is only by - one pixel, it can make a big difference at small pixel sizes. -
    • -
    • - The image's bounding box is modified, thus modifying the bearings. -
    • -
    • - The advances must be updated. For example, the advance width must - be incremented if the hinted bitmap is larger than the scaled one, - to reflect the augmented glyph width. -
    • -
    - -

    This has some implications:

    - -
      -
    • - Because of hinting, simply scaling the font ascent or descent might - not give correct results. A possible solution is to keep the ceiling - of the scaled ascent, and floor of the scaled descent. -
    • - -
    • - There is no easy way to get the hinted glyph and advance widths of a - range of glyphs, as hinting works differently on each outline. The - only solution is to hint each glyph separately and record the - returned values. Some formats, like TrueType, even include a table - of pre-computed values for a small set of common character pixel - sizes. -
    • -
    • - Hinting depends on the final character width and height in pixels, - which means that it is highly resolution-dependent. This property - makes correct WYSIWYG layouts difficult to implement. -
    • -
    - - - -

    Performing 2D transformations on glyph outlines is very easy with - FreeType. However, when using translation on a hinted outlines, one - should aways take care of exclusively using integer pixel - distances (which means that the parameters to the - FT_Outline_Translate() API should all be multiples - of 64, as the point coordinates are in 26.6 fixed-point - format).

    - -

    Otherwise, the translation will simply ruin the hinter's - work, resulting in a very low quality bitmaps!

    -
    - - -
    -

    - 5. Text widths and bounding box -

    - -

    As seen before, the "origin" of a given glyph corresponds to the - position of the pen on the baseline. It is not necessarily located on - one of the glyph's bounding box corners, unlike many typical bitmapped - font formats. In some cases, the origin can be out of the bounding box, - in others, it can be within it, depending on the shape of the given - glyph.

    - -

    Likewise, the glyph's "advance width" is the increment to apply to - the pen position during layout, and is not related to the glyph's - "width", which really is the glyph's bounding width. - -

    The same conventions apply to strings of text. This means that: - -

      -
    • - The bounding box of a given string of text doesn't necessarily - contain the text cursor, nor is the latter located on one of its - corners. -
    • - -
    • - The string's advance width isn't related to its bounding box - dimensions. Especially if it contains beginning and terminal spaces - or tabs. -
    • -
    • - Finally, additional processing like kerning creates strings of text - whose dimensions are not directly related to the simple - juxtaposition of individual glyph metrics. For example, the advance - width of "VA" isn't the sum of the advances of "V" and "A" taken - separately. -
    • -
    - -


    - -
    - - - - - - -
    - Previous - - Contents - - Next -
    -
    - -
    -
    + + + +
    +

    FreeType Glyph + Conventions / III

    +
    + + +
    + +
    +
    +
    +
    + + + + +
    +

    III. Glyph Metrics

    + +

    1. Baseline, pens and layouts

    + +

    The baseline is an imaginary line that is used to + ‘guide’ glyphs when rendering text. It can be + horizontal (e.g. Latin, Cyrillic, Arabic, etc.) or + vertical (e.g. Chinese, Japanese, Mongolian, etc.). + Moreover, to render text, a virtual point, located on the + baseline, called the pen position + or origin, is used to locate glyphs.

    + +

    Each layout uses a different convention for glyph + placement:

    + +
      +
    • +

      With horizontal layout, glyphs simply + ‘rest’ on the baseline. Text is rendered + by incrementing the pen position, either to the right + or to the left.

      + +

      The distance between two successive pen positions is + glyph-specific and is called the advance + width. Note that its value is always + positive, even for right-to-left oriented scripts like + Arabic. This introduces some differences in the way + text is rendered.

      + +

      The pen position is always placed on the + baseline.

      + +

      + horizontal layout +

      +
    • +
    • +

      With a vertical layout, glyphs are centered around + the baseline:

      + +

      + vertical layout +

      +
    • +
    + + +

    2. Typographic metrics and bounding + boxes

    + +

    A various number of face metrics are defined for all + glyphs in a given font.

    + +
      +
    • +

      Ascent

      + +

      The distance from the baseline to the highest or + upper grid coordinate used to place an outline point. + It is a positive value, due to the grid's orientation + with the Y axis upwards.

      +
    • +
    • +

      Descent

      + +

      The distance from the baseline to the lowest grid + coordinate used to place an outline point. In + FreeType, this is a negative value, due to the grid's + orientation. Note that in some font formats this is a + positive value.

      +
    • +
    • +

      Linegap

      + +

      The distance that must be placed between two lines of + text. The baseline-to-baseline distance should be + computed as + +

      + linespace = ascent - descent + linegap +

      + +

      if you use the typographic values.

      +
    • +
    + +

    Other, simpler metrics are:

    + +
      +
    • +

      Bounding box

      + +

      This is an imaginary box that encloses all glyphs + from the font, usually as tightly as possible. It is + represented by four parameters, + namely xMin, yMin, xMax, + and yMax, that can be computed for any + outline. Their values can be in font units if + measured in the original outline, or in integer (or + fractional) pixel units when measured on scaled + outlines.

      + +

      A common shorthand for the bounding box is + ‘bbox’.

      +
    • +
    • +

      Internal leading

      + +

      This concept comes directly from the world of traditional + typography. It represents the amount of space within the + leading which is reserved for glyph features + that lay outside of the EM square (like accentuation). + It usually can be computed as

      + +

      + internal leading = ascent - descent - EM_size +

      +
    • +
    • +

      External leading

      + +

      This is another name for the line gap.

      +
    • +
    + + +

    3. Bearings and Advances

    + +

    Each glyph has also distances called bearings and + advances. The actual values depend on the + layout, as the same glyph can be used to render text + either horizontally or vertically:

    + +
      +
    • +

      Left side bearing

      + +

      The horizontal distance from the current pen position + to the glyph's left bbox edge. It is positive for + horizontal layouts, and in most cases negative for + vertical ones.

      + +

      In the FreeType API, this is also called + bearingX. Another shorthand is + ‘lsb’.

      +
    • +
    • +

      Top side bearing

      + +

      The vertical distance from the baseline to the top of + the glyph's bbox. It is usually positive for + horizontal layouts, and negative for vertical + ones.

      + +

      In the FreeType API, this is also called + bearingY.

      +
    • +
    • +

      Advance width

      + +

      The horizontal distance to increment (for + left-to-right writing) or decrement (for right-to-left + writing) the pen position after a glyph has been + rendered when processing text. It is always positive + for horizontal layouts, and zero for vertical + ones.

      + +

      In the FreeType API, this is also called + advanceX.

      +
    • +
    • +

      Advance height

      + +

      The vertical distance to decrement the pen position + after a glyph has been rendered. It is always zero + for horizontal layouts, and positive for vertical + layouts.

      + +

      In the FreeType API, this is also called + advanceY.

      +
    • +
    • +

      Glyph width

      + +

      The glyph's horizontal extent. For unscaled font + coordinates, it is

      + +

      + glyph width = bbox.xMax - bbox.xMin +

      + +

      For scaled glyphs, its computation requests specific + care, described in the grid-fitting chapter below.

      +
    • +
    • +

      Glyph height

      + +

      The glyph's vertical extent. For unscaled font + coordinates, it is

      + +

      + glyph height = bbox.yMax - bbox.yMin +

      + +

      For scaled glyphs, its computation requests specific + care, described in the grid-fitting chapter below.

      +
    • +
    • +

      Right side bearing

      + +

      Only used for horizontal layouts to describe the + distance from the bbox's right edge to the advance + width. In most cases it is a non-negative number:

      + +

      + right side bearing = advance_width - + left_side_bearing - (xMax-xMin) +

      + +

      A common shorthand for this value is + ‘rsb’.

      +
    • +
    + +

    Here is a picture giving all the details for horizontal metrics: + +

    + horizontal glyph metrics +

    + +

    And here is another one for the vertical metrics:

    + +

    + vertical glyph metrics +

    + + +

    4. The effects of grid-fitting

    + +

    Because hinting aligns the glyph's control points to the + pixel grid, this process slightly modifies the dimensions + of character images in ways that differ from simple + scaling.

    + +

    For example, the image of the lowercase ‘m’ + letter sometimes fits a square in the master grid. + However, to make it readable at small pixel sizes, hinting + tends to enlarge its scaled outline horizontally in order + to keep its three legs distinctly visible, resulting in a + wider character bitmap.

    + +

    The glyph metrics are also influenced by the grid-fitting + process:

    + +
      +
    • +

      The image's width and height are altered. Even if + this is only by one pixel, it can make a big + difference at small pixel sizes.

      +
    • +
    • +

      The image's bounding box is modified, thus modifying + the bearings.

      +
    • +
    • +

      The advances must be updated. For example, the + advance width must be incremented if the hinted bitmap + is larger than the scaled one, to reflect the + augmented glyph width.

      +
    • +
    + +

    This has some implications:

    + +
      +
    • +

      Because of hinting, simply scaling the font ascent or + descent might not give correct results. A possible + solution is to keep the ceiling of the scaled ascent, + and floor of the scaled descent.

      +
    • +
    • +

      There is no easy way to get the hinted glyph and + advance widths of a range of glyphs, as hinting works + differently on each outline. The only solution is to + hint each glyph separately and record the returned + values (for example in a cache). Some formats, like + TrueType, even include a table of pre-computed values + for a small set of common character pixel sizes.

      +
    • +
    • +

      Hinting depends on the final character width and + height in pixels, which means that it is highly + resolution-dependent. This property makes correct + WYSIWYG layouts difficult to implement.

      +
    • +
    + +

    Performing 2D transformations on glyph outlines is very + easy with FreeType. However, when using translation on + hinted outlines, one should always take care + of exclusively using integer pixel distances (which + means that the parameters to the + FT_Outline_Translate API function should all be + multiples of 64, as the point coordinates are in + 26.6 fixed-point format). Otherwise, the translation + will simply ruin the hinter's work, resulting in + very low quality bitmaps!

    + + +

    5. Text widths and bounding box

    + +

    As seen before, the ‘origin’ of a given glyph + corresponds to the position of the pen on the baseline. + It is not necessarily located on one of the glyph's + bounding box corners, unlike many typical bitmapped font + formats. In some cases, the origin can be out of the + bounding box, in others, it can be within it, depending on + the shape of the given glyph.

    + +

    Likewise, the glyph's ‘advance width’ is the + increment to apply to the pen position during layout, and + is not related to the glyph's ‘width’, which + really is the glyph's bounding width.

    + +

    The same conventions apply to strings of text. This + means that:

    + +
      +
    • +

      The bounding box of a given string of text doesn't + necessarily contain the text cursor, nor is the latter + located on one of its corners.

      +
    • +
    • +

      The string's advance width isn't related to its + bounding box dimensions. Especially if it contains + beginning and terminal spaces or tabs.

      +
    • +
    • +

      Finally, additional processing like kerning creates + strings of text whose dimensions are not directly + related to the simple juxtaposition of individual + glyph metrics. For example, the advance width of + ‘VA’ isn't the sum of the advances of + ‘V’ and ‘A’ taken + separately.

      +
    • +
    +
    + + + +
    +

    Last update: 07-Dec-2014

    +
    +
    +
    + + + + +
    +
    +
    +
    + + + + +
    + +
    + +
    + +
    +
    diff --git a/lib/freetype/docs/glyphs/glyphs-4.html b/lib/freetype/docs/glyphs/glyphs-4.html index 669ce63da..70e0bda08 100644 --- a/lib/freetype/docs/glyphs/glyphs-4.html +++ b/lib/freetype/docs/glyphs/glyphs-4.html @@ -1,231 +1,284 @@ - - + + + + + content="text/html; charset=utf-8"> + + + - FreeType Glyph Conventions + + + + + + + + + + FreeType Glyph Conventions / IV - -

    - FreeType Glyph Conventions -

    + -

    - Version 2.1 -

    - -

    - Copyright 1998-2000 David Turner (david@freetype.org)
    - Copyright 2000 The FreeType Development Team (devel@freetype.org) -

    - -
    - - -
    - -
    - - - - - - -
    - Previous - - Contents - - Next -
    -
    - -


    - - - -
    -

    - IV. Kerning -

    -
    - -

    The term kerning refers to specific information used to - adjust the relative positions of coincident glyphs in a string of text. - This section describes several types of kerning information, as well as - the way to process them when performing text layout.

    +
    +

    FreeType Glyph + Conventions / IV

    +
    - -

    - 1. Kerning pairs -

    +
    -

    Kerning consists of modifying the spacing between two successive - glyphs according to their outlines. For example, a "T" and a "y" can be - easily moved closer, as the top of the "y" fits nicely under the upper - right bar of the "T".

    - -

    When laying out text with only their standard widths, some - consecutive glyphs seem a bit too close or too distant. For example, - the space between the "A" and the "V" in the following word seems a - little wider than needed.

    - -

    - the word 'bravo' unkerned -

    - -

    Compare this to the same word, where the distance between these two - letters has been slightly reduced:

    - -

    - the word 'bravo' with kerning -

    - -

    As you can see, this adjustment can make a great difference. Some - font faces thus include a table containing kerning distances for a set - of given glyph pairs for text layout.

    - -
      -
    • -

      The pairs are ordered, i.e., the space for pair (A,V) isn't - necessarily the space for pair (V,A). They also index glyphs, and - not characters.

      -
    • -
    • -

      Kerning distances can be expressed in horizontal or vertical - directions, depending on layout and/or script. For example, some - horizontal layouts like Arabic can make use of vertical kerning - adjustments between successive glyphs. A vertical script can have - vertical kerning distances.

      -
    • -
    • -

      Kerning distances are expressed in grid units. They are usually - oriented in the X axis, which means that a negative - value indicates that two glyphs must be set closer in a horizontal - layout.

      -
    • -
    +
    +
    +
    +
    - -

    - 2. Applying kerning -

    + -

    Applying kerning when rendering text is a rather easy process. It - merely consists in adding the scaled kern distance to the pen position - before writing each next glyph. However, the typographically correct - renderer must take a few more details in consideration.

    +
    +

    IV. Kerning

    -

    The "sliding dot" problem is a good example: Many font faces include - a kerning distance between capital letters like "T" or "F" and a - following dot ("."), in order to slide the latter glyph just right to - their main leg:

    - -

    - example for sliding dots -

    - -

    This sometimes requires additional adjustments between the dot and - the letter following it, depending on the shapes of the enclosing - letters. When applying "standard" kerning adjustments, the previous - sentence would become:

    - -

    - example for too much kerning -

    - -

    This is clearly too contracted. The solution here, as exhibited in - the first example, is to only slide the dots when possible. Of course, - this requires a certain knowledge of the text's meaning. The above - adjustments would not necessarily be welcome if we were rendering the - final dot of a given paragraph.This is only one example, and there are many others showing that a - real typographer is needed to layout text properly. If not available, - some kind of user interaction or tagging of the text could be used to - specify some adjustments, but in all cases, this requires some support - in applications and text libraries.

    - -

    For more mundane and common uses, however, we can have a very simple - algorithm, which avoids the sliding dot problem, and others, though not - producing optimal results. It can be seen as

    - -
      -
    1. - Place the first glyph on the baseline. -
    2. -
    3. - Save the location of the pen position/origin in pen1. -
    4. -
    5. - Adjust the pen position with the kerning distance between the first - and second glyph. -
    6. -
    7. - Place the second glyph and compute the next pen position/origin in - pen2. -
    8. -
    9. - Use pen1 as the next pen position if it is beyond - pen2, use pen2 otherwise. -
    10. -
    +

    The term kerning refers to specific information + used to adjust the relative positions of successive glyphs + in a string of text. This section describes several types + of kerning information, as well as the way to process them + when performing text layout.

    -


    +

    1. Kerning pairs

    -
    - - - - - - -
    - Previous - - Contents - - Next -
    -
    +

    Kerning consists of modifying the spacing between two + successive glyphs according to their outlines. For + example, a ‘T’ and a ‘y’ can be + easily moved closer, as the top of the ‘y’ + fits nicely under the upper right bar of the + ‘T’.

    -
    -
    +

    When laying out text with only their standard widths, + some consecutive glyphs seem a bit too close or too + distant. For example, the space between the + ‘A’ and the ‘V’ in the following + word seems a little wider than needed.

    + +

    + the word 'bravo' unkerned +

    + +

    Compare this to the same word, where the distance between + these two letters has been slightly reduced:

    + +

    + the word 'bravo' with kerning +

    + +

    As you can see, this adjustment can make a great + difference. Some font faces thus include a table + containing kerning distances for a set of given glyph + pairs for text layout.

    + + + +

    Note that OpenType fonts (OTF) provide two distinct + mechanisms for kerning, using the ‘kern’ and + ‘GPOS’ tables, respectively, which are part of + the OTF files. Older fonts only contain the former, while + recent fonts contain both tables or even + ‘GPOS’ data only. FreeType only supports + kerning via the (rather simple) ‘kern’ table. + For the interpretation of kerning data in the (highly + sophisticated) ‘GPOS’ table you need a + higher-level library + like ICU or + HarfBuzz since it can be + context dependent (this is, the kerning may vary depending + on the position within a text string, for example).

    + + +

    2. Applying kerning

    + +

    Applying kerning when rendering text is a rather easy + process. It merely consists in adding the scaled kern + distance to the pen position before rendering the next + glyph. However, the typographically correct renderer must + take a few more details in consideration.

    + +

    The ‘sliding dot’ problem is a good example: + Many font faces include a kerning distance between capital + letters like ‘T’ or ‘F’ and a + following dot (‘.’), in order to slide the + latter glyph just right to their main leg.

    + +

    + example for sliding dots +

    + +

    This sometimes requires additional adjustments between + the dot and the letter following it, depending on the + shapes of the enclosing letters. When applying + ‘standard’ kerning adjustments, the previous + sentence would become

    + +

    + example for too much kerning +

    + +

    This is clearly too contracted. The solution here, as + exhibited in the first example, is to only slide the dots + if the conditions fit. Of course, this requires a certain + knowledge of the text's meaning, and this is exactly what + ‘GPOS’ kerning is good for: Depending on the + context, different kerning values can be applied to get a + typographically correct result.

    + + + + +
    +

    Last update: 07-Dec-2014

    +
    + + + + + + +
    +
    + + + + + + +
    + +
    + + + +
    +
    diff --git a/lib/freetype/docs/glyphs/glyphs-5.html b/lib/freetype/docs/glyphs/glyphs-5.html index 65f2de441..0a12e0359 100644 --- a/lib/freetype/docs/glyphs/glyphs-5.html +++ b/lib/freetype/docs/glyphs/glyphs-5.html @@ -1,484 +1,464 @@ - - + + + + + content="text/html; charset=utf-8"> + + + - FreeType Glyph Conventions + + + + + + + + + + FreeType Glyph Conventions / V - -

    - FreeType Glyph Conventions -

    + -

    - Version 2.1 -

    - -

    - Copyright 1998-2000 David Turner (david@freetype.org)
    - Copyright 2000 The FreeType Development Team (devel@freetype.org) -

    - -
    - - -
    - -
    - - - - - - -
    - Previous - - Contents - - Next -
    -
    - -


    - - - -
    -

    - V. Text processing -

    -
    - -

    This section demonstrates how to use the concepts previously defined - to render text, whatever the layout you use.

    +
    +

    FreeType Glyph + Conventions / V

    +
    - -

    - 1. Writing simple text strings -

    +
    -

    In this first example, we will generate a simple string of Roman - text, i.e. with a horizontal left-to-right layout. Using exclusively - pixel metrics, the process looks like: - - -

      -
    1. - Convert the character string into a series of glyph - indices. -
    2. -
    3. - Place the pen to the cursor position. -
    4. -
    5. - Get or load the glyph image. -
    6. -
    7. - Translate the glyph so that its 'origin' matches the pen position. -
    8. -
    9. - Render the glyph to the target device. -
    10. -
    11. - Increment the pen position by the glyph's advance width in pixels. -
    12. -
    13. - Start over at step 3 for each of the remaining glyphs. -
    14. -
    15. - When all glyphs are done, set the text cursor to the new pen - position. -
    16. -
    - - -

    Note that kerning isn't part of this algorithm.

    +
    +
    +
    +
    - -

    - 2. Sub-pixel positioning -

    + -

    It is somewhat useful to use sub-pixel positioning when rendering - text. This is crucial, for example, to provide semi-WYSIWYG text - layouts. Text rendering is very similar to the algorithm described in - subsection 1, with the following few differences:

    +
    +

    V. Text Processing

    -
    -
    + + +

    Here the algorithm:

    + +
      +
    1. + Convert the character string into a series of glyph + indices. +
    2. +
    3. + Place the pen to the cursor position. +
    4. +
    5. + Get or load the glyph image. +
    6. +
    7. + Translate the glyph so that its ‘origin’ + matches the pen position. +
    8. +
    9. + Render the glyph to the target device. +
    10. +
    11. + Decrement the vertical pen position by the glyph's + advance height in pixels. +
    12. +
    13. + Start over at step 3 for each of the remaining + glyphs. +
    14. +
    15. + When all glyphs are done, set the text cursor to the new + pen position. +
    16. +
    + + + + +
    +

    Last update: 07-Dec-2014

    +
    + + + + + + +
    +
    + + + + + + +
    + +
    + + + +
    +
    diff --git a/lib/freetype/docs/glyphs/glyphs-6.html b/lib/freetype/docs/glyphs/glyphs-6.html index 30bd4af02..5c5e745c5 100644 --- a/lib/freetype/docs/glyphs/glyphs-6.html +++ b/lib/freetype/docs/glyphs/glyphs-6.html @@ -1,452 +1,537 @@ - - + + + + + content="text/html; charset=utf-8"> + + + - FreeType Glyph Conventions + + + + + + + + + + FreeType Glyph Conventions / VI - -

    - FreeType Glyph Conventions -

    + -

    - Version 2.1 -

    - -

    - Copyright 1998-2000 David Turner (david@freetype.org)
    - Copyright 2000, 2006, 2011 The FreeType Development Team (devel@freetype.org) -

    - -
    - - -
    - -
    - - - - - - -
    - Previous - - Contents - - Next -
    -
    - -


    - - - -
    -

    - VI. FreeType outlines -

    -
    - -

    The purpose of this section is to present the way FreeType manages - vectorial outlines, as well as the most common operations that can be - applied on them.

    - - -

    - 1. FreeType outline description and structure -

    - -

    - a. Outline curve decomposition -

    - -

    An outline is described as a series of closed contours in the 2D - plane. Each contour is made of a series of line segments and - Bézier arcs. Depending on the file format, these can be - second-order or third-order polynomials. The former are also called - quadratic or conic arcs, and they are used in the TrueType format. - The latter are called cubic arcs and are mostly used in the - Type 1 format.

    - -

    Each arc is described through a series of start, end, and control - points. Each point of the outline has a specific tag which indicates - whether it is used to describe a line segment or an arc. The tags can - take the following values:

    - -
    - - - - - - - - - - - - - - - -
    - FT_CURVE_TAG_ON - -

    Used when the point is "on" the curve. This corresponds to - start and end points of segments and arcs. The other tags specify - what is called an "off" point, i.e. a point which isn't located on - the contour itself, but serves as a control point for a - Bézier arc.

    -
    - FT_CURVE_TAG_CONIC - -

    Used for an "off" point used to control a conic Bézier - arc.

    -
    - FT_CURVE_TAG_CUBIC - -

    Used for an "off" point used to control a cubic Bézier - arc.

    -
    -
    - -

    Use the FT_CURVE_TAG(tag) macro to filter out other, - internally used flags. - -

    The following rules are applied to decompose the contour's points - into segments and arcs:

    - -
      -
    • - Two successive "on" points indicate a line segment joining them. -
    • -
    • - One conic "off" point amidst two "on" points indicates a conic - Bézier arc, the "off" point being the control point, and - the "on" ones the start and end points. -
    • -
    • - Two successive cubic "off" points amidst two "on" points indicate - a cubic Bézier arc. There must be exactly two cubic - control points and two "on" points for each cubic arc (using a - single cubic "off" point between two "on" points is forbidden, for - example). -
    • -
    • - Two successive conic "off" points forces the rasterizer to create - (during the scan-line conversion process exclusively) a virtual - "on" point amidst them, at their exact middle. This greatly - facilitates the definition of successive conic Bézier arcs. - Moreover, it is the way outlines are described in the TrueType - specification. -
    • -
    • - The last point in a contour uses the first as an end point to - create a closed contour. For example, if the last two points of a - contour were an "on" point followed by a conic "off" point, the - first point in the contour would be used as final point to create - an "on" – "off" – "on" sequence as described above. -
    • -
    • - The first point in a contour can be a conic "off" point itself; in - that case, use the last point of the contour as the contour's - starting point. If the last point is a conic "off" point itself, - start the contour with the virtual "on" point between the last and - first point of the contour. -
    • -
    - -

    Note that it is possible to mix conic and cubic arcs in a single - contour, even though no current font driver produces such - outlines.

    - -
    - - - - - - - - - -
    - segment example - - conic arc example -
    - cubic arc example - - cubic arc with virtual 'on' point -
    -
    +
    +

    FreeType Glyph + Conventions / VI

    +
    -

    - b. Outline descriptor -

    +
    -

    A FreeType outline is described through a simple structure:

    - -
    - - - - - - - - - - - - - - - - - - - - - - - -
    - FT_Outline -
    - n_points - - the number of points in the outline -
    - n_contours - - the number of contours in the outline -
    - points - - array of point coordinates -
    - contours - - array of contour end indices -
    - tags - - array of point flags -
    -
    - -

    Here, points is a pointer to an array of - FT_Vector records, used to store the vectorial coordinates of - each outline point. These are expressed in 1/64th of a pixel, which - is also known as the 26.6 fixed-point format.

    - -

    contours is an array of point indices used to delimit - contours in the outline. For example, the first contour always starts - at point 0, and ends at point contours[0]. The second - contour starts at point contours[0]+1 and ends at - contours[1], etc. To traverse these points in a callback - based manner, use FT_Outline_Decompose().

    - -

    Note that each contour is closed, and that n_points should - be equal to contours[n_contours-1]+1 for a valid outline.

    - -

    Finally, tags is an array of bytes, used to store each - outline point's tag.

    +
    +
    +
    +
    - -

    - 2. Bounding and control box computations -

    + -

    A bounding box (also called bbox) is simply a - rectangle that completely encloses the shape of a given outline. The - interesting case is the smallest bounding box possible, and in the - following we subsume this under the term "bounding box". Because of the - way arcs are defined, Bézier control points are not necessarily - contained within an outline's (smallest) bounding box.

    +
    +

    VI. FreeType outlines

    -

    This situation happens when one Bézier arc is, for example, - the upper edge of an outline and an "off" point happens to be above the - bbox. However, it is very rare in the case of character outlines - because most font designers and creation tools always place "on" points - at the extrema of each curved edges, as it makes hinting much - easier.

    +

    The purpose of this section is to present the way + FreeType manages vectorial outlines, as well as the most + common operations that can be applied on them.

    -

    We thus define the control box (also called cbox) - as the smallest possible rectangle that encloses all points of a given - outline (including its "off" points). Clearly, it always includes the - bbox, and equates it in most cases.

    +

    1. FreeType outline description and + structure

    -

    Unlike the bbox, the cbox is much faster to compute.

    +

    a. Outline curve decomposition

    -
    - - - - - -
    - a glyph with different bbox and cbox - - a glyph with identical bbox and cbox -
    -
    +

    An outline is described as a series of closed contours in + the 2D plane. Each contour is made of a series of line + segments and Bézier arcs. Depending on the file + format, these can be second-order or third-order + polynomials. The former are also called quadratic or + conic arcs, and they are used in the TrueType format. The + latter are called cubic arcs and are mostly used in the + PostScript Type 1 and Type formats.

    -

    Control and bounding boxes can be computed automatically through the - functions FT_Outline_Get_CBox() and - FT_Outline_Get_BBox(). The former function is always very - fast, while the latter may be slow in the case of "outside" - control points (as it needs to find the extreme of conic and cubic arcs - for "perfect" computations). If this isn't the case, it is as fast as - computing the control box. +

    Each arc is described through a series of start, end, and + control points. Each point of the outline has a specific + tag which indicates whether it is describes a line segment + or an arc. The tags can take the following values:

    -

    Note also that even though most glyph outlines have equal cbox and - bbox to ease hinting, this is not necessary the case anymore when a - transformation like rotation is applied to them.

    + + + + + + + + + + + + + +
    +

    FT_CURVE_TAG_ON

    +
    +

    Used when the point is ‘on’ the curve. + This corresponds to start and end points of segments + and arcs. The other tags specify what is called an + ‘off’ point, i.e., a point which isn't + located on the contour itself, but serves as a + control point for a Bézier arc.

    +
    +

    FT_CURVE_TAG_CONIC

    +
    +

    Used for an ‘off’ point used to control + a conic Bézier arc.

    +
    +

    FT_CURVE_TAG_CUBIC

    +
    +

    Used for an ‘off’ point used to control + a cubic Bézier arc.

    +
    + +

    Use the FT_CURVE_TAG(tag) macro to filter out + other, internally used flags. + +

    The following rules are applied to decompose the + contour's points into segments and arcs:

    + +
      +
    • +

      Two successive ‘on’ points indicate a + line segment joining them.

      +
    • +
    • +

      One conic ‘off’ point between two + ‘on’ points indicates a conic + Bézier arc, the ‘off’ point being + the control point, and the ‘on’ ones the + start and end points.

      +
    • +
    • +

      Two successive cubic ‘off’ points between + two ‘on’ points indicate a cubic + Bézier arc. There must be exactly two cubic + control points and two ‘on’ points for + each cubic arc (using a single cubic ‘off’ + point between two ‘on’ points is + forbidden, for example).

      +
    • +
    • +

      Two successive conic ‘off’ points force + the rasterizer to create (during the scan-line + conversion process exclusively) a virtual + ‘on’ point inbetween, at their exact + middle. This greatly facilitates the definition of + successive conic Bézier arcs. Moreover, it is + the way outlines are described in the TrueType + specification.

      +
    • +
    • +

      The last point in a contour uses the first as an end + point to create a closed contour. For example, if the + last two points of a contour were an ‘on’ + point followed by a conic ‘off’ point, the + first point in the contour would be used as final + point to create an ‘on’ – + ‘off’ – ‘on’ sequence as + described above. +

    • +
    • +

      The first point in a contour can be a conic + ‘off’ point itself; in that case, use the + last point of the contour as the contour's starting + point. If the last point is a conic ‘off’ + point itself, start the contour with the virtual + ‘on’ point between the last and first + point of the contour. +

    • +
    + +

    Note that it is possible to mix conic and cubic arcs in a + single contour, however, no font driver of FreeType + produces such outlines currently.

    + + + + + + + + + + +
    + segment example + + conic arc example +
    + cubic arc example + + cubic arc with virtual 'on' point +
    -
    -

    - 3. Coordinates, scaling and grid-fitting -

    +

    b. The FT_Outline descriptor

    + +

    A FreeType outline is described through a simple + structure + called FT_Outline. + Right now, the following fields are of interest:

    -

    An outline point's vectorial coordinates are expressed in the - 26.6 format, i.e. in 1/64th of a pixel, hence the coordinates - (1.0,-2.5) is stored as the integer pair (x:64,y:-192).

    + + + + + + + + + + + + + + + + + + + + + + + + +
    + FT_Outline +
    + n_points + + the number of points in the outline +
    + n_contours + + the number of contours in the outline +
    + points + + array of point coordinates +
    + contours + + array of contour end indices +
    + tags + + array of point flags +
    + +

    Here, points is a pointer to an array of + FT_Vector + records, used to store the vectorial coordinates of each + outline point. These are expressed in 1/64th of a pixel, + which is also known as the 26.6 fixed-point + format.

    -

    After a master glyph outline is scaled from the EM grid to the - current character dimensions, the hinter or grid-fitter is in charge of - aligning important outline points (mainly edge delimiters) to the pixel - grid. Even though this process is much too complex to be described in a - few lines, its purpose is mainly to round point positions, while trying - to preserve important properties like widths, stems, etc.

    +

    contours is an array of point indices to delimit + contours in the outline. For example, the first contour + always starts at point 0, and ends at + point contours[0]. The second contour starts at + point contours[0]+1 and ends at + contours[1], etc. To traverse these points in a + callback based manner, + use FT_Outline_Decompose.

    -

    The following operations can be used to round vectorial distances in - the 26.6 format to the grid:

    +

    Note that each contour is closed, and that value + of n_points should be equal + to contours[n_contours-1]+1 for a valid + outline.

    -
    -    round( x )   == ( x + 32 ) & -64
    -    floor( x )   ==          x & -64
    -    ceiling( x ) == ( x + 63 ) & -64
    - -

    Once a glyph outline is grid-fitted or transformed, it often is - interesting to compute the glyph image's pixel dimensions before - rendering it. To do so, one has to consider the following:

    - -

    The scan-line converter draws all the pixels whose centers - fall inside the glyph shape. It can also detect drop-outs, - i.e. discontinuities coming from extremely thin shape fragments, in - order to draw the "missing" pixels. These new pixels are always located - at a distance less than half of a pixel but it is not easy to predict - where they will appear before rendering.

    - -

    This leads to the following computations:

    - -
      -
    • -

      compute the bbox

      -
    • -
    • -

      grid-fit the bounding box with the following:

      - -
      -    xmin = floor( bbox.xMin )
      -    xmax = ceiling( bbox.xMax )
      -    ymin = floor( bbox.yMin )
      -    ymax = ceiling( bbox.yMax )
      -
    • -
    • - return pixel dimensions, i.e. - -
      -    width = (xmax - xmin)/64
      - - and - -
      -    height = (ymax - ymin)/64
      -
    • -
    - -

    By grid-fitting the bounding box, it is guaranteed that all the pixel - centers that are to be drawn, including those coming from drop-out - control, will be within the adjusted box. Then the box's - dimensions in pixels can be computed.

    - -

    Note also that, when translating a grid-fitted outline, one should - always use integer distances to move an outline in the 2D - plane. Otherwise, glyph edges won't be aligned on the pixel grid - anymore, and the hinter's work will be lost, producing very low - quality bitmaps and pixmaps.

    +

    Finally, tags is an array of bytes, used to + store each outline point's tag.

    -


    +

    2. Bounding and control box + computations

    -
    - - - - - - -
    - Previous - - Contents - - Next -
    -
    +

    As described earlier, a bounding box (also + called bbox) is simply a rectangle that + completely encloses the shape of a given outline. The + interesting case is the smallest bounding box possible, + and in the following we subsume this under the term + ‘bounding box’. Because of the way arcs are + defined, Bézier control points are not necessarily + contained within an outline's (smallest) bounding box.

    -
    -
    +

    Such a situation happens if one Bézier arc is, for + example, the upper edge of an outline and an + ‘off’ point happens to be above the bbox. + However, it is very rare in the case of character outlines + because most font designers and creation tools always + place ‘on’ points at the extrema of each + curved edges (as both the TrueType and PostScript + specifications recommend), as it makes hinting much + easier.

    -Last update: 06-Mar-2011 +

    We thus define the control box (also + called cbox) as the smallest possible rectangle + that encloses all points of a given outline (including its + ‘off’ points). Clearly, it always includes + the bbox, and the two boxes are identical in most + cases.

    + +

    Unlike the bbox, the cbox is much faster to compute.

    + + + + + + +
    + a glyph with different bbox and cbox + + a glyph with identical bbox and cbox +
    + +

    Control and bounding boxes can be computed automatically + using the + functions FT_Outline_Get_CBox + and + FT_Outline_Get_BBox. + The former function is always very fast, while the + latter may be slow in the case of + ‘outside’ control points (as it needs to find + the extreme of conic and cubic arcs for + ‘perfect’ computations). If this isn't the + case, it is as fast as computing the control box. + +

    Note also that even though most glyph outlines have equal + cbox and bbox values to ease hinting, this is not + necessarily the case if a transformation like rotation is + applied to them.

    + + +

    3. Coordinates, scaling and + grid-fitting

    + +

    An outline point's vectorial coordinates are expressed in + the 26.6 format, i.e. in 1/64th of a pixel, hence the + coordinates ‘(1.0,-2.5)’ is stored as the + integer pair ‘(64,-192)’, to name an + example.

    + +

    After a glyph outline is scaled from the EM grid (in font + units) to the current character dimensions, the hinter or + grid-fitter is in charge of aligning important outline + points (mainly edge delimiters) to the pixel grid. Even + though this process is much too complex to be described in + a few lines, its purpose is mainly to round point + positions, while trying to preserve important properties + like widths, stems, etc.

    + +

    The following operations can be used to round vectorial + distances in the 26.6 format to the grid:

    + +
    +round( x )   == ( x + 32 ) & -64
    +floor( x )   ==          x & -64
    +ceiling( x ) == ( x + 63 ) & -64
    + +

    Once a glyph outline is grid-fitted or transformed, it + often is interesting to compute the glyph image's pixel + dimensions before rendering it. To do so, one has to + consider the following:

    + +

    The scan-line converter draws all the pixels + whose centers fall inside the glyph shape. In + B/W rendering mode, it can also detect drop-outs, + i.e., discontinuities coming from extremely thin shape + fragments, in order to draw the ‘missing’ + pixels. These new pixels are always located at a distance + less than half of a pixel but it is not easy to predict + where they will appear before rendering.

    + +

    This leads to the following computations:

    + + + +

    By grid-fitting the bounding box, it is guaranteed that + all the pixel centers that are to be drawn, including + those coming from drop-out control, will + be within the adjusted box. Then the box's + dimensions in pixels can be computed.

    + +

    Note also that, when translating a grid-fitted outline, one should + always use integer distances to move an outline + in the 2D plane. Otherwise, glyph edges won't be aligned + on the pixel grid anymore, and the hinter's work will be + lost, producing very low quality bitmaps and + pixmaps.

    + + + + +
    +

    Last update: 07-Dec-2014

    +
    + + + + + + +
    +
    + + + + + + +
    + +
    + + + +
    +
    diff --git a/lib/freetype/docs/glyphs/glyphs-7.html b/lib/freetype/docs/glyphs/glyphs-7.html index b57ba0662..ef134a1d8 100644 --- a/lib/freetype/docs/glyphs/glyphs-7.html +++ b/lib/freetype/docs/glyphs/glyphs-7.html @@ -1,356 +1,427 @@ - - + + + + + content="text/html; charset=utf-8"> + + + - FreeType Glyph Conventions + + + + + + + + + + FreeType Glyph Conventions / VII - -

    - FreeType Glyph Conventions -

    + -

    - Version 2.1 -

    - -

    - Copyright 1998-2000 David Turner (david@freetype.org)
    - Copyright 2000 The FreeType Development Team (devel@freetype.org) -

    - -
    - - -
    - -
    - - - - - - -
    - Previous - - Contents - -   -
    -
    - -


    - - - -
    -

    - VII. FreeType bitmaps -

    -
    - -

    The purpose of this section is to present the way FreeType manages - bitmaps and pixmaps, and how they relate to the concepts previously - defined. The relationships between vectorial and pixel coordinates is - explained.

    +
    +

    FreeType Glyph + Conventions / VII

    +
    - -

    - 1. Vectorial versus pixel coordinates -

    +
    -

    This sub-section explains the differences between vectorial and pixel - coordinates. To make things clear, brackets will be used to describe - pixel coordinates, e.g. [3,5], while parentheses will be used for - vectorial ones, e.g. (-2,3.5).

    - -

    In the pixel case, as we use the Y upwards convention; - the coordinate [0,0] always refers to the lower left pixel of a - bitmap, while coordinate [width-1, rows-1] to its upper right - pixel.

    - -

    In the vectorial case, point coordinates are expressed in floating - units, like (1.25, -2.3). Such a position doesn't refer to a given - pixel, but simply to an immaterial point in the 2D plane.

    - -

    The pixels themselves are indeed square boxes of the 2D - plane, whose centers lie in half pixel coordinates. For example, the - lower left pixel of a bitmap is delimited by the square (0,0)-(1,1), its - center being at location (0.5,0.5).

    - -

    This introduces some differences when computing distances. For - example, the length in pixels of the line [0,0]-[10,0] is 11. - However, the vectorial distance between (0,0)-(10,0) covers exactly - 10 pixel centers, hence its length is 10.

    - -
    - bitmap and vector grid -
    +
    +
    +
    +
    - -

    - 2. FreeType bitmap and pixmap descriptor -

    + -

    A bitmap or pixmap is described through a single structure, called - FT_Bitmap, defined in the file - <freetype/ftimage.h>. It is a simple descriptor whose - fields are:

    +
    +

    VII. FreeType Bitmaps

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - FT_Bitmap -
    - rows - - the number of rows, i.e. lines, in the bitmap -
    - width - - the number of horizontal pixels in the bitmap -
    - pitch - - its absolute value is the number of bytes per bitmap line; it can - be either positive or negative depending on the bitmap's vertical - orientation -
    - buffer - - a typeless pointer to the bitmap pixel bufer -
    - pixel_mode - - an enumeration used to describe the pixel format of the bitmap; - examples are ft_pixel_mode_mono for 1-bit monochrome - bitmaps and ft_pixel_mode_grays for 8-bit anti-aliased - "gray" values -
    - num_grays - - this is only used for "gray" pixel modes, it gives the number of - gray levels used to describe the anti-aliased gray levels -- - 256 by default with FreeType 2 -
    -
    +

    The purpose of this section is to present the way + FreeType manages bitmaps and pixmaps, and how they relate + to the concepts previously defined. The relationship + between vectorial and pixel coordinates is explained.

    -

    Note that the sign of the pitch fields determines whether - the rows in the pixel buffer are stored in ascending or descending - order.

    +

    1. Vectorial versus pixel + coordinates

    -

    Remember that FreeType uses the Y upwards convention in - the 2D plane, which means that a coordinate of (0,0) always refer to the - lower-left corner of a bitmap.

    +

    This sub-section explains the difference between + vectorial and pixel coordinates. To make things clear, + brackets will be used to describe pixel coordinates, + e.g. ‘[3,5]’, while parentheses will be used + for vectorial ones, e.g. ‘(-2, 3.5)’.

    -

    If the pitch is positive, the rows are stored in decreasing vertical - position; the first bytes of the pixel buffer are part of the - upper bitmap row.

    +

    In the pixel case, as we use the Y upwards + convention; the coordinate [0, 0] always refers to + the lower left pixel of a bitmap, while + coordinate [width-1, rows-1] to its upper right + pixel.

    -

    On the opposite, if the pitch is negative, the first bytes of the - pixel buffer are part of the lower bitmap row.

    +

    In the vectorial case, point coordinates are expressed in + floating units, like (1.25, -2.3). Such a position + doesn't refer to a given pixel, but simply to an + immaterial point in the 2D plane.

    -

    In all cases, one can see the pitch as the byte increment needed to - skip to the next lower scanline in a given bitmap buffer.

    +

    The pixels themselves are indeed square boxes of + the 2D plane, whose centers lie in half pixel coordinates. + For example, the lower left pixel of a bitmap is delimited + by the square (0, 0)-(1, 1), its center being at + location (0.5, 0.5).

    -
    - - - - - -
    - negative 'pitch' - - positive 'pitch' -
    -
    +

    This introduces some differences when computing + distances. For example, the length in pixels of + the line [0, 0]-[10, 0] is 11. However, + the vectorial distance between (0, 0)-(10, 0) + covers exactly 10 pixel centers, hence its length + is 10.

    -

    The "positive pitch" convention is very often used, though - some systems might need the other.

    +

    + bitmap and vector grid +

    -
    -

    - 3. Converting outlines into bitmaps and pixmaps -

    +

    2. The FT_Bitmap descriptor

    -

    Generating a bitmap or pixmap image from a vectorial image is easy - with FreeType. However, one must understand a few points regarding the - positioning of the outline in the 2D plane before converting it to a - bitmap:

    +

    In FreeType, a bitmap or pixmap is described through a + single structure, + called FT_Bitmap. + The fields we are interested in are:

    -
      -
    • -

      The glyph loader and hinter always places the outline in the 2D - plane so that (0,0) matches its character origin. This means that - the glyph's outline, and corresponding bounding box, can be placed - anywhere in the 2D plane (see the graphics in section III).

      -
    • -
    • -

      The target bitmap's area is mapped to the 2D plane, with its - lower left corner at (0,0). This means that a bitmap or pixmap of - dimensions [w,h] will be mapped to a 2D rectangle window - delimited by (0,0)-(w,h).

      -
    • -
    • -

      When scan-converting the outline, everything that falls within - the bitmap window is rendered, the rest is ignored.

      -
    • + + -

      A common mistake made by many developers when they begin using - FreeType is believing that a loaded outline can be directly rendered - in a bitmap of adequate dimensions. The following images illustrate - why this is a problem.

      + + + + + + + + + + + + + + + + + + + + + + + + +
      + FT_Bitmap +
      + rows + + the number of rows, i.e. lines, in the bitmap +
      + width + + the number of horizontal pixels in the bitmap +
      + pitch + + its absolute value is the number of bytes per bitmap + line; it can be either positive or negative depending + on the bitmap's vertical orientation +
      + buffer + + a typeless pointer to the bitmap pixel buffer +
      + pixel_mode + + an enumeration used to describe the pixel format of + the bitmap; examples are ft_pixel_mode_mono + for 1-bit monochrome bitmaps + and ft_pixel_mode_grays for 8-bit + anti-aliased ‘gray’ values +
      + num_grays + + this is only used for ‘gray’ pixel modes, + it gives the number of gray levels used to describe + the anti-aliased gray levels (256 by default with + FreeType 2) +
      -
        -
      • - The first image shows a loaded outline in the 2D plane. -
      • -
      • - The second one shows the target window for a bitmap of arbitrary - dimensions [w,h]. -
      • -
      • - The third one shows the juxtaposition of the outline and window in - the 2D plane. -
      • -
      • - The last image shows what will really be rendered in the bitmap. -
      • -
      +

      Note that the sign of the pitch field determines + whether the rows in the pixel buffer are stored in + ascending or descending order.

      -
      - clipping algorithm -
      -
    +

    Remember that FreeType uses the Y upwards + convention in the 2D plane, which means that a coordinate + of (0, 0) always refer to the lower-left + corner of a bitmap.

    -

    Indeed, in nearly all cases, the loaded or transformed outline must - be translated before it is rendered into a target bitmap, in order to - adjust its position relative to the target window.

    +

    If the pitch is positive, the rows are stored in + decreasing vertical position; the first bytes of the pixel + buffer are part of the upper bitmap row.

    -

    For example, the correct way of creating a standalone glyph - bitmap is as follows

    +

    On the opposite, if the pitch is negative, the first + bytes of the pixel buffer are part of the lower + bitmap row.

    -
      -
    • -

      Compute the size of the glyph bitmap. It can be computed - directly from the glyph metrics, or by computing its bounding box - (this is useful when a transformation has been applied to the - outline after the load, as the glyph metrics are not valid - anymore).

      -
    • -
    • -

      Create the bitmap with the computed dimensions. Don't forget to - fill the pixel buffer with the background color.

      -
    • -
    • -

      Translate the outline so that its lower left corner matches - (0,0). Don't forget that in order to preserve hinting, one should - use integer, i.e. rounded distances (of course, this isn't required - if preserving hinting information doesn't matter, like with rotated - text). Usually, this means translating with a vector - (-ROUND(xMin), -ROUND(yMin)).

      -
    • -
    • -

      Call the rendering function (it can be - FT_Outline_Render() for example).

      -
    • -
    +

    In all cases, one can see the pitch as the byte increment + needed to skip to the next lower scanline in a + given bitmap buffer.

    -

    In the case where one wants to write glyph images directly into a - large bitmap, the outlines must be translated so that their vectorial - position correspond to the current text cursor/character origin.

    + + + + + +
    + negative 'pitch' + + positive 'pitch' +
    -


    +

    The ‘positive pitch’ convention is very often + used, though some systems might need the other.

    -
    - - - - - - -
    - Previous - - Contents - -   -
    -
    -
    -
    +

    3. Converting outlines into bitmaps and + pixmaps

    + +

    Generating a bitmap or pixmap image from a vectorial + image is easy with FreeType. However, one must understand + a few points regarding the positioning of the outline in + the 2D plane before converting it to a bitmap:

    + + + +

    Indeed, in nearly all cases, the loaded or transformed + outline must be translated before it is rendered into a + target bitmap, in order to adjust its position relative to + the target window.

    + +

    For example, the correct way of creating + a standalone glyph bitmap is as follows:

    + + + +

    In the case where one wants to write glyph images + directly into a large bitmap, the outlines must be + translated so that their vectorial position corresponds to + the current text cursor or character origin.

    + + + + +
    +

    Last update: 07-Dec-2014

    +
    + + + + + + +
    +
    + + + + + + +
    + +
    + + + +
    +
    diff --git a/lib/freetype/docs/glyphs/index.html b/lib/freetype/docs/glyphs/index.html index 8ee2fa515..c0d4db647 100644 --- a/lib/freetype/docs/glyphs/index.html +++ b/lib/freetype/docs/glyphs/index.html @@ -1,200 +1,289 @@ - - + + + + + content="text/html; charset=utf-8"> + + + + + + + + + + + + FreeType Glyph Conventions - -

    - FreeType Glyph Conventions -

    + -

    - Version 2.1 -

    - -

    - Copyright 1998-2000 David Turner (david@freetype.org)
    - Copyright 2000 The FreeType Development Team (devel@freetype.org) -

    +
    +

    FreeType Glyph Conventions

    +
    -
    - - -
    +
    -

    This document presents the core conventions used within the FreeType - library to manage font and glyph data. It is a must-read for all - developers who need to understand digital typography, especially if you - want to use the FreeType 2 library in your projects.

    +
    +
    +
    +
    - - - - -
    -

    - Table of Contents -

    -
    -
    - - -
    + -

    - I. Basic Typographic Concepts -

    -
    -

    - 1. Font files, format and - information -
    +
    +

    This document presents the core conventions used within + the FreeType library to manage font and glyph data. It is + a must-read for all developers who need to + understand digital typography, especially if you want to + use the FreeType 2 library in your projects.

    +
    - 2. Character images and mappings -
    + - 3. Character and font metrics -
    -

    -
    + - 4. The effects of grid-fitting -
    + - 5. Text widths and bounding box -
    - - +
    +

    Last update: 07-Dec-2014

    +
    + + -

    - IV. Kerning -

    -
    -

    - 1. Kerning pairs -
    - 2. Applying kerning -
    -

    -
    + -

    - V. Text processing -

    -
    -

    - 1. Writing simple text strings -
    +
    +
    + + - 2. Sub-pixel positioning -
    - 3. Simple kerning -
    + - 4. Right-to-left layouts -
    +

    -
    +
  • +   +
  • -

    - VI. FreeType Outlines -

    -
    -

    - 1. FreeType outline description - and structure -
    +
  • + FreeType Glyph Conventions +
  • +
  • + Basic Typographic Concepts +
  • +
  • + Glyph Outlines +
  • +
  • + Glyph Metrics +
  • +
  • + Kerning +
  • +
  • + Text Processing +
  • +
  • + FreeType Outlines +
  • +
  • + FreeType Bitmaps +
  • + + - 2. Bounding and control box - computations -
    + - 3. Coordinates, scaling, and - grid-fitting -
    -

    -
    - -

    - VII. FreeType bitmaps -

    -
    -

    - 1. Vectorial versus pixel - coordinates -
    - - 2. FreeType bitmap and pixmap - descriptor -
    - - 3. Converting outlines into - bitmaps and pixmaps -
    -

    -
    - -
    -
    - -
    -
    +
    +
    diff --git a/lib/freetype/docs/image/favicon.ico b/lib/freetype/docs/image/favicon.ico new file mode 100644 index 000000000..72a53b6a6 Binary files /dev/null and b/lib/freetype/docs/image/favicon.ico differ diff --git a/lib/freetype/docs/image/favicon_-30.ico b/lib/freetype/docs/image/favicon_-30.ico new file mode 100644 index 000000000..c695f0f29 Binary files /dev/null and b/lib/freetype/docs/image/favicon_-30.ico differ diff --git a/lib/freetype/docs/image/favicon_-60.ico b/lib/freetype/docs/image/favicon_-60.ico new file mode 100644 index 000000000..a1a22ed43 Binary files /dev/null and b/lib/freetype/docs/image/favicon_-60.ico differ diff --git a/lib/freetype/docs/image/favicon_-90.ico b/lib/freetype/docs/image/favicon_-90.ico new file mode 100644 index 000000000..201ec2274 Binary files /dev/null and b/lib/freetype/docs/image/favicon_-90.ico differ diff --git a/lib/freetype/docs/image/favicon_30.ico b/lib/freetype/docs/image/favicon_30.ico new file mode 100644 index 000000000..3f719d1ea Binary files /dev/null and b/lib/freetype/docs/image/favicon_30.ico differ diff --git a/lib/freetype/docs/image/favicon_60.ico b/lib/freetype/docs/image/favicon_60.ico new file mode 100644 index 000000000..6f5622114 Binary files /dev/null and b/lib/freetype/docs/image/favicon_60.ico differ diff --git a/lib/freetype/docs/image/favicon_90.ico b/lib/freetype/docs/image/favicon_90.ico new file mode 100644 index 000000000..b5886effe Binary files /dev/null and b/lib/freetype/docs/image/favicon_90.ico differ diff --git a/lib/freetype/docs/image/fond2-small.png b/lib/freetype/docs/image/fond2-small.png new file mode 100644 index 000000000..44144682b Binary files /dev/null and b/lib/freetype/docs/image/fond2-small.png differ diff --git a/lib/freetype/docs/image/fond2.png b/lib/freetype/docs/image/fond2.png new file mode 100644 index 000000000..214d7d9df Binary files /dev/null and b/lib/freetype/docs/image/fond2.png differ diff --git a/lib/freetype/docs/image/fond3.jpg b/lib/freetype/docs/image/fond3.jpg new file mode 100644 index 000000000..dfb732738 Binary files /dev/null and b/lib/freetype/docs/image/fond3.jpg differ diff --git a/lib/freetype/docs/image/fond3.png b/lib/freetype/docs/image/fond3.png new file mode 100644 index 000000000..fdebb227e Binary files /dev/null and b/lib/freetype/docs/image/fond3.png differ diff --git a/lib/freetype/docs/image/fond3_-30.png b/lib/freetype/docs/image/fond3_-30.png new file mode 100644 index 000000000..f6c655739 Binary files /dev/null and b/lib/freetype/docs/image/fond3_-30.png differ diff --git a/lib/freetype/docs/image/fond3_-60.png b/lib/freetype/docs/image/fond3_-60.png new file mode 100644 index 000000000..3771205b7 Binary files /dev/null and b/lib/freetype/docs/image/fond3_-60.png differ diff --git a/lib/freetype/docs/image/fond3_-90.png b/lib/freetype/docs/image/fond3_-90.png new file mode 100644 index 000000000..8ff9d6050 Binary files /dev/null and b/lib/freetype/docs/image/fond3_-90.png differ diff --git a/lib/freetype/docs/image/fond3_30.png b/lib/freetype/docs/image/fond3_30.png new file mode 100644 index 000000000..372155a69 Binary files /dev/null and b/lib/freetype/docs/image/fond3_30.png differ diff --git a/lib/freetype/docs/image/fond3_60.png b/lib/freetype/docs/image/fond3_60.png new file mode 100644 index 000000000..f78c25108 Binary files /dev/null and b/lib/freetype/docs/image/fond3_60.png differ diff --git a/lib/freetype/docs/image/fond3_90.png b/lib/freetype/docs/image/fond3_90.png new file mode 100644 index 000000000..11374aaa4 Binary files /dev/null and b/lib/freetype/docs/image/fond3_90.png differ diff --git a/lib/freetype/docs/image/freetype.jpg b/lib/freetype/docs/image/freetype.jpg new file mode 100644 index 000000000..0c6304fa1 Binary files /dev/null and b/lib/freetype/docs/image/freetype.jpg differ diff --git a/lib/freetype/docs/image/top.gif b/lib/freetype/docs/image/top.gif new file mode 100644 index 000000000..6ed55656a Binary files /dev/null and b/lib/freetype/docs/image/top.gif differ diff --git a/lib/freetype/docs/index.html b/lib/freetype/docs/index.html new file mode 100644 index 000000000..a89262685 --- /dev/null +++ b/lib/freetype/docs/index.html @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + FreeType Overview + + + + + +
    +

    FreeType Overview

    +
    + + +
    + +
    +
    +
    +
    + + + + +
    +

    What is FreeType?

    + +

    FreeType is a software font engine that is designed to + be small, efficient, highly customizable, and portable + while capable of producing high-quality output (glyph + images). It can be used in graphics libraries, display + servers, font conversion tools, text image generation + tools, and many other products as well.

    + +

    Note that FreeType is a font service and doesn't + provide APIs to perform higher-level features like text + layout or graphics processing (e.g., colored text + rendering, ‘hollowing’, etc.). However, it + greatly simplifies these tasks by providing a simple, easy + to use, and uniform interface to access the content of + font files.

    + +

    FreeType is released under two open-source licenses: our + own + BSD-like FreeType + License and + the GNU + Public License, Version 2. It can thus be used + by any kind of projects, be they proprietary or not.

    + +

    Please note that ‘FreeType’ is also called + ‘FreeType 2’, to distinguish it from the + old, deprecated ‘FreeType 1’ library, a + predecessor no longer maintained and supported.

    +
    + + + + +
    +

    Features

    + +

    The following is a non-exhaustive list of features + provided by FreeType.

    + +
      +
    • +

      FreeType provides a simple and easy-to-use API to + access font content in a uniform way, independently of + the file format. Additionally, some format-specific + APIs can be used to access special data in the font + file.

      +
    • +
    • +

      The design of FreeType is based on modules that can + be either linked statically to the library at compile + time, or loaded on demand at runtime. Modules are + used to support specific font formats, or even new + glyph image formats!

      +
    • +
    • +

      FreeType was written with embedded systems in mind. + This means that it doesn't use static writable data + (i.e., it can be run from ROM directly), and that + client applications can provide their own memory + manager and I/O stream implementation. The latter + allows you to easily read from ROM-based, compressed + or remote font files with the same API. Several + stream implementations can be used concurrently with a + single FreeType instance.

      + +

      You can also reduce the size of the FreeType code by + only compiling the modules you need for your embedded + project or environment.

      +
    • +
    • +

      By default, FreeType supports the following font + formats.

      + +
        +
      • TrueType fonts (TTF) and TrueType collections + (TTC)
      • +
      • CFF fonts
      • +
      • WOFF fonts
      • +
      • OpenType fonts (OTF, both TrueType and CFF + variants) and OpenType collections (OTC)
      • +
      • Type 1 fonts (PFA and PFB)
      • +
      • CID-keyed Type 1 fonts
      • +
      • SFNT-based bitmap fonts, including color Emoji
      • +
      • X11 PCF fonts
      • +
      • Windows FNT fonts
      • +
      • BDF fonts (including anti-aliased ones)
      • +
      • PFR fonts
      • +
      • Type 42 fonts (limited support)
      • +
      +
    • +
    • +

      From a given glyph outline, FreeType is capable of + producing a high-quality monochrome bitmap, or + anti-aliased pixmap, using 256 levels of + ‘gray’.

      +
    • +
    • +

      FreeType supports all the character mappings defined + by the TrueType and OpenType specifications. It is + also capable of automatically synthetizing a Unicode + charmap from Type 1 fonts, avoiding painful + ‘encoding translation’ problems common + with this format (of course, original encodings are + also available if necessary).

      +
    • +
    • +

      The FreeType core API provides simple functions to + access advanced information like glyph names or basic + kerning data.

      +
    • +
    • +

      A full-featured and efficient TrueType bytecode + interpreter, trying to match the results of the + Windows bytecode engine. There is also the + possibility to activate subpixel hinting + (a.k.a. ClearType, still under + development).

      +
    • +
    • +

      For those who don't need or want to use the bytecode + interpreter for TrueType fonts, we developed our + own automatic hinter module. It is also used + by other scalable formats.

      +
    • +
    • +

      Due to its modular design, it is easy to enhance the + library, providing additional format-specific + information through optional APIs (as an example, an + optional API is provided to retrieve SFNT tables from + TrueType and OpenType fonts).

      +
    • +
    • +

      FreeType provides its own caching subsystem. It can + be used to cache either face instances or glyph images + efficiently.

      +
    • +
    • +

      A bundle of demo programs demonstrate the usage of + FreeType; look for the + ‘ft2demos-x.x.x’ archive (or + ‘ftdmoxxx’ in case you are on a + Windows platform) at the locations + given here. + ‘x.x.x’ (or + ‘xxx’) gives the version number, + for example ‘2.4.10’ or + ‘2410’.

      +
    • +
    +
    + + + + +
    +

    Requirements

    + +

    FreeType is written in industry-standard ANSI C and + should compile easily with any compliant C or C++ + compiler. We have even taken great care to + eliminate all warnings when compiling with + popular compilers like gcc, Visual C++, and Borland + C++.

    + +

    Apart from a standard ANSI C library, FreeType + doesn't have any external dependencies and can be compiled + and installed on its own on any kind of system. Some + modules need external libraries (e.g., for + handling fonts compressed with gzip or bz2), however, they + are optional and can be disabled.

    +
    + + + + +
    +

    Patent Issues

    + +

    All patents related to the TrueType bytecode interpreter + have expired since May 2010. Support for the still + patented ClearType color filtering model is disabled by + default.

    + +

    More information regarding this topic is available at + our patents page.

    +
    + + + + +
    +

    Last update: 7-Dec-2014

    +
    +
    +
    + + + + +
    +
    +
    +
    + + + + +
    + +
    + +
    + +
    +
    + + + diff --git a/lib/freetype/docs/javascript/freetype2.js b/lib/freetype/docs/javascript/freetype2.js new file mode 100644 index 000000000..0a15a21dd --- /dev/null +++ b/lib/freetype/docs/javascript/freetype2.js @@ -0,0 +1,78 @@ +/*! + * freetype2.js + * + * auxiliary JavaScript functions for freetype.org + * + * written 2012 by Werner Lemberg + */ + +// This code snippet needs `jquery' +// (http://code.jquery.com/jquery-1.8.3.js) and `jquery-resize' +// (http://github.com/cowboy/jquery-resize/raw/master/jquery.ba-resize.js) + + +// Add a bottom bar if the document length exceeds the window height. +// Additionally ensure that the TOC background reaches the bottom of the +// window. + +function addBottomBar() { + var columnHeight = $('.colright').height(); + var topBarHeight = $('#top').height(); + var winHeight = $(window).height(); + + if (columnHeight + topBarHeight > winHeight) { + $('#TOC-bottom').css('height', columnHeight); + /* add bottom bar if it doesn't exist already */ + if ($('#bottom').length == 0) { + $('body').append('
    '); + } + } + else { + $('#TOC-bottom').css('height', winHeight - topBarHeight); + $('#bottom').remove(); + } +} + + +// `Slightly' scroll the TOC so that its top moves up to the top of the +// screen if we scroll down. The function also assures that the bottom of +// the TOC doesn't cover the bottom bar (e.g., if the window height is very +// small). + +function adjustTOCPosition() { + var docHeight = $(document).height(); + var TOCHeight = $('#TOC').height(); + var bottomBarHeight = $('#bottom').height(); + var topBarHeight = $('#top').height(); + + var scrollTopPos = $(window).scrollTop(); + var topBarBottomPos = 0 + topBarHeight; + var bottomBarTopPos = docHeight - bottomBarHeight; + + if (scrollTopPos >= topBarBottomPos) { + $('#TOC').css('top', 0); + } + if (scrollTopPos < topBarBottomPos) { + $('#TOC').css('top', topBarBottomPos - scrollTopPos); + } + if (bottomBarTopPos - scrollTopPos < TOCHeight) + $('#TOC').css('top', bottomBarTopPos - scrollTopPos - TOCHeight); +} + + +// Hook functions into loading, resizing, and scrolling events. + +$(window).load(function() { + addBottomBar(); + adjustTOCPosition(); + + $(window).scroll(function() { + adjustTOCPosition(); + }); + + $('#TOC-bottom').add(window).resize(function() { + addBottomBar(); + }); +}); + +/* end of freetype2.js */ diff --git a/lib/freetype/docs/javascript/jquery-1.11.0.min.js b/lib/freetype/docs/javascript/jquery-1.11.0.min.js new file mode 100644 index 000000000..73f33fb3a --- /dev/null +++ b/lib/freetype/docs/javascript/jquery-1.11.0.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e):void 0},now:function(){return+new Date},support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="
    ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=a.document,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,B=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:A.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:z,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=z.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return y.find(a);this.length=1,this[0]=d}return this.context=z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};B.prototype=n.fn,y=n(z);var C=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!n(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function E(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return E(a,"nextSibling")},prev:function(a){return E(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(D[a]||(e=n.unique(e)),C.test(a)&&(e=e.reverse())),this.pushStack(e)}});var F=/\S+/g,G={};function H(a){var b=G[a]={};return n.each(a.match(F)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?G[a]||H(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&n.each(arguments,function(a,c){var d;while((d=n.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){if(a===!0?!--n.readyWait:!n.isReady){if(!z.body)return setTimeout(n.ready);n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(z,[n]),n.fn.trigger&&n(z).trigger("ready").off("ready"))}}});function J(){z.addEventListener?(z.removeEventListener("DOMContentLoaded",K,!1),a.removeEventListener("load",K,!1)):(z.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(z.addEventListener||"load"===event.type||"complete"===z.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===z.readyState)setTimeout(n.ready);else if(z.addEventListener)z.addEventListener("DOMContentLoaded",K,!1),a.addEventListener("load",K,!1);else{z.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&z.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!n.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}J(),n.ready()}}()}return I.promise(b)};var L="undefined",M;for(M in n(l))break;l.ownLast="0"!==M,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c=z.getElementsByTagName("body")[0];c&&(a=z.createElement("div"),a.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",b=z.createElement("div"),c.appendChild(a).appendChild(b),typeof b.style.zoom!==L&&(b.style.cssText="border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",(l.inlineBlockNeedsLayout=3===b.offsetWidth)&&(c.style.zoom=1)),c.removeChild(a),a=b=null)}),function(){var a=z.createElement("div");if(null==l.deleteExpando){l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}}a=null}(),n.acceptData=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(n.acceptData(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f +}}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML="
    a",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=ab.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,m,o=[d||z],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||z,3!==d.nodeType&&8!==d.nodeType&&!_.test(p+n.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[n.expando]?b:new n.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),k=n.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!n.isWindow(d)){for(i=k.delegateType||p,_.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||z)&&o.push(l.defaultView||l.parentWindow||a)}m=0;while((h=o[m++])&&!b.isPropagationStopped())b.type=m>1?i:k.bindType||p,f=(n._data(h,"events")||{})[b.type]&&n._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&n.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&n.acceptData(d)&&g&&d[p]&&!n.isWindow(d)){l=d[g],l&&(d[g]=null),n.event.triggered=p;try{d[p]()}catch(r){}n.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((n.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?n(c,this).index(i)>=0:n.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/\s*$/g,sb={option:[1,""],legend:[1,"
    ","
    "],area:[1,"",""],param:[1,"",""],thead:[1,"","
    "],tr:[2,"","
    "],col:[2,"","
    "],td:[3,"","
    "],_default:l.htmlSerialize?[0,"",""]:[1,"X
    ","
    "]},tb=eb(z),ub=tb.appendChild(z.createElement("div"));sb.optgroup=sb.option,sb.tbody=sb.tfoot=sb.colgroup=sb.caption=sb.thead,sb.th=sb.td;function vb(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==L?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==L?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,vb(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function wb(a){X.test(a.type)&&(a.defaultChecked=a.checked)}function xb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function yb(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function zb(a){var b=qb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ab(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}function Bb(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Cb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(yb(b).text=a.text,zb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&X.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}n.extend({clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!hb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ub.innerHTML=a.outerHTML,ub.removeChild(f=ub.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=vb(f),h=vb(a),g=0;null!=(e=h[g]);++g)d[g]&&Cb(e,d[g]);if(b)if(c)for(h=h||vb(a),d=d||vb(f),g=0;null!=(e=h[g]);g++)Bb(e,d[g]);else Bb(a,f);return d=vb(f,"script"),d.length>0&&Ab(d,!i&&vb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,m=a.length,o=eb(b),p=[],q=0;m>q;q++)if(f=a[q],f||0===f)if("object"===n.type(f))n.merge(p,f.nodeType?[f]:f);else if(mb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(kb.exec(f)||["",""])[1].toLowerCase(),k=sb[i]||sb._default,h.innerHTML=k[1]+f.replace(jb,"<$1>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!l.leadingWhitespace&&ib.test(f)&&p.push(b.createTextNode(ib.exec(f)[0])),!l.tbody){f="table"!==i||lb.test(f)?""!==k[1]||lb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)n.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}n.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),l.appendChecked||n.grep(vb(p,"input"),wb),q=0;while(f=p[q++])if((!d||-1===n.inArray(f,d))&&(g=n.contains(f.ownerDocument,f),h=vb(o.appendChild(f),"script"),g&&Ab(h),c)){e=0;while(f=h[e++])pb.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.deleteExpando,m=n.event.special;null!=(d=a[h]);h++)if((b||n.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k?delete d[i]:typeof d.removeAttribute!==L?d.removeAttribute(i):d[i]=null,c.push(f))}}}),n.fn.extend({text:function(a){return W(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||z).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(vb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&Ab(vb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(vb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return W(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(gb,""):void 0;if(!("string"!=typeof a||nb.test(a)||!l.htmlSerialize&&hb.test(a)||!l.leadingWhitespace&&ib.test(a)||sb[(kb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(jb,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(vb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(vb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&ob.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(i=n.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=n.map(vb(i,"script"),yb),f=g.length;k>j;j++)d=i,j!==o&&(d=n.clone(d,!0,!0),f&&n.merge(g,vb(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,n.map(g,zb),j=0;f>j;j++)d=g[j],pb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(h,d)&&(d.src?n._evalUrl&&n._evalUrl(d.src):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(rb,"")));i=c=null}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],g=n(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Db,Eb={};function Fb(b,c){var d=n(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:n.css(d[0],"display");return d.detach(),e}function Gb(a){var b=z,c=Eb[a];return c||(c=Fb(a,b),"none"!==c&&c||(Db=(Db||n("