diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-06-28 12:55:43 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-06-28 12:55:43 +0000 |
commit | 753b0048043fdb9741a78011ab7e2c862f94e9e8 (patch) | |
tree | 39a25bf97207218df545c269056de3f1a4d25152 /lib | |
parent | 27ddba6c40aa95169621bd72815339a47da1103b (diff) |
Remove outdated parts of the freetype-doc package.
They are not used in builds and have not been updated recently.
Diffstat (limited to 'lib')
98 files changed, 0 insertions, 13420 deletions
diff --git a/lib/freetype/docs/LICENSE.TXT b/lib/freetype/docs/LICENSE.TXT deleted file mode 100644 index af5a1c50f..000000000 --- a/lib/freetype/docs/LICENSE.TXT +++ /dev/null @@ -1,39 +0,0 @@ - -The FreeType 2 font engine is copyrighted work and cannot be used -legally without a software license. In order to make this project -usable to a vast majority of developers, we distribute it under two -mutually exclusive open-source licenses. - -This means that *you* must choose *one* of the two licenses described -below, then obey all its terms and conditions when using FreeType 2 in -any of your projects or products. - - - The FreeType License, found in the file `FTL.TXT', which is similar - to the original BSD license *with* an advertising clause that forces - you to explicitly cite the FreeType project in your product's - documentation. All details are in the license file. This license - is suited to products which don't use the GNU General Public - License. - - Note that this license is compatible to the GNU General Public - License version 3, but not version 2. - - - The GNU General Public License version 2, found in `GPLv2.TXT' (any - later version can be used also), for programs which already use the - GPL. Note that the FTL is incompatible with GPLv2 due to its - advertisement clause. - -The contributed BDF and PCF drivers come with a license similar to that -of the X Window System. It is compatible to the above two licenses (see -file src/bdf/README and src/pcf/README). The same holds for the files -`fthash.c' and `fthash.h'; their code was part of the BDF driver in -earlier FreeType versions. - -The gzip module uses the zlib license (see src/gzip/zlib.h) which too is -compatible to the above two licenses. - -The MD5 checksum support (only used for debugging in development builds) -is in the public domain. - - ---- end of LICENSE.TXT --- diff --git a/lib/freetype/docs/css/freetype.css b/lib/freetype/docs/css/freetype.css deleted file mode 100644 index 6b5651686..000000000 --- a/lib/freetype/docs/css/freetype.css +++ /dev/null @@ -1,247 +0,0 @@ -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 deleted file mode 100644 index 72ea472a9..000000000 --- a/lib/freetype/docs/css/freetype2.css +++ /dev/null @@ -1,400 +0,0 @@ -/* freetype2.css */ - -/* the column container layout is based on */ -/* http://matthewjamestaylor.com/blog/perfect-multi-column-liquid-layouts */ - - -/* use Droid fonts */ -@import url("https://fonts.googleapis.com/css?family=Droid+Serif:r,i,b,bi"); -@import url("https://fonts.googleapis.com/css?family=Droid+Sans:r,b"); -@import url("https://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 <div>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 { - white-space: nowrap; - 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 { - margin-top: 3ex; - margin-bottom: 2ex; - font-size: 100%; } -h6 { - margin-top: 2ex; - margin-bottom: 1ex; - font-size: 100%; - font-weight: normal; - font-style: italic; } - -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: 0; - margin-bottom: 0; } -table.vertical-space { - border-collapse: collapse; - /* the next two lines center the table horizontally */ - margin-left: auto; - margin-right: auto; - margin-top: 4ex; - margin-bottom: 4ex; } -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 */ - /* or at the beginning of the table */ - padding-top: 1ex; } -tbody tr:last-child td { - /* some vertical space after the table */ - padding-bottom: 1ex; } -/* if we have paragraphs in a table, */ -/* suppress first and last vertical space */ -table tr:first-of-type p:first-of-type { - margin-top: 0; } -table tr:last-of-type p:last-of-type { - margin-bottom: 0; } - -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: 0; } -dd > p { - margin-bottom: 0; } - -/* 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 { - margin-top: 1ex; - margin-bottom: 1ex; } -p.warning { - color: red; } -p.large { - font-size: larger; } -p.footnote { - font-size: smaller; } -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 deleted file mode 100644 index 401cdaba3..000000000 --- a/lib/freetype/docs/css/freetype2_-30.css +++ /dev/null @@ -1,12 +0,0 @@ -/* 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 deleted file mode 100644 index d3f44adad..000000000 --- a/lib/freetype/docs/css/freetype2_-60.css +++ /dev/null @@ -1,12 +0,0 @@ -/* 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 deleted file mode 100644 index 86b4a7a72..000000000 --- a/lib/freetype/docs/css/freetype2_-90.css +++ /dev/null @@ -1,12 +0,0 @@ -/* 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 deleted file mode 100644 index 28acb435c..000000000 --- a/lib/freetype/docs/css/freetype2_30.css +++ /dev/null @@ -1,12 +0,0 @@ -/* 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 deleted file mode 100644 index 064ed4c10..000000000 --- a/lib/freetype/docs/css/freetype2_60.css +++ /dev/null @@ -1,12 +0,0 @@ -/* 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 deleted file mode 100644 index af2bc7946..000000000 --- a/lib/freetype/docs/css/freetype2_90.css +++ /dev/null @@ -1,12 +0,0 @@ -/* 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/design/basic-design.png b/lib/freetype/docs/design/basic-design.png Binary files differdeleted file mode 100644 index f1cf00234..000000000 --- a/lib/freetype/docs/design/basic-design.png +++ /dev/null diff --git a/lib/freetype/docs/design/design-1.html b/lib/freetype/docs/design/design-1.html deleted file mode 100644 index 172dc7c76..000000000 --- a/lib/freetype/docs/design/design-1.html +++ /dev/null @@ -1,237 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Design</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Design</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="introduction"> - <h2>Introduction</h2> - - <p>This document provides details on the design and - implementation of the FreeType 2 library. Its goal - is to help developers better understand how - FreeType 2 is organized, in order to let them extend, - customize, and debug it.</p> - - <p>Before anything else, it is important to understand the - <em>purpose</em> of this library, i.e., why it has been - written.</p> - - <ul> - <li> - <p>It allows client applications to <em>access font - files easily</em>, wherever they could be stored, and - as independently of the font format as possible.</p> - </li> - <li> - <p>Easy <em>retrieval of global font data</em> most - commonly found in normal font formats (i.e., global - metrics, encoding/charmaps, etc.).</p> - </li> - <li> - <p>It allows easy <em>retrieval of individual glyph - data</em> (metrics, images, name, anything else).</p> - </li> - <li> - <p><em>Access to font format-specific - ‘features’</em> whenever possible (e.g., - SFNT tables, Multiple Masters, OpenType layout tables, - font variations, etc.).</p> - </li> - </ul> - - <p>Its design has also severely been influenced by the - following requirements.</p> - - <ul> - <li> - <p><em>High portability</em>. The library must be able - to run on any kind of environment. This requirement - introduces a few drastic choices that are part of - FreeType 2's low-level system interface.</p> - </li> - <li> - <p><em>Extendability</em>. New features should be added - with the least modifications in the library's code - base. This requirement induces an extremely simple - design where nearly all operations are provided by - modules or services.</p> - </li> - <li> - <p><em>Customization</em>. It should be easy to build a - version of the library that only contains the features - needed by a specific project. This really is - important when you need to integrate it into a font - server for embedded graphics libraries, say.</p> - </li> - <li> - <p><em>Compactness</em> and <em>efficiency</em>. The - primary target for this library originally were - embedded systems with low CPU and memory resources. - Today, however, memory constraints are much less - strict, and the focus of development shifted to - support as much font features as possible.</p> - </li> - </ul> - - <p>The rest of this document is divided in several sections. - First, a few chapters will present the library's basic - design as well as the objects and data managed internally - by FreeType 2.</p> - - <p>It is intended to eventually add sections that cover - library customization, relating to topics as - system-specific interfaces, how to write your own modules - or services and how to tailor library initialization and - compilation to your needs. Those sections are not written - yet, however.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Design</a> - </li> - <li class="tertiary"> - <a href="design-1.html" class="current">Introduction</a> - </li> - <li class="tertiary"> - <a href="design-2.html">Components and APIs</a> - </li> - <li class="tertiary"> - <a href="design-3.html">Public Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-4.html">Internal Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-5.html">Module Classes</a> - </li> - <li class="tertiary"> - <a href="design-6.html">Interfaces and Services</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/design/design-2.html b/lib/freetype/docs/design/design-2.html deleted file mode 100644 index 4dc3779a5..000000000 --- a/lib/freetype/docs/design/design-2.html +++ /dev/null @@ -1,292 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Design / I</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> - Design / I</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="components-and-apis"> - <h2>I. Components and APIs</h2> - - <p>It is better to describe FreeType 2 as a collection - of <em>components</em>. Each one of them is a more or - less abstract part of the library that is in charge of one - specific task. We will now explain the connections and - relationships between them.</p> - - <p>A first brief description of this system of components - could be as follows.</p> - - <ul> - <li> - <p>Client applications typically call the - FreeType 2 <b>high-level API</b>, whose functions - are implemented in a single component called - the <em>Base Layer</em>.</p> - </li> - <li> - <p>Depending on the context or the task, the base layer - then calls one or more <em>module</em> components to - perform the work. In most cases, the client - application doesn't need to know which module was - called.</p> - </li> - <li> - <p>The base layer also contains a set of routines that - are used for generic things like memory allocation, - list processing, I/O stream parsing, fixed-point - computation, etc. These functions can also be called - by a module at any time, and they form what is called - the <b>low-level base API</b>.</p> - </li> - </ul> - - <p>This is illustrated by the following graphics (note that - component entry points are represented as colored - triangles).</p> - - <center> - <img src="basic-design.png" - width="394" - height="313" - alt="Basic FreeType design"> - </center> - - <p>A few additional things must be added to complete this - picture.</p> - - <ul> - <li> - <p>Some parts of the base layer can be replaced for - specific builds of the library, and can thus be - considered as components themselves. This is the case - for the <tt>ftsystem</tt> component, which is in - charge of implementing memory management and input - stream access, as well as <tt>ftinit</tt>, which is in - charge of library initialization (i.e., implementing - the <a href="../reference/ft2-base_interface.html#ft_init_freetype"><code>FT_Init_FreeType</code></a> - function).</p> - </li> - <li> - <p>FreeType 2 comes also with a set of <em>optional - components</em>, which can be used either as a - convenience layer for client applications (e.g., - the <tt>ftglyph</tt> component, used to provide a - simple API to manage glyph images independently of - their internal representation), or to access - format-specific features (e.g., the - <tt>ftmm</tt> component used to access and manage - Multiple Masters and OpenType variations fonts).</p> - </li> - <li> - <p>A module is capable of calling functions provided by - another module. This is very useful to share code and - tables between several font driver modules (for - example, the <tt>truetype</tt> and <tt>cff</tt> - modules both use the routines provided by - the <tt>sfnt</tt> module).</p> - </li> - <li> - <p>Finally, FreeType provides <em>services</em>, which - are a more light-weight way to access certain features - across multiple modules, or to access some - functionality provided by a single module.</p> - - <p>Services are internal to FreeType; similar to - modules, it is necessary to ‘load’ a - service, which can fail if the service's module is not - available.</p> - - <p>An example for a service provided by a single module - is ‘winfonts’ (see - file <tt>svwinfnt.h</tt>), which allows access to the - header of Windows bitmap fonts. An example for a - service provided by multiple modules is - ‘multi-masters’ (see file <tt>svmm.h</tt>) - to manage the abovementioned <tt>ftmm</tt> component - across the <tt>truetype</tt>, <tt>type1</tt>, - and <tt>cff</tt> modules.</p> - </li> - </ul> - - <p>The following graphics shows the additional components - (without services).</p> - - <center> - <img src="detailed-design.png" - width="390" - height="429" - alt="Detailed FreeType design"> - </center> - - <p>Please take note of the following important points.</p> - - <ul> - <li> - <p>An optional component can use either the high-level - or base API. This is the case of <tt>ftglyph</tt> in - the above picture.</p> - </li> - <li> - <p>Some optional components can use module-specific - interfaces or services ignored by the base layer. In - the above example, <tt>ftmm</tt> directly accesses the - Type 1 and TrueType modules to set and query - data.</p> - </li> - <li> - <p>A replaceable component can provide a function of the - high-level API. For example, <tt>ftinit</tt> provides - <tt>FT_Init_FreeType</tt> to client applications.</p> - </li> - </ul> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Design</a> - </li> - <li class="tertiary"> - <a href="design-1.html">Introduction</a> - </li> - <li class="tertiary"> - <a href="design-2.html" class="current">Components and APIs</a> - </li> - <li class="tertiary"> - <a href="design-3.html">Public Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-4.html">Internal Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-5.html">Module Classes</a> - </li> - <li class="tertiary"> - <a href="design-6.html">Interfaces and Services</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/design/design-3.html b/lib/freetype/docs/design/design-3.html deleted file mode 100644 index 2acf81b0d..000000000 --- a/lib/freetype/docs/design/design-3.html +++ /dev/null @@ -1,444 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Design / II</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> - Design / II</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="public-objects"> - <h2>II. Public Objects and Classes</h2> - - <p>We will now explain the abstractions provided by - FreeType 2 to client applications to manage font - files and data. As you would normally expect, these are - implemented through objects and classes.</p> - - - <h3 id="section-1">1. Object Orientation in - FreeType 2</h3> - - <p>Though written in ANSI C, the library employs a few - techniques, inherited from object-oriented programming, to - make it easy to extend. Hence, the following conventions - apply in the FreeType 2 source code.</p> - - <ol> - <li> - <p>Almost all object types or classes have a - corresponding <em>structure type</em> <b>and</b> a - corresponding <em>structure pointer type</em>. The - latter is called the <em>handle type</em> for the type - or class.</p> - - <p>Consider that we need to manage objects of type - ‘foo’ in FreeType 2. We would define - the following structure and handle types as - follows.</p> - - <pre> -typedef struct FT_FooRec_* FT_Foo; - -typedef struct FT_FooRec_ -{ - /* fields for the 'foo' class */ - ... - -} FT_FooRec;</pre> - - <p>As a convention, handle types use simple but - meaningful identifiers beginning with <tt>FT_</tt>, as - in <tt>FT_Foo</tt>, while structures use the same name - with a <tt>Rec</tt> suffix appended to it - (‘Rec’ is short for - ‘record’).</p> - </li> - <li> - <p>Class derivation is achieved internally by wrapping - base class structures into new ones. As an example, - we define a ‘foobar’ class that is derived - from ‘foo’. We would do something - like this.</p> - - <pre> -typedef struct FT_FooBarRec_* FT_FooBar; - -typedef struct FT_FooBarRec_ -{ - /* the base 'foo' class fields */ - FT_FooRec root; - - /* fields proper to the 'foobar' class */ - ... -} FT_FooBarRec;</pre> - - <p>As you can see, we ensure that a ‘foobar’ - object is also a ‘foo’ object by placing - a <tt>FT_FooRec</tt> at the start of the - <tt>FT_FooBarRec</tt> definition. It is - called <b>root</b> by convention.</p> - - <p>Note that an <tt>FT_FooBar</tt> handle also points to - a ‘foo’ object and can be typecast - to <tt>FT_Foo</tt>. Similarly, when the library - returns an <tt>FT_Foo</tt> handle to client - applications, the object can be really implemented as - <tt>FT_FooBar</tt> or any derived class from - ‘foo’.</p> - </li> - </ol> - - <p>In the following sections of this chapter, we will refer - to ‘the <tt>FT_Foo</tt> class’ to indicate the - type of objects handled through <tt>FT_Foo</tt> pointers, - be they implemented as ‘foo’ or - ‘foobar’.</p> - - - <h3 id="section-2">2. The <tt>FT_Library</tt> class</h3> - - <p>This type corresponds to a handle to a single instance of - the library. Note that the corresponding - structure <tt>FT_LibraryRec</tt> is not defined in public - header files, making client applications unable to access - its internal fields.</p> - - <p>The library object is the <em>parent</em> of all other - objects in FreeType 2. You need to create a new - library instance before doing anything else with the - library. Similarly, destroying it will automatically - destroy all its children (i.e., faces and modules).</p> - - <p>Typical client applications should - call <a href="../reference/ft2-base_interface.html#ft_init_freetype"><code>FT_Init_FreeType</code></a> - in order to create a new library object, ready to be used - for further actions.</p> - - <p>Another alternative is to create a fresh new library - instance by calling the function - <a href="../reference/ft2-module_management.html#ft_new_library"><code>FT_New_Library</code></a>, - defined in the - <tt>ftmodule.h</tt> public header file. This function - will however return an ‘empty’ library - instance with no module registered in it. You can - ‘install’ modules in the instance by calling - <a href="../reference/ft2-module_management.html#ft_add_module"><code>FT_Add_Module</code></a> - manually.</p> - - <p>Calling <tt>FT_Init_FreeType</tt> is a lot more - convenient, because this function basically registers a - set of default modules into each new library instance. - The way this list is accessed or computed is determined at - build time, and depends on the content of - the <tt>ftinit</tt> component. This process is explained - in details later in this document.</p> - - <p>For now, one should consider that library objects are - created with <tt>FT_Init_FreeType</tt>, and destroyed - along with all children - with <a href="../reference/ft2-base_interface.html#ft_done_freetype"><code>FT_Done_FreeType</code></a>.</p> - - - <h3 id="section-3">3. The <tt>FT_Face</tt> class</h3> - - <p>A face object corresponds to a single <em>font face</em>, - i.e., a specific typeface with a specific style. For - example, ‘Arial’ and ‘Arial - Italic’ correspond to two distinct faces.</p> - - <p>A face object is normally created - through <a href="../reference/ft2-base_interface.html#ft_new_face"><code>FT_New_Face</code></a>. - This function takes the following parameters: - an <tt>FT_Library</tt> handle, a C file pathname used to - indicate which font file to open, an index used to decide - which face to load from the file (a single file may - contain several faces in certain cases), and the address - of an <tt>FT_Face</tt> handle. It returns an error - code.</p> - - <pre> -FT_Error FT_New_Face( FT_Library library, - const char* filepathname, - FT_Long face_index, - FT_Face* face );</pre> - - <p>In case of success, the function - returns <tt>FT_Err_Ok</tt> (which is value 0), and - the handle pointed to by the <tt>face</tt> parameter is - set to a non-NULL value.</p> - - <p>Note that the face object contains several fields used to - describe global font data that can be accessed directly by - client applications, for example, the total number of - glyphs in the face, the face's family name, style name, - the EM size for scalable formats, etc. For more details, - look at - the <a href="../reference/ft2-base_interface.html#ft_facerec"><code>FT_FaceRec</code></a> - definition in the FreeType 2 API Reference.</p> - - - <h3 id="section-4">4. The <tt>FT_Size</tt> class</h3> - - <p>Each <tt>FT_Face</tt> object has one or more - <tt>FT_Size</tt> objects. A <em>size object</em> stores - data specific to a given character width and height. Each - newly created face object has one size, which is directly - accessible as <tt>face->size</tt>.</p> - - <p>The contents of a size object can be changed by calling - <a href="../reference/ft2-base_interface.html#ft_request_size"><code>FT_Request_Size</code></a>, <a href="../reference/ft2-base_interface.html#ft_set_pixel_sizes"><code>FT_Set_Pixel_Sizes</code></a>, - or <a href="../reference/ft2-base_interface.html#ft_set_char_size"><code>FT_Set_Char_Size</code></a>.</p> - - <p>A new size object can be created - with <a href="../reference/ft2-sizes_management.html#ft_new_size"><code>FT_New_Size</code></a>, - and destroyed manually - with <a href="../reference/ft2-sizes_management.html#ft_done_size"><code>FT_Done_Size</code></a>. - Note that typical applications don't need to do this - normally: usually it is fully sufficient to use the - default size object provided with - each <tt>FT_Face</tt>.</p> - - <p>The public fields of <tt>FT_Size</tt> objects are defined - in a very small structure - named <a href="../reference/ft2-base_interface.html#ft_sizerec"><code>FT_SizeRec</code></a>. - However, it is important to understand that some font - drivers define their own derivatives of <tt>FT_Size</tt> - to store important internal data that is re-computed each - time the character size changes. Most of the time, these - are size-specific <em>font hints</em>.</p> - - <p>For example, the TrueType driver stores the scaled CVT - (Control Value Table) data that results from the execution - of the ‘prep’ program in a <tt>TT_Size</tt> - structure, while the Type 1 driver stores scaled - global metrics (like blue zones) in a <tt>T1_Size</tt> - object. Don't worry if you don't understand the current - paragraph; most of this stuff is highly font format - specific and doesn't need to be explained to client - developers :-)</p> - - - <h3 id="section-5">5. The <tt>FT_GlyphSlot</tt> class</h3> - - <p>The purpose of a <em>glyph slot</em> is to provide a - place where glyph images can be loaded one by one easily, - independently of the glyph image format (bitmap, vector - outline, or anything else).</p> - - <p>Ideally, once a glyph slot is created, any glyph image - can be loaded into it without additional memory - allocation. In practice, this is only possible with - certain formats like TrueType which explicitly provide - data to compute a slot's maximum size.</p> - - <p>Another reason for glyph slots is that they are also used - to hold format-specific hints for a given glyphs as well - as all other data necessary to correctly load the - glyph.</p> - - <p>The - base <a href="../reference/ft2-base_interface.html#ft_glyphslotrec"><code>FT_GlyphSlotRec</code></a> - structure only presents glyph metrics and images to client - applications, while the actual implementation may contain - more sophisticated data.</p> - - <p>As an example, the - TrueType-specific <tt>TT_GlyphSlotRec</tt> structure - contains additional fields to hold glyph-specific - bytecode, transient outlines used during the hinting - process, and a few other things. The - Type 1-specific <tt>T1_GlyphSlotRec</tt> structure - holds glyph hints during glyph loading, as well as - additional logic used to properly hint the glyphs when a - native Type 1 hinter is used.</p> - - <p>Each face object has a single glyph slot that is directly - accessible as <tt>face->glyph</tt>.</p> - - - <h3 id="section-6">6. The <tt>FT_CharMap</tt> class</h3> - - <p>The <tt>FT_CharMap</tt> type is a handle to character map - objects, or <em>charmaps</em>. A charmap is simply some - sort of table or dictionary to translate character codes - in a given encoding into glyph indices for the font.</p> - - <p>A single face may contain several charmaps. Each one of - them corresponds to a given character repertoire, like - Unicode, Apple Roman, Windows codepages, and other - encodings.</p> - - <p>Each <tt>FT_CharMap</tt> object contains a - ‘platform’ and an ‘encoding’ field - to precisely identify the character repertoire - corresponding to it.</p> - - <p>Each font format provides its own derivative of - <a href="../reference/ft2-base_interface.html#ft_charmaprec"><code>FT_CharMapRec</code></a> - and thus needs to implement these objects.</p> - - - <h3 id="section-7">7. Objects Relationship</h3> - - <p>The following diagram summarizes what we have just said - regarding the public objects managed by the library; it - also describes their relationship.</p> - - <center> - <img src="simple-model.png" - width="453" - height="378" - alt="Simple library model"> - </center> - - <p>Note that this picture will be updated at the end of the - next chapter, related to <em>internal objects</em>.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Design</a> - </li> - <li class="tertiary"> - <a href="design-1.html">Introduction</a> - </li> - <li class="tertiary"> - <a href="design-2.html">Components and APIs</a> - </li> - <li class="tertiary"> - <a href="design-3.html" class="current">Public Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-4.html">Internal Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-5.html">Module Classes</a> - </li> - <li class="tertiary"> - <a href="design-6.html">Interfaces and Services</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/design/design-4.html b/lib/freetype/docs/design/design-4.html deleted file mode 100644 index b81fefed2..000000000 --- a/lib/freetype/docs/design/design-4.html +++ /dev/null @@ -1,406 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Design / III</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> - Design / III</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="internal-objects"> - <h2>III. Internal Objects and Classes</h2> - - <p>Let us have a look now at the <em>internal</em> objects - that FreeType 2 uses, i.e., those not directly - available to client applications, and see how they fit - into the picture.</p> - - - <h3 id="section-1">1. Memory Management</h3> - - <p>Most memory management operations are performed through - three specific routines of the base - layer: <tt>FT_Alloc</tt>, <tt>FT_Realloc</tt>, - and <tt>FT_Free</tt>. Each one of these functions expects - a <tt>FT_Memory</tt> handle as its first parameter. Note, - however, that there exist more, similar variants for - specific purposes which we skip here for simplicity.</p> - - <p><tt>FT_Memory</tt> is a pointer to a simple object that - describes the current memory pool or manager. It contains - a small table of alloc, realloc, and free functions. A - memory manager is created at library initialization time - by <tt>FT_Init_FreeType</tt>, calling the (internal) - function <tt>FT_New_Memory</tt> provided by - the <tt>ftsystem</tt> component.</p> - - <p>By default, this manager uses the ANSI functions <tt>malloc</tt>, - <tt>realloc</tt>, and <tt>free</tt>. However, - as <tt>ftsystem</tt> is a replaceable part of the base - layer, a specific build of the library could provide a - different default memory manager.</p> - - <p>Even with a default build, client applications are still - able to provide their own memory manager by not calling - <tt>FT_Init_FreeType</tt> but follow these simple - steps.</p> - - <ol> - <li> - <p>Create a new <tt>FT_Memory</tt> object by hand. The - definition - of <a href="../reference/ft2-system_interface.html#ft_memoryrec"><code>FT_MemoryRec</code></a> - is located in the public header - file <tt>ftsystem.h</tt>.</p> - </li> - <li> - <p>Call <a href="../reference/ft2-module_management.html#ft_new_library"><code>FT_New_Library</code></a> - to create a new library instance using your custom - memory manager. This new library doesn't yet contain - any registered modules.</p> - </li> - <li> - <p>Register the set of default modules by calling the - function <a href="../reference/ft2-module_management.html#ft_add_default_modules"><code>FT_Add_Default_Modules</code></a> - provided by the <tt>ftinit</tt> component, or manually - register your drivers by repeatedly - calling <a href="../reference/ft2-module_management.html#ft_add_module"><code>FT_Add_Module</code></a>.</p> - </li> - </ol> - - - <h3 id="section-2">2. Input Streams</h3> - - <p>Font files are always read through <tt>FT_Stream</tt> - objects. The definition - of <a href="../reference/ft2-system_interface.html#ft_streamrec"><code>FT_StreamRec</code></a> - is located in the public header file <tt>ftsystem.h</tt>, - which allows client developers to provide their own - implementation of streams if they wish so.</p> - - <p>The - function <a href="../reference/ft2-base_interface.html#ft_new_face"><code>FT_New_Face</code></a> - always automatically creates a new stream object from the - C pathname given as its second argument. This is - achieved by calling the (internal) function - <tt>FT_Stream_Open</tt> provided by the <tt>ftsystem</tt> - component. As the latter is replaceable, the - implementation of streams may vary greatly between - platforms.</p> - - <p>As an example, the default implementation of streams is - located in the file <tt>src/base/ftsystem.c</tt> and uses - the ANSI functions <tt>fopen</tt>, <tt>fseek</tt>, - and <tt>fread</tt>. However, the Unix build of - FreeType 2 provides an alternative implementation - that uses memory-mapped files, when available on the host - platform, resulting in a significant access speed-up.</p> - - <p>FreeType distinguishes between memory-based and - disk-based streams. In the first case, all data is - directly accessed in memory (e.g., ROM-based, write-only - static data, and memory-mapped files), while in the - second, portions of the font files are read in chunks - called <em>frames</em>, and temporarily buffered similarly - through typical seek and read operations.</p> - - <p>The FreeType stream sub-system also implements extremely - efficient algorithms to very quickly load structures from - font files while ensuring complete safety in the case of a - ‘broken file’.</p> - - <p>The - function <a href="../reference/ft2-base_interface.html#ft_new_memory_face"><code>FT_New_Memory_Face</code></a> - can be used to directly create and open - an <tt>FT_Face</tt> object from data that is readily - available in memory (including ROM-based fonts).</p> - - <p>Finally, in the case where a custom input stream is - needed, client applications can use the - function <a href="../reference/ft2-base_interface.html#ft_open_face"><code>FT_Open_Face</code></a>, - which can accept custom input streams. This may be useful - in the case of compressed or remote font files, or even - embedded font files that need to be extracted from certain - documents.</p> - - <p>Note that each face owns a single stream, which is also - destroyed - by <a href="../reference/ft2-base_interface.html#ft_done_face"><code>FT_Done_Face</code></a>.</p> - - - <h3 id="section-3">3. Modules</h3> - - <p>A FreeType 2 module is itself a piece of code. - However, the library creates a single <tt>FT_Module</tt> - object for each module that is registered - when <tt>FT_Add_Module</tt> is called.</p> - - <p>The definition of <tt>FT_ModuleRec</tt> is not publicly - available to client applications. However, - each <em>module type</em> is described by a simple public - structure - named <a href="../reference/ft2-module_management.html#ft_module_class"><code>FT_Module_Class</code></a>, - defined in header file - <tt>ftmodule.h</tt>, and is described later in this - document.</p> - - <p>You need a pointer to an <tt>FT_Module_Class</tt> - structure when - calling <a href="../reference/ft2-module_management.html#ft_add_module"><code>FT_Add_Module</code></a>.</p> - - <pre> -FT_Error -FT_Add_Module( FT_Library library, - const FT_Module_Class* clazz );</pre> - - <p>This function does the following tasks.</p> - - <ul> - <li> - <p>Check whether the library already holds a module - object corresponding to the same module name as the - one found in <tt>FT_Module_Class</tt>.</p> - </li> - <li> - <p>If this is the case, compare the module version - number to see whether it is possible - to <em>upgrade</em> the module to a new version. If - the module class's version number is smaller than the - already installed one, return immediately. Similarly, - check that the version of FreeType 2 that is - running is correct compared to the one required by the - module.</p> - </li> - <li> - <p>Create a new <tt>FT_Module</tt> object, using data - and flags of the module class to determine its byte - size and how to properly initialize it.</p> - </li> - <li> - <p>If a module initializer is present in the module - class, call it to complete the module object's - initialization.</p> - </li> - <li> - <p>Add the new module to the library's list of - ‘registered’ modules. In case of an - upgrade, destroy the previous module object.</p> - </li> - </ul> - - <p>Note that this function doesn't return - an <tt>FT_Module</tt> handle, given that module objects - are completely internal to the library (and client - applications shouldn't normally mess with - them :-)</p> - - <p>Finally, it is important to understand that - FreeType 2 recognizes and manages several kinds of - modules. These will be explained later on in this - document.</p> - - <ul> - <li> - <p><em>Renderer</em> modules are used to convert native - glyph images to bitmaps or pixmaps. FreeType 2 - comes with two renderer modules by default: one to - generate monochrome bitmaps, the other to generate - anti-aliased pixmaps.</p> - </li> - <li> - <p><em>Font driver</em> modules are used to support one - or more font formats. Typically, each font driver - provides a specific implementation or derivative - of <tt>FT_Face</tt>, <tt>FT_Size</tt>, - <tt>FT_GlyphSlot</tt>, as well - as <tt>FT_CharMap</tt>.</p> - </li> - <li> - <p><em>Helper</em> modules are shared by several font - drivers. For example, the <tt>sfnt</tt> module parses - and manages tables found in SFNT-based font formats; - it is then used by both the TrueType font and CFF - drivers.</p> - </li> - <li> - <p>Finally, the <em>auto-hinter</em> module has a - specific place in the library's design, as its role is - to process vectorial glyph outlines, independently of - their native font format, to produce optimal results - at small pixel sizes.</p> - </li> - </ul> - - <p>Note that every <tt>FT_Face</tt> object is <em>owned</em> - by the corresponding font driver, depending on the - original font file's format. This means that all face - objects are destroyed when a module is removed or - unregistered from a library instance (typically by calling - the <a href="../reference/ft2-module_management.html#ft_remove_module"><code>FT_Remove_Module</code></a> - function). Because of this, you should always take care - that no <tt>FT_Face</tt> object is opened when you upgrade - or remove a module from a library, as this could cause - unexpected object deletion!</p> - - - <h3 id="section-4">4. Summary</h3> - - <p>Finally, the following picture illustrates what has been - said in this section, as well as the previous, by - presenting the complete object graph of FreeType 2's - base design.</p> - - <center> - <img src="library-model.png" - width="411" - height="405" - alt="Complete library model"> - </center> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Design</a> - </li> - <li class="tertiary"> - <a href="design-1.html">Introduction</a> - </li> - <li class="tertiary"> - <a href="design-2.html">Components and APIs</a> - </li> - <li class="tertiary"> - <a href="design-3.html">Public Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-4.html" class="current">Internal Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-5.html">Module Classes</a> - </li> - <li class="tertiary"> - <a href="design-6.html">Interfaces and Services</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/design/design-5.html b/lib/freetype/docs/design/design-5.html deleted file mode 100644 index edc9de3ae..000000000 --- a/lib/freetype/docs/design/design-5.html +++ /dev/null @@ -1,548 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Design / IV</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> - Design / IV</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="module-classes"> - <h2>IV. Module Classes</h2> - - <p>We will now try to explain more precisely - the <em>types</em> of modules that FreeType 2 is - capable of managing.</p> - - <ul> - <li> - <p><em>Renderer</em> modules manage scalable glyph - images. This means <em>transforming</em> them, - computing their <em>bounding box</em>, - and <em>converting</em> them to - either <em>monochrome</em> or <em>anti-aliased</em> - bitmaps.</p> - - <p>Note that FreeType 2 is capable of dealing - with <em>any</em> kind of glyph images, as long as a - renderer module is provided for it. The library comes - by default with two renderers.</p> - - <table> - <tr valign=top> - <td> - <p><tt>raster</tt></p> - </td> - <td> - <p>Supports the conversion of vectorial outlines - (described by - an <a href="../reference/ft2-outline_processing.html#ft_outline"><code>FT_Outline</code></a> - object) to <em>monochrome</em> bitmaps.</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>smooth</tt></p> - </td> - <td> - <p>Supports the conversion of the same outlines to - <em>anti-aliased</em> pixmaps (using 256 levels of - gray). Note that this renderer also supports - direct span generation, this is, it provides a - hook into the engine so that the application can - manipulate the rendering results itself, instead - of letting the rasterizer fill a pixmap. - See <a href="../tutorial/example4.cpp">this - tutorial demo file</a> for an example.</p> - </td> - </tr> - </table> - </li> - <li> - <p><em>Font driver</em> modules support one or more - specific font formats. Here is a list with the most - important ones.</p> - - <table> - <tr valign=top> - <td> - <p><tt>truetype</tt></p> - </td> - <td> - <p>TrueType fonts.</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>type1</tt></p> - </td> - <td> - <p>Postscript Type 1 fonts, both in binary - (<tt>.pfb</tt>) or ASCII (<tt>.pfa</tt>) - formats, including Multiple Master fonts.</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>cid</tt></p> - </td> - <td> - <p>Postscript CID-keyed fonts.</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>cff</tt></p> - </td> - <td> - <p>OpenType CFF and CFF2, bare CFF, and CEF fonts - (CEF is a derivative of CFF used by Adobe in its - SVG viewer).</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>winfonts</tt></p> - </td> - <td> - <p>Windows bitmap fonts (i.e., <tt>.fon</tt> and - <tt>.fnt</tt>).</p> - </td> - </tr> - </table> - - <p>Note that font drivers can support bitmapped or - scalable glyph images. A given font driver that - supports Bézier outlines - through <tt>FT_Outline</tt> can also provide its own - hinter, or rely on FreeType's <tt>autofit</tt> - module for auto-hinting.</p> - </li> - <li> - <p><em>Helper</em> modules are used to hold shared code - that is often used by several font drivers, or even - other modules. The most important are as follows.</p> - - <table> - <tr valign=top> - <td> - <p><tt>sfnt</tt></p> - </td> - <td> - <p>Support for font formats based on - the <tt>SFNT</tt> storage scheme: TrueType, - OpenType, as well as other variants (like - TrueType fonts that only contain embedded - bitmaps).</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>psnames</tt></p> - </td> - <td> - <p>Various useful functions related to glyph name - ordering and Postscript encodings and charsets. - For example, this module is capable of - automatically synthetizing a Unicode charmap - from a Type 1 glyph name dictionary.</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>psaux</tt></p> - </td> - <td> - <p>Auxiliary functions related to Postscript - charstring decoding, as needed by - the <tt>type1</tt>, <tt>cid</tt>, - and <tt>cff</tt> drivers.</p> - </td> - </tr> - </table> - </li> - <li> - <p>Finally, the <em>auto-hinter</em> module - (<tt>autofit</tt>) has a specific role in - FreeType 2, as it can be used automatically - during glyph loading to process individual glyph - outlines when a font driver doesn't provide its own - hinting engine.</p> - - <p>A paper published in the EuroTeX 2003 proceedings, - titled <a href="http://www.tug.org/TUGboat/tb24-3/lemberg.pdf"><em>Real-Time - Grid Fitting of Typographic Outlines</em></a>, gives - further insight into the auto-hinting system's inner - workings.</p> - </li> - </ul> - - <p>We will now study how modules are described, then managed - by the library.</p> - - - <h3 id="section-1">1. The <tt>FT_Module_Class</tt> - Structure</h3> - - <p>Here is the definition of <tt>FT_Module_Class</tt>, with - some explanations. The following code is taken from - <tt>ftmodapi.h</tt>.</p> - - <pre> -typedef struct FT_Module_Class_ -{ - FT_ULong module_flags; - FT_Int module_size; - const FT_String* module_name; - FT_Fixed module_version; - FT_Fixed module_requires; - - const void* module_interface; - - FT_Module_Constructor module_init; - FT_Module_Destructor module_done; - FT_Module_Requester get_interface; - -} FT_Module_Class;</pre> - - <p>A description of its fields.</p> - - <table> - <tr valign=top> - <td> - <p><tt>module_flags</tt></p> - </td> - <td> - <p>A set of bit flags to describe the module's - category. Valid values are listed below.</p> - - <ul> - <li> - <tt>FT_MODULE_FONT_DRIVER</tt> if the module is a - font driver - </li> - <li> - <tt>FT_MODULE_RENDERER</tt> if the module is a - renderer - </li> - <li> - <tt>FT_MODULE_HINTER</tt> if the module is an - auto-hinter - </li> - <li> - <tt>FT_MODULE_DRIVER_SCALABLE</tt> if the module - is a font driver supporting scalable glyph formats - </li> - <li> - <tt>FT_MODULE_DRIVER_NO_OUTLINES</tt> if the - module is a font driver supporting scalable glyph - formats that <em>cannot</em> be described by - an <tt>FT_Outline</tt> object - </li> - <li> - <tt>FT_MODULE_DRIVER_HAS_HINTER</tt> if the module - is a font driver that provides its own hinting - scheme/algorithm - </li> - <li> - <tt>FT_MODULE_DRIVER_HINTS_LIGHTLY</tt> if the - module is a font driver that generates - ‘light’ hints (this is, only along the - vertical axis). - </li> - </ul> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>module_size</tt></p> - </td> - <td> - <p>An integer that gives the size in <em>bytes</em> of - a given module object. This should <em>never</em> - be less than <tt>sizeof(FT_ModuleRec)</tt>, but can - be more if the module needs to sub-class the - base <tt>FT_ModuleRec</tt> class.</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>module_name</tt></p> - </td> - <td> - <p>The module's internal name, coded as a simple ASCII - C string. There can't be two modules with the - same name registered in a given <tt>FT_Library</tt> - object. However, <tt>FT_Add_Module</tt> uses - the <tt>module_version</tt> field to detect module - upgrades and perform them cleanly, even at - run-time.</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>module_version</tt></p> - </td> - <td> - <p>A 16.16 fixed-point number giving the module's - major and minor version numbers. It is used to - determine whether a module needs to be upgraded when - calling <tt>FT_Add_Module</tt>.</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>module_requires</tt></p> - </td> - <td> - <p>A 16.16 fixed-point number giving the version of - FreeType 2 that is required to install this - module. The default value is 0x20000 for FreeType - version 2.x</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>module_interface</tt></p> - </td> - <td> - <p>Most modules support one or more - ‘interfaces’, i.e., tables of function - pointers. This field points to the module's main - interface, if there is one. It is a short-cut that - prevents users of the module to - call <tt>get_interface</tt> each time they need to - access one of the object's common entry points.</p> - - <p>Note that it is optional, and can be set to NULL. - Other interfaces can also be accessed through - the <tt>get_interface</tt> field.</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>module_init</tt></p> - </td> - <td> - <p>A pointer to a function to initialize the fields of - a fresh new <tt>FT_Module</tt> object. It is - called <em>after</em> the module's base fields have - been set by the library, and is generally used to - initialize the fields of <tt>FT_ModuleRec</tt> - subclasses.</p> - - <p>Most module classes set it to NULL to indicate that - no extra initialization is necessary.</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>module_done</tt></p> - </td> - <td> - <p>A pointer to a function to finalize the fields of a - given <tt>FT_Module</tt> object. Note that it is - called <em>before</em> the library unsets the - module's base fields, and is generally used to - finalize the fields of <tt>FT_ModuleRec</tt> - subclasses.</p> - - <p>Most module classes set it to NULL to indicate that - no extra finalization is necessary</p> - </td> - </tr> - <tr valign=top> - <td> - <p><tt>get_interface</tt></p> - </td> - <td> - <p>A pointer to a function to request the address of a - given module interface. Set it to NULL if you don't - need to support additional interfaces but the main - one.</p> - </td> - </tr> - </table> - - - <h3 id="section-2">2. The <tt>FT_Module</tt> Type</h3> - - <p>The <tt>FT_Module</tt> type is a handle (i.e., a pointer) - to a given module object or instance, whose base structure - is given by the internal <tt>FT_ModuleRec</tt> type. We - will intentionally <em>not</em> describe this structure - here, as there is no point to look so far into the - library's design.</p> - - <p>When <tt>FT_Add_Module</tt> is called, it first allocates - a new module instance, using the <tt>module_size</tt> - class field to determine its byte size. The function - initializes the root <tt>FT_ModuleRec</tt> field, then - calls the class-specific initializer <tt>module_init</tt> - when this field is not set to NULL.</p> - - <p>Note that the library defines several sub-classes of - <tt>FT_ModuleRec</tt>.</p> - - <ul> - <li> - <p><tt>FT_Renderer</tt> for renderer modules</p> - </li> - <li> - <p><tt>FT_Driver</tt> for font driver modules</p> - </li> - <li> - <p><tt>FT_AutoHinter</tt> for the auto-hinter</p> - </li> - </ul> - - <p>Helper modules use the base <tt>FT_ModuleRec</tt> - type.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Design</a> - </li> - <li class="tertiary"> - <a href="design-1.html">Introduction</a> - </li> - <li class="tertiary"> - <a href="design-2.html">Components and APIs</a> - </li> - <li class="tertiary"> - <a href="design-3.html">Public Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-4.html">Internal Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-5.html" class="current">Module Classes</a> - </li> - <li class="tertiary"> - <a href="design-6.html">Interfaces and Services</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/design/design-6.html b/lib/freetype/docs/design/design-6.html deleted file mode 100644 index cf7513ab7..000000000 --- a/lib/freetype/docs/design/design-6.html +++ /dev/null @@ -1,415 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Design / V</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> - Design / V</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="module-classes"> - <h2>V. Interfaces and Services</h2> - - <p>We shall now go into detail about interfaces and services - in FreeType.</p> - - <p><em>Interfaces</em> in FreeType are analogous to those - found in object-oriented programming. They can be thought - of as internal public APIs, and are essentially tables of - function pointers.</p> - - <p>Interfaces only describe the form and functionality, but - the actual function body may be implemented elsewhere. - The module that is implementing the interface will then - pass the required function pointers to the table. This - gives modularity and easy extendability.</p> - - <p>There are two main kinds of interfaces: <em>module</em> - interfaces, and <em>services</em>.</p> - - <p>Module interfaces are defined for each module. For - example, every font driver provides its own set of - procedures for use in the base layer, which are registered - in an <tt>FT_Driver</tt>. This way, very different font - drivers can be used in the same way in the base layer.</p> - - <p>Services are cross-module interfaces. These provide - functionality needed in several font drivers. </p> - - <p>Services are created when code from one module needs to - be used in another. Rather than include files from - another module, a service is created instead. Now, the - other module just needs to include the header defining the - interface.</p> - - <p>Helper modules are an extreme example of this; all their - public functionality is made for use in other font drivers - and hence are in a single service.</p> - - - <h3>In-depth guide: Creating a service</h3> - - <p>This section will teach you how to write your own - service.</p> - - <ol> - <li> - <p>Make the service interface header.</p> - - <p>We will be calling our service demo for demonstration - purposes. First, create the header file, which goes - in <tt>include/freetype/internal/services</tt>, and - add the boilerplate.</p> - - <pre> -#include FT_INTERNAL_SERVICE_H -FT_BEGIN_HEADER -#define FT_SERVICE_ID_DEMO "demo" - -/* ... */ - -FT_END_HEADER</pre> - - <p>This line in particular is required to register the - new service later on.</p> - - <pre> -#define <em>service-id service-tag</em></pre> - - </li> - <li> - <p>We will have identified some functions that are - needed in another module. Extract the function - signatures of these and place them in the header.</p> - - <pre> -[typedef <em>return-type</em> - (*<em>type-name</em>)(<em>function-signature</em>);]+</pre> - - <p>Example:</p> - - <pre> -typedef FT_Error - (*SampleDoSomethingFunc)( int foo ); -typedef void - (*SampleDoAnotherFunc)( int foo, - float bar );</pre> - - </li> - <li> - <p>Define the service interface.</p> - - <p>Use the <tt>FT_DEFINE_SERVICE</tt> macro to do - this.</p> - - <pre> -FT_DEFINE_SERVICE( <em>service-name</em> ) -{ - [<em>type-name interface-entry</em>;]+ -}</pre> - - <p>Example:</p> - - <pre> -FT_DEFINE_SERVICE( Demo ) -{ - SampleDoSomethingFunc doSomething; - SampleDoAnotherFunc doAnother; -};</pre> - - <p>Here is the definition of the above macro - (in <tt>ftserv.h</tt>).</p> - - <pre> -#define FT_DEFINE_SERVICE( name ) \ - typedef struct FT_Service_ ## name ## Rec_ \ - FT_Service_ ## name ## Rec ; \ - typedef struct FT_Service_ ## name ## Rec_ \ - const * FT_Service_ ## name ; \ - struct FT_Service_ ## name ## Rec_</pre> - - <p>This defines a new struct - called <tt>FT_Service_DemoRec</tt>, along with a - handle type for the - struct, <tt>FT_Service_Demo</tt>.</p> - </li> - <li> - <p>Register (and/or implement) the functions for the - newly created interface.</p> - - <p>In the module implementing the interface, add a - definition like the following</p> - - <pre> -static const <em>service-record table-name</em> = -{ - <em>function-name</em> - [,<em>function-name2</em> [,...]] -}</pre> - - <p>which corresponds to the interface defined in - step 3. Example:</p> - - <pre> -static const FT_Service_DemoRec demo_service_rec = -{ - function1, - function2 -};</pre> - - <p>This initializes the function pointers table. In - this example, <tt>function1</tt> has the function - signature of <tt>SampleDoSomethingFunc</tt> and - implements the <tt>doSomething</tt> functionality, and - so on.</p> - </li> - <li> - <p>Register the new service.</p> - - <p>Next, add this code to define the service list in - this module, or append the new service to an existing - list.</p> - - <pre> -static const FT_ServiceDescRec <em>service-list-name</em>[] = -{ - { <em>service-id</em>, &<em>table-name</em> }, - [{ <em>service-id2</em>, &<em>table-name2</em> }, [...]] - { NULL, NULL } -}</pre> - - <p>Example:</p> - - <pre> -static const FT_ServiceDescRec demo_services[] = -{ - { FT_SERVICE_ID_DEMO, &demo_service_rec }, - { NULL, NULL } -};</pre> - - <p><em>service-id</em> is what we <tt>#define</tt>'d in - the service header file in step 1. Note that - the <tt>{NULL, NULL}</tt> sentinel value at the - end is required.</p> - - <p>Now we need a way for other modules to find this - service. First, we need to implement - the <tt>get_interface</tt> function in - <tt>FT_Module_Class</tt>. Here is a minimal example - that does not do any validation.</p> - - <pre> -FT_CALLBACK_DEF( FT_Module_Interface ) -<em>get-interface-name</em>( FT_Module module, - const char* module_interface ) -{ - return ft_service_list_lookup( <em>service-list-name</em>, - module_interface ); -}</pre> - - <p>Then, pass it into the <tt>FT_DEFINE_MODULE</tt> - macro for this module.</p> - - <pre> -(FT_Module_Requester) <em>get-interface-name</em></pre> - - <p>The last step is optional but recommended, which is - to register the new service header - in <tt>ftserv.h</tt>. - - <pre> -#define FT_SERVICE_DEMO_H <freetype/internal/services/svdemo.h></pre> - - </li> - <li> - <p>Use the new service.</p> - - <p>Now, in the file that wants to use the service, add - the following code to get the service.</p> - - <pre> -<em>service-record-handle</em> service; - - -FT_FACE_FIND_GLOBAL_SERVICE( face, - service, - <em>service-id-tail</em> );</pre> - - <p><tt>face</tt> should be of type <tt>FT_Face</tt>, - which is usually the current face instance being used - in the driver, and FreeType tries to find the service - in the driver of this face first, before searching all - other modules.</p> - - <p><em>service-id-tail</em> is the part - of <em>service-id</em> - following <tt>FT_SERVICE_ID_</tt>. - - <p>Now to call some function in the service.</p> - - <pre> -service-><em>interface-entry</em>( <em>params</em> );</pre> - - <p>Example:</p> - - <pre> -FT_Service_Demo demo; -FT_Error error; - - -FT_FACE_FIND_GLOBAL_SERVICE( face, demo, DEMO ); - -error = demo->doSomething(0); -</pre> - - </li> - </ol> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Design</a> - </li> - <li class="tertiary"> - <a href="design-1.html">Introduction</a> - </li> - <li class="tertiary"> - <a href="design-2.html">Components and APIs</a> - </li> - <li class="tertiary"> - <a href="design-3.html">Public Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-4.html">Internal Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-5.html">Module Classes</a> - </li> - <li class="tertiary"> - <a href="design-6.html" class="current">Interfaces and - Services</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/design/detailed-design.png b/lib/freetype/docs/design/detailed-design.png Binary files differdeleted file mode 100644 index 1f475db1f..000000000 --- a/lib/freetype/docs/design/detailed-design.png +++ /dev/null diff --git a/lib/freetype/docs/design/index.html b/lib/freetype/docs/design/index.html deleted file mode 100644 index 4fe800f3c..000000000 --- a/lib/freetype/docs/design/index.html +++ /dev/null @@ -1,239 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Design</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Design</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="introduction"> - <p>This document gives an overview of some FreeType 2 - internals. Read this carefully if you want to understand - the innards of the library in order to hack or extend - it.</p> - - <p>Note that many, quite important details are still - missing, which are hopefully addressed in the not too - distant future. Volunteers to help with this task are - highly welcomed!</p> - </div> - - <!-- ************************************************** --> - - <div id="contents"> - <h3><a href="design-1.html">Introduction</a></h3> - - <h3><a href="design-2.html">I. Components and APIs</a></h3> - - <h3><a href="design-3.html">II. Public Objects and - Classes</a></h3> - <ul> - <li> - <a href="design-3.html#section-1">1. Object Orientation - in FreeType 2</a> - </li> - <li> - <a href="design-3.html#section-2">2. The <tt>FT_Library</tt> - class</a> - </li> - <li> - <a href="design-3.html#section-3">3. The <tt>FT_Face</tt> - class</a> - </li> - <li> - <a href="design-3.html#section-4">4. The <tt>FT_Size</tt> - class</a> - </li> - <li> - <a href="design-3.html#section-5">5. The <tt>FT_GlyphSlot</tt> - class</a> - </li> - <li> - <a href="design-3.html#section-6">6. The <tt>FT_CharMap</tt> - class</a> - </li> - <li> - <a href="design-3.html#section-7">7. Objects - Relationship</a> - </li> - </ul> - - <h3><a href="design-4.html">III. Internal Objects and - Classes</a></h3> - <ul> - <li> - <a href="design-4.html#section-1">1. Memory Management</a> - </li> - <li> - <a href="design-4.html#section-2">2. Input Streams</a> - </li> - <li> - <a href="design-4.html#section-3">3. Modules</a> - </li> - <li> - <a href="design-4.html#section-4">4. Summary</a> - </li> - </ul> - - <h3><a href="design-5.html">IV. Module Classes</a></h3> - <ul> - <li> - <a href="design-5.html#section-1">1. The <tt>FT_Module_Class</tt> - Structure</a> - </li> - <li> - <a href="design-5.html#section-2">2. The <tt>FT_Module</tt> - Type</a> - </li> - </ul> - - <h3><a href="design-6.html">V. Interfaces and - Services</a></h3> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html" class="current">FreeType Design</a> - </li> - <li class="tertiary"> - <a href="design-1.html">Introduction</a> - </li> - <li class="tertiary"> - <a href="design-2.html">Components and APIs</a> - </li> - <li class="tertiary"> - <a href="design-3.html">Public Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-4.html">Internal Objects and Classes</a> - </li> - <li class="tertiary"> - <a href="design-5.html">Module Classes</a> - </li> - <li class="tertiary"> - <a href="design-6.html">Interfaces and Services</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/design/library-model.png b/lib/freetype/docs/design/library-model.png Binary files differdeleted file mode 100644 index 27117884b..000000000 --- a/lib/freetype/docs/design/library-model.png +++ /dev/null diff --git a/lib/freetype/docs/design/simple-model.png b/lib/freetype/docs/design/simple-model.png Binary files differdeleted file mode 100644 index 500ad30c5..000000000 --- a/lib/freetype/docs/design/simple-model.png +++ /dev/null diff --git a/lib/freetype/docs/documentation.html b/lib/freetype/docs/documentation.html deleted file mode 100644 index f25410bc9..000000000 --- a/lib/freetype/docs/documentation.html +++ /dev/null @@ -1,192 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - - <link rel="icon" - href="image/favicon_-60.ico"> - <link rel="shortcut icon" - href="image/favicon_-60.ico"> - <link rel="stylesheet" - type="text/css" - href="css/freetype2_-60.css"> - - <script type="text/javascript" - src="../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../js/freetype2.js"> - </script> - - <title>FreeType Documentation</title> -</head> - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Documentation</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="introduction"> - <p>Note that the FreeType documentation is also available as - a single archive from - our <a href="http://freetype.org/download.html">download page</a>.</p> - </div> - - - <!-- ************************************************** --> - - <div id="links"> - <h3><a href="glyphs/index.html">FreeType Glyph - Conventions</a></h3> - - <p>This document is a <em>must-read</em> for any user of the - library.</p> - - <h3><a href="ft2faq.html">The FreeType FAQ</a></h3> - - <h3><a href="tutorial/index.html">The FreeType Tutorial</a></h3> - - <h3><a href="reference/index.html">The FreeType API - Reference</a></h3> - - <h3><a href="design/index.html">The Design of - FreeType</a></h3> - - <h3><a href="text-rendering-general.html">On Slight Hinting, - Proper Text Rendering, Stem Darkening and LCD - Filters</a></h3> - <p>Originally written for the 2.6.2 release, contains - background information on several details of text - rendering. Useful for better understanding the ‘big - picture’.</p> - - <h3><a href="subpixel-hinting.html">The v40 TrueType - interpreter mode</a></h3> - <p>This documents the new default hinting mode introduced - with FreeType version 2.7.</p> - - <h3><a href="rasterinfo/rasterinfo.html">The RasterInfo - Font</a></h3> - </div> - - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="index.html">Overview</a> - </li> - <li class="primary"> - <a href="documentation.html" class="current">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="glyphs/index.html">Glyph Conventions</a> - </li> - <li class="secondary"> - <a href="ft2faq.html">FAQ</a> - </li> - <li class="secondary"> - <a href="tutorial/step1.html">Tutorial</a> - </li> - <li class="secondary"> - <a href="reference/index.html">API Reference</a> - </li> - <li class="secondary"> - <a href="design/index.html">Design</a> - </li> - <li class="secondary"> - <a href="rasterinfo/rasterinfo.html">The RasterInfo Font</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/ft2faq.html b/lib/freetype/docs/ft2faq.html deleted file mode 100644 index 92095d14a..000000000 --- a/lib/freetype/docs/ft2faq.html +++ /dev/null @@ -1,717 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=US-ASCII"> - <meta name="description" - content="FreeType FAQ"> - <link rel="stylesheet" - href="css/freetype.css"> - <title>FreeType 2 FAQ</title> -</head> - -<body text="#000000" - bgcolor="#FFFFFF" - link="#0000EF" - vlink="#51188E" - alink="#FF0000"> - -<table width="100%" - border="0" - cellspacing="0" - cellpadding="5"> - <tr> - <td bgcolor="#06425F"> - <a href="http://freetype.org/index.html"> - <img src="image/fond3.jpg" - align="right" - border="0" - hspace="0" - vspace="0" - alt="FreeType Homepage"> - </a> - </td> - </tr> - - <tr> - <td bgcolor="#06425F"> - <h1 class="intro">FREETYPE 2 FAQ</h1> - </td> - </tr> - - <tr> - <td bgcolor="#669999"> - <a href="#general" - class="index">General</a> - <a href="#builds" - class="index">Compilation & - Configuration</a> - <a href="#autohint" - class="index">The FreeType 2 - auto-hinter</a> - <a href="#other" - class="index">Other</a> - <font color="#FFFFFF">|</font> - <a href="documentation.html" - class="index">FreeType 2 - documentation</a> - </td> - </tr> -</table> - -<table align="center" - width="80%"> - <tr> - <td> - <h1 class="section">Table of Contents</h1> - - <ul> - <li><a href="#general">General questions</a> - <ul> - <li> - <a href="#general-what">What is FreeType 2?</a> - </li> - <li> - <a href="#general-uses">What can I do with - FreeType 2?</a> - </li> - <li> - <a href="#general-donts">What can I not do with - FreeType 2?</a> - </li> - <li> - <a href="#general-portability">How portable is - FreeType 2?</a> - </li> - <li> - <a href="#general-freetype1">What are the differences between - FreeType 1.x and FreeType 2?</a> - </li> - <li> - <a href="#general-ft1">Is FreeType 2 backwards compatible - to FreeType 1.x?</a> - </li> - <li> - <a href="#general-edit">Can I use FreeType 2 to edit - fonts or create new ones?</a> - </li> - </ul> - </li> - - <li><a href="#builds">Compilation & Configuration</a> - <ul> - <li> - <a href="#builds-compile">How do I compile the FreeType 2 - library?</a> - </li> - <li> - <a href="#builds-config">How do I configure my library - build?</a> - </li> - <li> - <a href="#builds-differences">Why does FreeType render - differently on different platforms?</a> - </li> - </ul> - </li> - - <li> - <a href="#autohint">The FreeType 2 auto-hinter</a> - <ul> - <li> - <a href="#autohint-work">How does the auto-hinter work?</a> - </li> - <li> - <a href="#autohint-other-scripts">Why doesn't the auto-hinter - work well with my script?</a> - </li> - </ul> - </li> - - <li> - <a href="#other">Other questions</a> - <ul> - <li> - <a href="#other-depth">Can I use FreeType to draw text on a - pixmap with arbitrary depth?</a> - </li> - <li> - <a href="#other-color">How can I set the colour of text - rendered by FreeType?</a> - </li> - <li> - <a href="#other-size">I set the pixel size to 8×8, but - the resulting glyphs are larger (or smaller) than that. - Why?</a> - </li> - <li> - <a href="#other-bbox">How can I compute the bounding box of a - text string without loading its glyphs before?</a> - </li> - <li> - <a href="#other-antialias">Which anti-aliasing algorithm is - used by FreeType 2?</a> - </li> - <li> - <a href="#other-opentype">When will FreeType 2 support - OpenType?</a> - </li> - </ul> - </li> - </ul> - - <p><a href="#top" - class="index"> - <img src="image/top.gif" - width="35" - height="19" - align="right" - border="0" - hspace="0" - vspace="0" - alt="Top"></a></p> - - <hr> - - <h1 class="section"> - <a name="general"> - General questions - </a> - </h1> - - <a name="general-what"></a> - <h3> - What is FreeType 2? - </h3> - - <p>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’:</p> - - <ul> - <li> - <p>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.</p> - </li> - - <li> - <p>It supports high-speed anti-aliased glyph bitmap generation - with 256 gray levels.</p> - </li> - - <li> - <p>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)</p> - </li> - </ul> - - <hr> - - <a name="general-uses"></a> - <h3> - What can I do with FreeType 2? - </h3> - - <p>FreeType 2 is already used in many products. For example, it - serves as a font rendering engine</p> - - <ul> - <li> - in graphics subsystem and libraries to display text - </li> - <li> - in text layout and pagination services to measure and eventually - render text - </li> - <li> - in font inspection and conversion tools - </li> - </ul> - - <p>Generally speaking, the library allows you to access and manage - the contents of font files in a very easy way.</p> - - <hr> - - <a name="general-donts"></a> - <h3> - What can I not do with FreeType 2? - </h3> - - <p>FreeType 2 doesn't try to perform a number of sophisticated - things, because it focuses on being an excellent <em>font - service</em>.</p> - - <p>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:</p> - - <ul> - <li> - <p><b>rendering glyphs to arbitrary surfaces</b><br> - 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.</p> - - <p>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.</p> - - <p><em>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.</em></p> - </li> - - <li> - <p><b>glyph caching</b><br> - 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.</p> - - <p>Any decent text-rendering sub-system must thus be capable of - caching glyph data in order to reach appropriate rendering - speed.</p> - - <p><em>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.</em></p> - </li> - - <li> - <p><b>text layout</b><br> - 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 - <em>font service</em> in itself. They must be handled one level - higher.</p> - </li> - </ul> - - <hr> - - <a name="general-portability"></a> - <h3> - How portable is FreeType 2? - </h3> - - <p>The FreeType 2 source code is <em>extremely</em> portable for the - following reasons:</p> - - <ul> - <li> - <p>Everything is written in standard ANSI C.</p> - </li> - <li> - <p>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.</p> - </li> - <li> - <p>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.</p> - </li> - </ul> - - <p>We have made great efforts to ensure that the library is efficient, - compact, and customizable.</p> - - <hr> - - <a name="general-freetype1"></a> - <h3> - What are the differences between FreeType 1.x and - FreeType 2? - </h3> - - <p>The biggest differences are as follows.</p> - - <ul> - <li> - <p>FreeType 1 only supports the TrueType format, while - FreeType 2 supports a lot more.</p> - </li> - - <li> - <p>The FreeType 2 API is simpler as well as more powerful - than the FreeType 1 API.</p> - </li> - - <li> - <p>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 <a - href="http://www.pango.org">Pango</a> library.</p> - </li> - </ul> - - <hr> - - <a name="general-ft1"></a> - <h3> - Is FreeType 2 backwards compatible with FreeType 1.x? - </h3> - - <p>Short answer: No. However, transition from 1.x to 2 should be - rather straightforward.</p> - - <p>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.</p> - - <hr> - - <a name="general-edit"></a> - <h3> - Can I use FreeType 2 to edit fonts or create new ones? - </h3> - - <p>No. The library has been specifically designed to <em>read</em> - font files with small code size and very low memory usage.</p> - - <p>A good, freely available font editor is <a - href="https://fontforge.github.io">FontForge</a>.</p> - - <p><a href="#top" - class="index"> - <img src="image/top.gif" - width="35" - height="19" - align="right" - border="0" - hspace="0" - vspace="0" - alt="Top"></a></p> - - <hr> - - <h1 class="section"> - <a name="builds"> - Compilation & Configuration - </a> - </h1> - - <a name="builds-compile"></a> - <h3> - How do I compile the FreeType 2 library? - </h3> - - <p>The library can be compiled in various ways, and detailed - documentation is available in documentation directory of the - FreeType 2 source tree.</p> - - <p>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.</p> - - <hr> - - <a name="builds-config"></a> - <h3> - How do I configure my build of the library? - </h3> - - <p>This is fully described in the file <tt>CUSTOMIZATION</tt> in - FreeType's documentation directory. Basically, you have to edit the - header file <tt>ftoption.h</tt> for compile-time options and to select - the modules with the file <tt>modules.cfg</tt>. Finally, it is - possible to replace the standard system interface (dealing with memory - allocation and stream I/O) with a custom one.</p> - - <hr> - - <a name="builds-differences"></a> - <h3> - Why does FreeType render differently on different platforms? - </h3> - - <p>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 - <tt>ftoption.h</tt>. Compare each platform's copy of - <tt>ftoption.h</tt> to find the differences.</p> - - <p><a href="#top" - class="index"> - <img src="image/top.gif" - width="35" - height="19" - align="right" - border="0" - hspace="0" - vspace="0" - alt="Top"></a></p> - - <hr> - - <h1 class="section"> - <a name="autohint"> - The FreeType 2 auto-hinter - </a> - </h1> - - <a name="autohint-work"></a> - <h3> - How does the auto-hinter work? - </h3> - - <p><em>Please note that the name of auto-hinter module is - <b>autofit</b>, which is a reimplementation of the old autohint - module.</em></p> - - <p>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 <a - href="http://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf">Real-Time - Grid Fitting of Typographic Outlines</a>.</p> - - <p>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 <tt>FT_LOAD_FORCE_AUTOHINT</tt> bit flag - when calling <tt>FT_Load_Glyph()</tt>.</p> - - <p>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. - - <hr> - - <a name="autohint-other-scripts"></a> - <h3> - Why doesn't the auto-hinter work well with my script? - </h3> - - <p>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.</p> - - <p>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!</p> - - <p><a href="#top" - class="index"> - <img src="image/top.gif" - width="35" - height="19" - align="right" - border="0" - hspace="0" - vspace="0" - alt="Top"></a></p> - - <hr> - - <h1 class="section"> - <a name="other"> - Other questions - </a> - </h1> - - <a name="other-depth"></a> - <h3> - Can I use FreeType to draw text on a pixmap with arbitrary depth? - </h3> - - <p>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.</p> - - <p>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 <em>direct rendering</em>.</p> - - <p>A complete example is given at the end of the <a - href="tutorial/step3.html">FreeType 2 tutorial</a>. - - <p>Note that direct rendering is <em>not</em> available with - monochrome output, as the current renderer uses a two-pass algorithm - to generate glyphs with correct drop-out control.</p> - - <hr> - - <a name="other-color"></a> - <h3> - How can I set the colour of text rendered by FreeType? - </h3> - - <p>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.</p> - - <p>Note that for anti-aliased glyphs, you can ‘set the - colour’ by using <em>direct rendering</em> as described in <a - href="#other-depth">this answer</a>.</p> - - <hr> - - <a name="other-size"></a> - <h3> - I set the pixel size to 8×8, but the resulting glyphs are - larger (or smaller) than that. Why? - </h3> - - <p>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 <b>PCF</b> or - <b>BDF</b>.</p> - - <p>Be aware that the <em>character size</em> that is set either - through <tt>FT_Set_Char_Size()</tt> or <tt>FT_Set_Pixel_Sizes()</tt> - isn't directly related to the dimension of the generated glyph - bitmaps!</p> - - <p>Rather, the character size is indeed the size of <em>an abstract - square</em>, called the <em>EM</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 - <em>distinct dimensions</em>!</p> - - <p>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.</p> - - <hr> - - <a name="other-bbox"></a> - <h3> - How can I compute the bounding box of a text string without loading - its glyphs before? - </h3> - - <p>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.</p> - - <p>It is probably best to use both a glyph and a metrics cache to - avoid recomputation.</p> - - <hr> - - <a name="other-antialias"></a> - <h3> - Which anti-aliasing algorithm is used by FreeType 2? - </h3> - - <p>The algorithm has been specifically designed for FreeType. It is - based on ideas that were originally found in the implementation of the - <a href="http://www.levien.com/libart/">libArt</a> graphics library to - compute the <em>exact pixel coverage</em> of a vector image with no - sub-sampling and filtering.</p> - - <p>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.</p> - - <p>The FreeType 2 anti-aliasing renderer is indeed - <em>faster</em> 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.</p> - - <hr> - - <a name="other-opentype"></a> - <h3> - When will FreeType 2 support OpenType? - </h3> - - <p>Well, the engine already reads OpenType/CFF files perfectly. What - it doesn't do is handling ‘OpenType Layout’ tables.</p> - - <p>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 <tt>ftstrtto</tt> to show its capabilities. However, - this code is no longer maintained, and we strongly advise to not use - it.</p> - - <p>For FreeType 2, we have decided that the layout operations - provided through these tables are better placed in a specific - text-layout library like <a href="http://www.pango.org">Pango</a>.</p> - - <p><a href="#top" - class="index"> - <img src="image/top.gif" - width="35" - height="19" - align="right" - border="0" - hspace="0" - vspace="0" - alt="Top"></a></p> - </td> - </tr> - </table> - -<font size=-3>Last update: 25-Feb-2011</font> - -<table width="100%" - border="0" - cellspacing="0" - cellpadding="5"> - <tr> - <td bgcolor="#669999"> - <a href="#general" - class="index">General</a> - <a href="#builds" - class="index">Compilation & - Configuration</a> - <a href="#autohint" - class="index">The FreeType 2 - auto-hinter</a> - <a href="#other" - class="index">Other</a> - <font color="#FFFFFF">|</font> - <a href="documentation.html" - class="index">FreeType - documentation</a> - </td> - </tr> - - <tr> - <td bgcolor="#06425F"> - <a href="http://freetype.org/index.html"> - <img src="image/fond3.jpg" - align="right" - border="0" - hspace="0" - vspace="0" - alt="FreeType Homepage"> - </a> - </td> - </tr> -</table> - -</body> -</html> diff --git a/lib/freetype/docs/glyphs/bbox1.png b/lib/freetype/docs/glyphs/bbox1.png Binary files differdeleted file mode 100644 index 41b390478..000000000 --- a/lib/freetype/docs/glyphs/bbox1.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/bbox2.png b/lib/freetype/docs/glyphs/bbox2.png Binary files differdeleted file mode 100644 index 14450830c..000000000 --- a/lib/freetype/docs/glyphs/bbox2.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/body_comparison.png b/lib/freetype/docs/glyphs/body_comparison.png Binary files differdeleted file mode 100644 index c584bfc83..000000000 --- a/lib/freetype/docs/glyphs/body_comparison.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/bravo_kerned.png b/lib/freetype/docs/glyphs/bravo_kerned.png Binary files differdeleted file mode 100644 index af62b4e84..000000000 --- a/lib/freetype/docs/glyphs/bravo_kerned.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/bravo_unkerned.png b/lib/freetype/docs/glyphs/bravo_unkerned.png Binary files differdeleted file mode 100644 index 2623e0f4c..000000000 --- a/lib/freetype/docs/glyphs/bravo_unkerned.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/clipping.png b/lib/freetype/docs/glyphs/clipping.png Binary files differdeleted file mode 100644 index 924ec1a5b..000000000 --- a/lib/freetype/docs/glyphs/clipping.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/down_flow.png b/lib/freetype/docs/glyphs/down_flow.png Binary files differdeleted file mode 100644 index 6f7be0765..000000000 --- a/lib/freetype/docs/glyphs/down_flow.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/glyphs-1.html b/lib/freetype/docs/glyphs/glyphs-1.html deleted file mode 100644 index 013820387..000000000 --- a/lib/freetype/docs/glyphs/glyphs-1.html +++ /dev/null @@ -1,275 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Glyph Conventions / I</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Glyph - Conventions / I</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="basic-typographic-concepts"> - <h2>I. Basic Typographic Concepts</h2> - - <h3 id="section-1">1. Font files, format and - information</h3> - - <p>A <em>font</em> 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 <em>font - family</em> and its multiple <em>font faces</em>, which - usually differ in style though coming from the same - template.</p> - - <p>For example, ‘Palatino Regular’ and - ‘Palatino Italic’ are two distinct - <em>faces</em> from the same <em>family</em>, called - ‘Palatino’ itself.</p> - - <p>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. <tt>arial.ttf</tt> for - ‘Arial Regular’, <tt>ariali.ttf</tt> for - ‘Arial Italic’, etc.). The file is also - called a ‘font’ but really contains a font - face.</p> - - <p>A <em>digital font</em> is thus a data file that may - contain <em>one or more font faces</em>. 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.</p> - - <p>As a convenience, a font file containing more than one - face is called a <em>font collection</em>. 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).</p> - - - <h3 id="section-2">2. Character images and - mappings</h3> - - <p>The character images are called <em>glyphs</em>. 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:</p> - - <ul> - <li> - <p>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 are typically accessed - through a simple glyph index.</p> - </li> - <li> - <p>The font file contains one or more tables, called - <em>character maps</em> (also called - ‘charmaps’ or ‘cmaps’ for - short), which are used to convert character codes for - a given encoding (e.g., ASCII, Unicode, Big5, ShiftJIS, - etc.) into glyph indices relative to the font file. A - single font face may contain several charmaps. For - example, many OpenType fonts contain an Apple-specific - charmap as well as a Unicode charmap, which makes them - usable on both Mac and Windows platforms.</p> - </li> - </ul> - - - <h3 id="section-3">3. Character and font metrics</h3> - - <p>Each glyph image is associated with various metrics which - describe how to place and manage it when rendering text; - see <a href="glyphs-3.html">section III</a> 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.</p> - - <p>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.</p> - - <p>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.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Glyph Conventions</a> - </li> - <li class="tertiary"> - <a href="glyphs-1.html" class="current">Basic Typographic Concepts</a> - </li> - <li class="tertiary"> - <a href="glyphs-2.html">Glyph Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-3.html">Glyph Metrics</a> - </li> - <li class="tertiary"> - <a href="glyphs-4.html">Kerning</a> - </li> - <li class="tertiary"> - <a href="glyphs-5.html">Text Processing</a> - </li> - <li class="tertiary"> - <a href="glyphs-6.html">FreeType Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-7.html">FreeType Bitmaps</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/glyphs/glyphs-2.html b/lib/freetype/docs/glyphs/glyphs-2.html deleted file mode 100644 index fa466f6fe..000000000 --- a/lib/freetype/docs/glyphs/glyphs-2.html +++ /dev/null @@ -1,483 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Glyph Conventions / II</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Glyph - Conventions / II</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="glyph-outlines"> - <h2>II. Glyph Outlines</h2> - - <p>This section describes the way scalable representations - of glyph images, called outlines, are used by FreeType as - well as client applications.</p> - - <h3 id="section-1">1. Pixels, points, and device - resolutions</h3> - - <p>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 exhibits varying - resolutions in both horizontal and vertical directions, - and this must be taken care of when rendering text.</p> - - <p>It is thus common to define a device's characteristics - through two numbers expressed in <em>dpi</em> (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.</p> - - <p>As a consequence, the size of text is usually given in - <em>points</em>, rather than device-specific pixels. - Points are a <em>physical</em> 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.</p> - - <p>It is thus possible to compute the size of text in pixels - from the size in points with the following formula:</p> - - <center> - <code>pixel_size = point_size * resolution / 72</code> - </center> - - <p>The resolution is expressed in <em>dpi</em>. Since - horizontal and vertical resolutions may differ, a single - point size usually defines a different text width and - height in pixels.</p> - - <p><em>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 depends 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).</em></p> - - - <h3 id="section-2">2. Vectorial representation</h3> - - <p>The source format of outlines is a collection of closed paths called - <em>contours</em>. Each contour delimits an outer or - inner <em>region</em> of the glyph, and can be made of - either <em>line segments</em> or <em>Bézier - arcs</em>.</p> - - <p>The arcs are defined through <em>control points</em>, and - can be either second-order (these are <em>conic</em> - Béziers) or third-order (<em>cubic</em> - Béziers) polynomials, depending on the font format. - Note that conic Béziers are usually called - <em>quadratic</em> Béziers in the literature. - Hence, FreeType associates each point of the outline with - flags to indicate its type (normal or control point). As - a consequence, scaling the points will scale the whole - outline.</p> - - <p>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).</p> - - <p><em>The grid is always oriented like the traditional - mathematical two-dimensional plane, i.e., - the <i>X</i> axis goes from the left to the right, - and the <i>Y</i> axis from bottom to top.</em></p> - - <p>In creating the glyph outlines, a type designer uses an - imaginary square called the <em>EM square</em>. - 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:</p> - - <ul> - <li> - <p>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:</p> - - <p align="center"> - <code>pixel_size = point_size * resolution / 72</code><br> - <code>pixel_coord = grid_coord * pixel_size / EM_size</code> - </p> - - <p>Another acronym used for the pixel size - is <em>ppem</em> (pixel per EM); this value can be - fractional also. Note that fractional ppem values are - not supported everywhere.</p> - </li> - <li> - <p>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).</p> - </li> - </ul> - - <p>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.</p> - - <p>Grid units are very often called <em>font units</em> - or <em>EM units</em>.</p> - - <p><em>As said before, <code>pixel_size</code> 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:</em></p> - - <p align="center"> - <img src="body_comparison.png" - height="40" - width="580" - alt="Comparison of font heights"> - </p> - - <p>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.</p> - - - <h3 id="section-3">3. Hinting and Bitmap rendering</h3> - - <p>The outline as stored in a font file is called the - ‘master’ outline, as its point 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 especially at small sizes undesirable - artifacts can appear, in particular stems of different - width or height in letters like ‘E’ or - ‘H’ can occur.</p> - - <p>As a consequence, proper glyph rendering needs the scaled - points to be aligned along the target device pixel grid, - through an operation called <em>grid-fitting</em> (often - called <em>hinting</em>). 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’ - glyphs 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.</p> - - <p>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:</p> - - <ul> - <li class="emph"> - <p>explicit grid-fitting</p> - - <p>The TrueType format defines a stack-based virtual - machine, for which programs (also - called <em>bytecode</em>) can be written with the help - of more than 200 operators, most of them related - 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.</p> - </li> - <li class="emph"> - <p>implicit grid-fitting (also called hinting)</p> - - <p>The Type 1, CFF, and CFF2 formats take a much - simpler approach: Each glyph is made of an outline as - well as several pieces called <em>hints</em> 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.</p> - </li> - <li class="emph"> - <p>automatic grid-fitting</p> - - <p>Some formats include no control information with each - glyph outline, apart from 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.</p> - </li> - </ul> - - <p>The following table summarizes the pros and cons of each - scheme.</p> - - <table class="vertical-space"> - <thead> - <tr> - <th align="center"> - <b>grid-fitting scheme</b> - </th> - <th align="center"> - <b>advantages</b> - </th> - <th align="center"> - <b>disadvantages</b> - </th> - </tr> - </thead> - - <tbody> - <tr> - <td valign="top" align="center"> - <p><b>explicit</b></p> - </td> - - <td valign="top"> - <p><b>Quality.</b> Excellent results at small sizes - are possible. This is very important for screen - display.</p> - - <p><b>Consistency.</b> All renderers produce the - same glyph bitmaps (at least in theory).</p> - </td> - - <td valign="top"> - <p><b>Speed.</b> Interpreting bytecode can be slow - if the glyph programs are complex.</p> - - <p><b>Size.</b> Glyph programs can be long.</p> - - <p><b>Technical difficulty.</b> It is extremely - difficult to write good hinting programs. Very - few tools available.</p> - </td> - </tr> - <tr> - <td valign="top" align="center"> - <p><b>implicit</b></p> - </td> - - <td valign="top"> - <p><b>Size.</b> Hints are usually much smaller than - explicit glyph programs.</p> - - <p><b>Speed.</b> Grid-fitting is usually a fast - process.</p> - </td> - - <td valign="top"> - <p><b>Quality.</b> Often questionable at small - sizes. Better with anti-aliasing though.</p> - - <p><b>Inconsistency.</b> Results can vary between - different renderers, or even distinct versions of - the same engine.</p> - </td> - </tr> - - <tr> - <td valign="top" align="center"> - <p><b>automatic</b></p> - </td> - - <td valign="top"> - <p><b>Size.</b> No need for control information, - resulting in smaller font files.</p> - - <p><b>Speed.</b> Depends on the grid-fitting - algorithm. Usually faster than explicit - grid-fitting.</p> - </td> - - <td valign="top"> - <p><b>Quality.</b> Often questionable at small - sizes. Better with anti-aliasing though.</p> - - <p><b>Speed.</b> Depends on the grid-fitting - algorithm.</p> - - <p><b>Inconsistency.</b> Results can vary between - different renderers, or even distinct versions - of the same engine.</p> - </td> - </tr> - </tbody> - </table> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Glyph Conventions</a> - </li> - <li class="tertiary"> - <a href="glyphs-1.html">Basic Typographic Concepts</a> - </li> - <li class="tertiary"> - <a href="glyphs-2.html" class="current">Glyph Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-3.html">Glyph Metrics</a> - </li> - <li class="tertiary"> - <a href="glyphs-4.html">Kerning</a> - </li> - <li class="tertiary"> - <a href="glyphs-5.html">Text Processing</a> - </li> - <li class="tertiary"> - <a href="glyphs-6.html">FreeType Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-7.html">FreeType Bitmaps</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/glyphs/glyphs-3.html b/lib/freetype/docs/glyphs/glyphs-3.html deleted file mode 100644 index ba1f64840..000000000 --- a/lib/freetype/docs/glyphs/glyphs-3.html +++ /dev/null @@ -1,532 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Glyph Conventions / III</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Glyph - Conventions / III</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="glyph-metrics"> - <h2>III. Glyph Metrics</h2> - - <h3 id="section-1">1. Baseline, pens and layouts</h3> - - <p>The baseline is an imaginary line that is used to - ‘guide’ glyphs when rendering text. It can be - horizontal (e.g., Latin, Cyrillic, Arabic) or vertical - (e.g., Chinese, Japanese, Mongolian). Moreover, to render - text, a virtual point, located on the baseline, called - the <em>pen position</em> or <em>origin</em>, is used to - locate glyphs.</p> - - <p>Each layout uses a different convention for glyph - placement:</p> - - <ul> - <li> - <p>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.</p> - - <p>The distance between two successive pen positions is - glyph-specific and is called the <em>advance - width</em>. Note that its value is <em>always</em> - positive, even for right-to-left oriented scripts like - Arabic. This introduces some differences in the way - text is rendered.</p> - - <p><em>The pen position is always placed on the - baseline.</em></p> - - <p align="center"> - <img src="layout.png" - height="179" - width="458" - alt="horizontal layout"> - </p> - </li> - <li> - <p>With a vertical layout, glyphs are centered around - the baseline:</p> - - <p align="center"> - <img src="layout2.png" - height="275" - width="162" - alt="vertical layout"> - </p> - </li> - </ul> - - - <h3 id="section-2">2. Typographic metrics and bounding - boxes</h3> - - <p>A various number of face metrics are defined for all - glyphs in a given font.</p> - - <ul> - <li class="emph"> - <p>Ascent</p> - - <p>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 <i>Y</i> axis upwards.</p> - </li> - <li class="emph"> - <p>Descent</p> - - <p>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.</p> - </li> - <li class="emph"> - <p>Linegap</p> - - <p>The distance that must be placed between two lines of - text. The baseline-to-baseline distance should be - computed as - - <p align="center"> - <code>linespace = ascent - descent + linegap</code> - </p> - - <p>if you use the typographic values.</p> - </li> - </ul> - - <p>Other, simpler metrics are:</p> - - <ul> - <li class="emph"> - <p>Bounding box</p> - - <p>This is an imaginary box that encloses all glyphs - from the font, usually as tightly as possible. It is - represented by four parameters, - namely <code>xMin</code>, <code>yMin</code>, - <code>xMax</code>, and <code>yMax</code>, 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.</p> - - <p>A common shorthand for the bounding box is - ‘bbox’.</p> - </li> - <li class="emph"> - <p>Internal leading</p> - - <p>This concept comes directly from the world of traditional - typography. It represents the amount of space within the - <em>leading</em> which is reserved for glyph features - that lay outside of the EM square (like accentuation). - It usually can be computed as</p> - - <p align="center"> - <code>internal leading = ascent - descent - EM_size</code> - </p> - </li> - <li class="emph"> - <p>External leading</p> - - <p>This is another name for the line gap.</p> - </li> - </ul> - - - <h3 id="section-3">3. Bearings and Advances</h3> - - <p>Each glyph has also distances called <em>bearings</em> and - <em>advances</em>. The actual values depend on the - layout, as the same glyph can be used to render text - either horizontally or vertically:</p> - - <ul> - <li class="emph"> - <p>Left side bearing</p> - - <p>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.</p> - - <p>In the FreeType API, this is also called - <code>bearingX</code>. Another shorthand is - ‘lsb’.</p> - </li> - <li class="emph"> - <p>Top side bearing</p> - - <p>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.</p> - - <p>In the FreeType API, this is also called - <code>bearingY</code>.</p> - </li> - <li class="emph"> - <p>Advance width</p> - - <p>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.</p> - - <p>In the FreeType API, this is also called - <code>advanceX</code>.</p> - </li> - <li class="emph"> - <p>Advance height</p> - - <p>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.</p> - - <p>In the FreeType API, this is also called - <code>advanceY</code>.</p> - </li> - <li class="emph"> - <p>Glyph width</p> - - <p>The glyph's horizontal extent. For unscaled font - coordinates, it is</p> - - <p align="center"> - <code>glyph width = bbox.xMax - bbox.xMin</code> - </p> - - <p>For scaled glyphs, its computation requests specific - care, described in the grid-fitting chapter below.</p> - </li> - <li class="emph"> - <p>Glyph height</p> - - <p>The glyph's vertical extent. For unscaled font - coordinates, it is</p> - - <p align="center"> - <code>glyph height = bbox.yMax - bbox.yMin</code> - </p> - - <p>For scaled glyphs, its computation requests specific - care, described in the grid-fitting chapter below.</p> - </li> - <li class="emph"> - <p>Right side bearing</p> - - <p>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:</p> - - <p align="center"> - <tt>right side bearing = advance_width - - left_side_bearing - (xMax-xMin)</tt> - </p> - - <p>A common shorthand for this value is - ‘rsb’.</p> - </li> - </ul> - - <p>Here is a picture giving all the details for horizontal metrics: - - <p align="center"> - <img src="metrics.png" - height="253" - width="388" - alt="horizontal glyph metrics"> - </p> - - <p>And here is another one for the vertical metrics:</p> - - <p align="center"> - <img src="metrics2.png" - height="278" - width="294" - alt="vertical glyph metrics"> - </p> - - - <h3 id="section-4">4. The effects of grid-fitting</h3> - - <p>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.</p> - - <p>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.</p> - - <p>The glyph metrics are also influenced by the grid-fitting - process:</p> - - <ul> - <li> - <p>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.</p> - </li> - <li> - <p>The image's bounding box is modified, thus modifying - the bearings.</p> - </li> - <li> - <p>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.</p> - </li> - </ul> - - <p>This has some implications:</p> - - <ul> - <li> - <p>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.</p> - </li> - <li> - <p>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.</p> - </li> - <li> - <p>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.</p> - </li> - </ul> - - <p>Performing 2D transformations on glyph outlines is very - easy with FreeType. However, when using translation on - hinted outlines, one should always take care - of <b>exclusively using integer pixel distances</b> (which - means that the parameters to the - <code>FT_Outline_Translate</code> API function should all - be multiples of 64, as the point coordinates are in - 26.6 fixed-point format). Otherwise, the translation - will simply <em>ruin the hinter's work</em>, resulting in - very low quality bitmaps!</p> - - <p>Note, however, that the restriction to integer pixel - distances mentioned in the previous paragraph has become - weaker; today, it is quite common to do <em>no</em> - hinting along the horizontal axis, only adjusting the - glyphs vertically. Typical examples are Microsoft's - ClearType implementation, FreeType's new CFF engine - (contributed by Adobe), or the ‘light’ - auto-hinting mode. For such modes you get best rendering - results if you do sub-pixel glyph positioning.</p> - - - <h3 id="section-5">5. Text widths and bounding box</h3> - - <p>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.</p> - - <p>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 box width.</p> - - <p>The same conventions apply to strings of text, with the - following consequences.</p> - - <ul> - <li> - <p>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.</p> - </li> - <li> - <p>The string's advance width isn't related to its - bounding box dimensions. Especially if it contains - leading and trailing spaces or tabs.</p> - </li> - <li> - <p>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.</p> - </li> - </ul> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Glyph Conventions</a> - </li> - <li class="tertiary"> - <a href="glyphs-1.html">Basic Typographic Concepts</a> - </li> - <li class="tertiary"> - <a href="glyphs-2.html">Glyph Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-3.html" class="current">Glyph Metrics</a> - </li> - <li class="tertiary"> - <a href="glyphs-4.html">Kerning</a> - </li> - <li class="tertiary"> - <a href="glyphs-5.html">Text Processing</a> - </li> - <li class="tertiary"> - <a href="glyphs-6.html">FreeType Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-7.html">FreeType Bitmaps</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/glyphs/glyphs-4.html b/lib/freetype/docs/glyphs/glyphs-4.html deleted file mode 100644 index 93131ebaa..000000000 --- a/lib/freetype/docs/glyphs/glyphs-4.html +++ /dev/null @@ -1,287 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Glyph Conventions / IV</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Glyph - Conventions / IV</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="kerning"> - <h2>IV. Kerning</h2> - - <p>The term <em>kerning</em> 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.</p> - - - <h3 id="section-1">1. Kerning pairs</h3> - - <p>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’.</p> - - <p>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.</p> - - <p align="center"> - <img src="bravo_unkerned.png" - height="37" - width="116" - alt="the word 'bravo' unkerned"> - </p> - - <p>Compare this to the same word, where the distance between - these two letters has been slightly reduced:</p> - - <p align="center"> - <img src="bravo_kerned.png" - height="37" - width="107" - alt="the word 'bravo' with kerning"> - </p> - - <p>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.</p> - - <ul> - <li> - <p>The pairs are ordered, i.e., the space for pair - ‘(A,V)’ isn't necessarily the space for - pair ‘(V,A)’. They also use glyph - indices, not character codes.</p> - </li> - <li> - <p>Kerning distances can be expressed in horizontal or - vertical directions, depending on the layout and/or - the 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.</p> - </li> - <li> - <p>Kerning distances are expressed in grid units. They - are usually oriented in the <i>X</i> axis, which - means that a negative value indicates that two glyphs - must be set closer in a horizontal layout.</p> - </li> - </ul> - - <p>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 <a href="http://icu-project.org/">ICU</a> or - <a href="http://harfbuzz.org">HarfBuzz</a> since it can be - context dependent (this is, the kerning may vary depending - on the position within a text string, for example).</p> - - - <h3 id="section-2">2. Applying kerning</h3> - - <p>Applying kerning when rendering text is a rather easy - process. It merely consists of 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.</p> - - <p>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.</p> - - <p align="center"> - <img src="twlewis1.png" - height="38" - width="314" - alt="example for sliding dots"> - </p> - - <p>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</p> - - <p align="center"> - <img src="twlewis2.png" - height="36" - width="115" - alt="example for too much kerning"> - </p> - - <p>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.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Glyph Conventions</a> - </li> - <li class="tertiary"> - <a href="glyphs-1.html">Basic Typographic Concepts</a> - </li> - <li class="tertiary"> - <a href="glyphs-2.html">Glyph Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-3.html">Glyph Metrics</a> - </li> - <li class="tertiary"> - <a href="glyphs-4.html" class="current">Kerning</a> - </li> - <li class="tertiary"> - <a href="glyphs-5.html">Text Processing</a> - </li> - <li class="tertiary"> - <a href="glyphs-6.html">FreeType Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-7.html">FreeType Bitmaps</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/glyphs/glyphs-5.html b/lib/freetype/docs/glyphs/glyphs-5.html deleted file mode 100644 index 921573706..000000000 --- a/lib/freetype/docs/glyphs/glyphs-5.html +++ /dev/null @@ -1,455 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Glyph Conventions / V</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Glyph - Conventions / V</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="text-processing"> - <h2>V. Text Processing</h2> - - <p>This section demonstrate algorithms which use the - concepts previously defined to render text, whatever - layout you use. It assumes <em>simple</em> text handling - suitable for scripts like Latin or Cyrillic, using a - one-to-one relationship between input character codes and - output glyphs indices. Scripts like Arabic or Khmer, - which need a ‘shaping engine’ to do the - character code to glyph index conversion, are beyond the - scope (and should be done by proper layout engines - like <a href="http://www.pango.org/">Pango</a> - anyway).</p> - - - <h3 id="section-1">1. Writing simple text strings</h3> - - <p>In this first example, we will generate a simple string - of text in the Latin script, i.e., with a horizontal - left-to-right layout. Using exclusively pixel metrics, - the process looks like: - - <ol class="algorithm"> - <li> - Convert the character string into a series of glyph - indices. - </li> - <li> - Place the pen to the cursor position. - </li> - <li> - Get or load the glyph image. - </li> - <li> - Translate the glyph so that its ‘origin’ - matches the pen position. - </li> - <li> - Render the glyph to the target device. - </li> - <li> - Increment the pen position by the glyph's advance - width (in pixels). - </li> - <li> - Start over at step 3 for each of the remaining - glyphs. - </li> - <li> - When all glyphs are done, set the text cursor to the - new pen position. - </li> - </ol> - - <p>Note that kerning isn't part of this algorithm.</p> - - - <h3 id="section-2">2. Subpixel positioning</h3> - - <p>This algorithm can be used for hinting modes that don't - apply horizontal hinting. It essentially provides WYSIWYG - text layout. Text rendering is very similar to the - algorithm described in subsection 1, with the - following few differences:</p> - - <ul> - <li> - <p>The pen position is expressed in fractional - pixels.</p> - </li> - <li> - <p>The hinted outline must be shifted horizontally to - the proper sub-pixel position.</p> - </li> - <li> - <p>The advance width is expressed in fractional pixels, - and isn't necessarily an integer.</p> - </li> - </ul> - - <p>Here an improved version of the algorithm:</p> - - <ol class="algorithm"> - <li> - Convert the character string into a series of glyph - indices. - </li> - <li> - Place the pen to the cursor position. This can be a - non-integer point. - </li> - <li> - Get or load the glyph image. - </li> - <li> - Translate the glyph by ‘pen_pos - - floor(pen_pos)’. - </li> - <li> - Render the glyph to the target device at - ‘floor(pen_pos)’. - </li> - <li> - Increment the pen position by the glyph's advance width - in fractional pixels. - </li> - <li> - Start over at step 3 for each of the remaining - glyphs. - </li> - <li> - When all glyphs are done, set the text cursor to the new - pen position. - </li> - </ol> - - - <h3 id="section-3">3. Simple kerning</h3> - - <p>Adding kerning to the basic text rendering algorithm is - easy: When a kerning pair is found, simply add the scaled - kerning distance to the pen position before step 4. - Of course, the distance should be rounded in the case of - algorithm 1, though it doesn't need to for - algorithm 2. This gives us:</p> - - <p>Algorithm 1 with kerning:</p> - - <ol class="algorithm"> - <li> - Convert the character string into a series of glyph - indices. - </li> - <li> - Place the pen to the cursor position. - </li> - <li> - Get or load the glyph image. - </li> - <li> - Add the rounded scaled kerning distance, if any, to the - pen position. - </li> - <li> - Translate the glyph so that its ‘origin’ - matches the pen position. - </li> - <li> - Render the glyph to the target device. - </li> - <li> - Increment the pen position by the glyph's advance width - in pixels. - </li> - <li> - Start over at step 3 for each of the remaining - glyphs. - </li> - </ol> - - <p>Algorithm 2 with kerning:</p> - - <ol class="algorithm"> - <li> - Convert the character string into a series of glyph - indices. - </li> - <li> - Place the pen to the cursor position. - </li> - <li> - Get or load the glyph image. - </li> - <li> - Add the scaled unrounded kerning distance, if any, to - the pen position. - </li> - <li> - Translate the glyph by ‘pen_pos - - int(pen_pos)’. - </li> - <li> - Render the glyph to the target device at - ‘int(pen_pos)’. - </li> - <li> - Increment the pen position by the glyph's advance width - in fractional pixels. - </li> - <li> - Start over at step 3 for each of the remaining - glyphs. - </li> - </ol> - - - <h3 id="section-4">4. Right-to-left layout</h3> - - <p>The process of laying out right-to-left scripts like - (modern) Hebrew text is very similar. The only difference - is that the pen position must be decremented before the - glyph rendering (remember: the advance width is always - positive, even for Hebrew glyphs).</p> - - <p>Right-to-left algorithm 1:</p> - - <ol class="algorithm"> - <li> - Convert the character string into a series of glyph - indices. - </li> - <li> - Place the pen to the cursor position. - </li> - <li> - Get or load the glyph image. - </li> - <li> - Decrement the pen position by the glyph's advance - width in pixels. - </li> - <li> - Translate the glyph so that its ‘origin’ - matches the pen position. - </li> - <li> - Render the glyph to the target device. - </li> - <li> - Start over at step 3 for each of the remaining - glyphs. - </li> - </ol> - - <p>The changes to algorithm 2, as well as the inclusion - of kerning are left as an exercise to the reader.</p> - - - <h3 id="section-5">5. Vertical layouts</h3> - - <p>Laying out vertical text uses exactly the same processes, - with the following significant differences:</p> - - <ul> - <li> - <p>The baseline is vertical, and the vertical metrics - must be used instead of the horizontal one.</p> - </li> - <li> - <p>The left bearing is usually negative, but this - doesn't change the fact that the glyph origin must be - located on the baseline.</p> - </li> - <li> - <p>The advance height is always positive, so the pen - position must be decremented if one wants to write top - to bottom (assuming the <i>Y</i> axis is oriented - upwards).</p> - </li> - </ul> - - <p>Here the algorithm:</p> - - <ol class="algorithm"> - <li> - Convert the character string into a series of glyph - indices. - </li> - <li> - Place the pen to the cursor position. - </li> - <li> - Get or load the glyph image. - </li> - <li> - Translate the glyph so that its ‘origin’ - matches the pen position. - </li> - <li> - Render the glyph to the target device. - </li> - <li> - Decrement the vertical pen position by the glyph's - advance height in pixels. - </li> - <li> - Start over at step 3 for each of the remaining - glyphs. - </li> - <li> - When all glyphs are done, set the text cursor to the new - pen position. - </li> - </ol> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Glyph Conventions</a> - </li> - <li class="tertiary"> - <a href="glyphs-1.html">Basic Typographic Concepts</a> - </li> - <li class="tertiary"> - <a href="glyphs-2.html">Glyph Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-3.html">Glyph Metrics</a> - </li> - <li class="tertiary"> - <a href="glyphs-4.html">Kerning</a> - </li> - <li class="tertiary"> - <a href="glyphs-5.html" class="current">Text Processing</a> - </li> - <li class="tertiary"> - <a href="glyphs-6.html">FreeType Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-7.html">FreeType Bitmaps</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/glyphs/glyphs-6.html b/lib/freetype/docs/glyphs/glyphs-6.html deleted file mode 100644 index eb84b886f..000000000 --- a/lib/freetype/docs/glyphs/glyphs-6.html +++ /dev/null @@ -1,539 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Glyph Conventions / VI</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Glyph - Conventions / VI</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="freetype-outlines"> - <h2>VI. FreeType outlines</h2> - - <p>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.</p> - - <h3 id="section-1">1. FreeType outline description and - structure</h3> - - <h4>a. Outline curve decomposition</h4> - - <p>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, CFF, and CFF2 formats.</p> - - <p>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:</p> - - <table> - <tr> - <td valign="top"> - <p><code>FT_CURVE_TAG_ON</code></p> - </td> - <td valign="top"> - <p>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.</p> - </td> - </tr> - <tr> - <td valign="top"> - <p><code>FT_CURVE_TAG_CONIC</code></p> - </td> - <td valign="top"> - <p>Used for an ‘off’ point used to control - a conic Bézier arc.</p> - </td> - </tr> - <tr> - <td valign="top"> - <p><code>FT_CURVE_TAG_CUBIC</code></p> - </td> - <td valign="top"> - <p>Used for an ‘off’ point used to control - a cubic Bézier arc.</p> - </td> - </tr> - </table> - - <p>Use the <code>FT_CURVE_TAG(tag)</code> macro to filter out - other, internally used flags. - - <p>The following rules are applied to decompose the - contour's points into segments and arcs:</p> - - <ul> - <li> - <p>Two successive ‘on’ points indicate a - line segment joining them.</p> - </li> - <li> - <p>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.</p> - </li> - <li> - <p>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).</p> - </li> - <li> - <p>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.</p> - </li> - <li> - <p>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. - </li> - <li> - <p>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. - </li> - </ul> - - <p>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.</p> - - <table class="vertical-space"> - <tr> - <td> - <img src="points_segment.png" - height="166" - width="221" - alt="segment example"> - </td> - <td> - <img src="points_conic.png" - height="183" - width="236" - alt="conic arc example"> - </td> - </tr> - <tr> - <td> - <img src="points_cubic.png" - height="162" - width="214" - alt="cubic arc example"> - </td> - <td> - <img src="points_conic2.png" - height="204" - width="225" - alt="cubic arc with virtual 'on' point"> - </td> - </tr> - </table> - - - <h4>b. The <code>FT_Outline</code> descriptor</h4> - - <p>A FreeType outline is described through a simple - structure - called <a href="../reference/ft2-outline_processing.html#ft_outline"><code>FT_Outline</code></a>. - Right now, the following fields are of interest:</p> - - <table class="vertical-space"> - <caption> - <b><code>FT_Outline</code></b> - </caption> - <tbody> - <tr> - <td> - <code>n_points</code> - </td> - <td> - the number of points in the outline - </td> - </tr> - <tr> - <td> - <code>n_contours</code> - </td> - <td> - the number of contours in the outline - </td> - </tr> - <tr> - <td> - <code>points</code> - </td> - <td> - array of point coordinates - </td> - </tr> - <tr> - <td> - <code>contours</code> - </td> - <td> - array of contour end indices - </td> - </tr> - <tr> - <td> - <code>tags</code> - </td> - <td> - array of point flags - </td> - </tr> - </tbody> - </table> - - <p>Here, <code>points</code> is a pointer to an array of - <a href="../reference/ft2-basic_types.html#ft_vector"><code>FT_Vector</code></a> - 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 <em>26.6 fixed-point - format</em>.</p> - - <p><code>contours</code> 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 <code>contours[0]</code>. The second contour starts - at point <code>contours[0]+1</code> and ends at - <code>contours[1]</code>, etc. To traverse these points in a - callback based manner, - use <a href="../reference/ft2-outline_processing.html#ft_outline_decompose"><code>FT_Outline_Decompose</code></a>.</p> - - <p>Note that each contour is closed, and that the value - of <code>n_points</code> should be equal - to <code>contours[n_contours-1]+1</code> for a valid - outline.</p> - - <p>Finally, <code>tags</code> is an array of bytes, used to - store each outline point's tag.</p> - - - <h3 id="section-2">2. Bounding and control box - computations</h3> - - <p>As described earlier, a <em>bounding box</em> (also - called <em>bbox</em>) 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.</p> - - <p>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), making hinting much easier.</p> - - <p>We thus define the <em>control box</em> (also - called <em>cbox</em>) 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.</p> - - <p>Unlike the bbox, the cbox is much faster to compute.</p> - - <table class="vertical-space"> - <tr> - <td> - <img src="bbox1.png" - height="264" - width="228" - alt="a glyph with different bbox and cbox"> - </td> - <td> - <img src="bbox2.png" - height="229" - width="217" - alt="a glyph with identical bbox and cbox"> - </td> - </tr> - </table> - - <p>Control and bounding boxes can be computed automatically - using the - functions <a href="../reference/ft2-outline_processing.html#ft_outline_get_cbox"><code>FT_Outline_Get_CBox</code></a> - and - <a href="../reference/ft2-outline_processing.html#ft_outline_get_bbox"><code>FT_Outline_Get_BBox</code></a>. - The former function is always very fast, while the - latter <em>may</em> 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. - - <p>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.</p> - - - <h3 id="section-3">3. Coordinates, scaling and - grid-fitting</h3> - - <p>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.</p> - - <p>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.</p> - - <p>The following operations can be used to round vectorial - distances in the 26.6 format to the grid:</p> - - <pre> -round( x ) == ( x + 32 ) & -64 -floor( x ) == x & -64 -ceiling( x ) == ( x + 63 ) & -64</pre> - - <p>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:</p> - - <p>The scan-line converter draws all the pixels - whose <em>centers</em> fall inside the glyph shape. In - B/W rendering mode, it can also detect <em>drop-outs</em>, - 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.</p> - - <p>This leads to the following computations:</p> - - <ul> - <li> - <p>compute the bbox</p> - </li> - <li> - <p>grid-fit the bounding box with the following:</p> - - <pre> -xmin = floor( bbox.xMin ) -xmax = ceiling( bbox.xMax ) -ymin = floor( bbox.yMin ) -ymax = ceiling( bbox.yMax )</pre> - </li> - <li> - <p>return pixel dimensions, i.e.,</p> - - <pre> -width = (xmax - xmin)/64</pre> - - <p>and</p> - - <pre> -height = (ymax - ymin)/64</pre> - </li> - </ul> - - <p>By grid-fitting the bounding box, it is guaranteed that - all the pixel centers that are to be drawn, <em>including - those coming from drop-out control</em>, will - be <em>within</em> the adjusted box. Then the box's - dimensions in pixels can be computed.</p> - - <p>Note also that, when translating a grid-fitted outline, one should - <em>always use integer distances</em> 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 <em>very low quality</em> bitmaps and - pixmaps.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Glyph Conventions</a> - </li> - <li class="tertiary"> - <a href="glyphs-1.html">Basic Typographic Concepts</a> - </li> - <li class="tertiary"> - <a href="glyphs-2.html">Glyph Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-3.html">Glyph Metrics</a> - </li> - <li class="tertiary"> - <a href="glyphs-4.html">Kerning</a> - </li> - <li class="tertiary"> - <a href="glyphs-5.html">Text Processing</a> - </li> - <li class="tertiary"> - <a href="glyphs-6.html" class="current">FreeType Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-7.html">FreeType Bitmaps</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/glyphs/glyphs-7.html b/lib/freetype/docs/glyphs/glyphs-7.html deleted file mode 100644 index 64f5d4a97..000000000 --- a/lib/freetype/docs/glyphs/glyphs-7.html +++ /dev/null @@ -1,437 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Glyph Conventions / VII</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Glyph - Conventions / VII</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="freetype-bitmaps"> - <h2>VII. FreeType Bitmaps</h2> - - <p>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.</p> - - - <h3 id="section-1">1. Vectorial versus pixel - coordinates</h3> - - <p>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)’.</p> - - <p>In the pixel case, as we use the <em>Y upwards</em> - convention; the coordinate [0, 0] always refers to - the <em>lower left pixel</em> of a bitmap, while - coordinate [width-1, rows-1] to its <em>upper right - pixel</em>.</p> - - <p>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.</p> - - <p>The pixels themselves are indeed <em>square boxes</em> 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).</p> - - <p>This introduces some differences when computing - distances. For example, the <em>length</em> 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.</p> - - <p align="center"> - <img src="grid_1.png" - height="390" - width="402" - alt="bitmap and vector grid"> - </p> - - - <h3 id="section-2">2. The <code>FT_Bitmap</code> descriptor</h3> - - <p>In FreeType, a bitmap or pixmap is described through a - single structure - called <a href="../reference/ft2-basic_types.html#ft_bitmap"><code>FT_Bitmap</code></a>. - The fields we are interested in are:</p> - - <table class="vertical-space"> - <caption> - <b><code>FT_Bitmap</code></b> - </caption> - - <tr> - <td valign="top"> - <code>rows</code> - </td> - <td valign="top"> - the number of rows, i.e., lines, in the bitmap - </td> - </tr> - <tr> - <td valign="top"> - <code>width</code> - </td> - <td valign="top"> - the number of horizontal pixels in the bitmap - </td> - </tr> - <tr> - <td valign="top"> - <code>pitch</code> - </td> - <td valign="top"> - 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 - </td> - </tr> - <tr> - <td valign="top"> - <code>buffer</code> - </td> - <td valign="top"> - a typeless pointer to the bitmap pixel buffer - </td> - </tr> - <tr> - <td valign="top"> - <code>pixel_mode</code> - </td> - <td valign="top"> - an enumeration used to describe the pixel format of - the bitmap; examples - are <code>ft_pixel_mode_mono</code> for 1-bit - monochrome bitmaps - and <code>ft_pixel_mode_grays</code> for 8-bit - anti-aliased ‘gray’ values - </td> - </tr> - <tr> - <td valign="top"> - <code>num_grays</code> - </td> - <td valign="top"> - 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) - </td> - </tr> - </table> - - <p>Note that the sign of the <code>pitch</code> field - determines whether the rows in the pixel buffer are stored - in ascending or descending order.</p> - - <p>Remember that FreeType uses the <em>Y upwards</em> - convention in the 2D plane, which means that a coordinate - of (0, 0) always refer to the <em>lower-left - corner</em> of a bitmap.</p> - - <p>If the pitch is positive, the rows are stored in - decreasing vertical position; the first bytes of the pixel - buffer are part of the <em>upper</em> bitmap row.</p> - - <p>On the opposite, if the pitch is negative, the first - bytes of the pixel buffer are part of the <em>lower</em> - bitmap row.</p> - - <p>In all cases, one can see the pitch as the byte increment - needed to skip to the <em>next lower scanline</em> in a - given bitmap buffer.</p> - - <table class="vertical-space"> - <tr> - <td> - <img src="up_flow.png" - height="261" - width="275" - alt="negative 'pitch'"> - </td> - <td> - <img src="down_flow.png" - height="263" - width="273" - alt="positive 'pitch'"> - </td> - </tr> - </table> - - <p>The ‘positive pitch’ convention is very often - used, though some systems might need the other.</p> - - <p>To speed up memory access, <code>pitch</code> is in most - cases a multiple of 16bit, 32bit, or even 64bit. It often - happens that the pitch is thus larger than the necessary - bits (or bytes) for a bitmap or pixmap row; in such cases, - unused bits (or bytes) are at the very right (i.e., the - end) of a row.</p> - - - <h3 id="section-3">3. Converting outlines into bitmaps and - pixmaps</h3> - - <p>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:</p> - - <ul> - <li> - <p>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).</p> - </li> - <li> - <p>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 - [<tt>w</tt>, <tt>h</tt>] will be mapped to a 2D - rectangle window delimited by - (0, 0)-(<tt>w</tt>, <tt>h</tt>).</p> - </li> - <li> - <p>When scan-converting the outline, everything that - falls within the bitmap window is rendered, the rest - is ignored.</p> - </li> - - <p>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.</p> - - <ul> - <li> - The first image shows a loaded outline in the 2D - plane. - </li> - <li> - The second one shows the target window for a bitmap of - arbitrary dimensions [<tt>w</tt>, <tt>h</tt>]. - </li> - <li> - The third one shows the juxtaposition of the outline - and window in the 2D plane. - </li> - <li> - The last image shows what will really be rendered in - the bitmap. - </li> - </ul> - - <p align="center"> - <img src="clipping.png" - height="151" - width="539" - alt="clipping algorithm"> - </p> - </ul> - - <p>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.</p> - - <p>For example, the correct way of creating - a <em>stand-alone</em> glyph bitmap is as follows:</p> - - <ul> - <li> - <p>Get 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 loading it, as the - glyph metrics are not valid anymore).</p> - </li> - <li> - <p>Create the bitmap with the computed dimensions. - Don't forget to fill the pixel buffer with the - background color.</p> - </li> - <li> - <p>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 - (<tt>-ROUND(xMin)</tt>, <tt>-ROUND(yMin)</tt>).</p> - </li> - <li> - <p>Call the rendering function (it can be - <a href="../reference/ft2-outline_processing.html#ft_outline_render"><code>FT_Outline_Render</code></a>, - for example).</p> - </li> - </ul> - - <p>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.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Glyph Conventions</a> - </li> - <li class="tertiary"> - <a href="glyphs-1.html">Basic Typographic Concepts</a> - </li> - <li class="tertiary"> - <a href="glyphs-2.html">Glyph Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-3.html">Glyph Metrics</a> - </li> - <li class="tertiary"> - <a href="glyphs-4.html">Kerning</a> - </li> - <li class="tertiary"> - <a href="glyphs-5.html">Text Processing</a> - </li> - <li class="tertiary"> - <a href="glyphs-6.html">FreeType Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-7.html" class="current">FreeType Bitmaps</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/glyphs/grid_1.png b/lib/freetype/docs/glyphs/grid_1.png Binary files differdeleted file mode 100644 index 724ec8c08..000000000 --- a/lib/freetype/docs/glyphs/grid_1.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/index.html b/lib/freetype/docs/glyphs/index.html deleted file mode 100644 index 44e800418..000000000 --- a/lib/freetype/docs/glyphs/index.html +++ /dev/null @@ -1,292 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Glyph Conventions</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Glyph Conventions</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="introduction"> - <p>This document presents the core conventions used within - the FreeType library to manage font and glyph data. It is - a <em>must-read</em> for all developers who need to - understand digital typography, especially if you want to - use the FreeType 2 library in your projects.</p> - </div> - - <!-- ************************************************** --> - - <div id="contents"> - <h3><a href="glyphs-1.html">I. Basic Typographic - Concepts</a></h3> - <ul> - <li> - <a href="glyphs-1.html#section-1">1. Font files, format - and information</a> - </li> - <li> - <a href="glyphs-1.html#section-2">2. Character images - and mappings</a> - </li> - <li> - <a href="glyphs-1.html#section-3">3. Character and font - metrics</a> - </li> - </ul> - - <h3><a href="glyphs-2.html">II. Glyph Outlines</a></h3> - <ul> - <li> - <a href="glyphs-2.html#section-1">1. Pixels, points and - device resolutions</a> - </li> - <li> - <a href="glyphs-2.html#section-2">2. Vectorial - representation</a> - </li> - <li> - <a href="glyphs-2.html#section-3">3. Hinting and bitmap - rendering</a> - </li> - </ul> - - <h3><a href="glyphs-3.html">III. Glyph Metrics</a></h3> - <ul> - <li> - <a href="glyphs-3.html#section-1">1. Baseline, pens and - layouts</a> - </li> - <li> - <a href="glyphs-3.html#section-2">2. Typographic metrics - and bounding boxes</a> - </li> - <li> - <a href="glyphs-3.html#section-3">3. Bearings and - advances</a> - </li> - <li> - <a href="glyphs-3.html#section-4">4. The effects of - grid-fitting</a> - </li> - <li> - <a href="glyphs-3.html#section-5">5. Text widths and - bounding box</a> - </li> - </ul> - - <h3><a href="glyphs-4.html">IV. Kerning</a></h3> - <ul> - <li> - <a href="glyphs-4.html#section-1">1. Kerning pairs</a> - </li> - <li> - <a href="glyphs-4.html#section-2">2. Applying - kerning</a> - </li> - </ul> - - <h3><a href="glyphs-5.html">V. Text Processing</a></h3> - <ul> - <li> - <a href="glyphs-5.html#section-1">1. Writing simple text - strings</a> - </li> - <li> - <a href="glyphs-5.html#section-2">2. Sub-pixel - positioning</a> - </li> - <li> - <a href="glyphs-5.html#section-3">3. Simple kerning</a> - </li> - <li> - <a href="glyphs-5.html#section-4">4. Right-to-left - layouts</a> - </li> - <li> - <a href="glyphs-5.html#section-5">5. Vertical - layouts</a> - </li> - </ul> - - <h3><a href="glyphs-6.html">VI. FreeType Outlines</a></h3> - <ul> - <li> - <a href="glyphs-6.html#section-1">1. FreeType outline - description and structure</a> - </li> - <li> - <a href="glyphs-6.html#section-2">2. Bounding and - control box computations</a> - </li> - <li> - <a href="glyphs-6.html#section-3">3. Coordinates, - scaling, and grid-fitting</a> - </li> - </ul> - - <h3><a href="glyphs-7.html">VII. FreeType Bitmaps</a></h3> - <ul> - <li> - <a href="glyphs-7.html#section-1">1. Vectorial versus - pixel coordinates</a> - </li> - <li> - <a href="glyphs-7.html#section-2">2. The <tt>FT_Bitmap</tt> - descriptor</a> - </li> - <li> - <a href="glyphs-7.html#section-3">3. Converting outlines - into bitmaps and pixmaps</a> - </li> - </ul> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="glyphs-1.html" class="current">FreeType Glyph Conventions</a> - </li> - <li class="tertiary"> - <a href="glyphs-1.html">Basic Typographic Concepts</a> - </li> - <li class="tertiary"> - <a href="glyphs-2.html">Glyph Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-3.html">Glyph Metrics</a> - </li> - <li class="tertiary"> - <a href="glyphs-4.html">Kerning</a> - </li> - <li class="tertiary"> - <a href="glyphs-5.html">Text Processing</a> - </li> - <li class="tertiary"> - <a href="glyphs-6.html">FreeType Outlines</a> - </li> - <li class="tertiary"> - <a href="glyphs-7.html">FreeType Bitmaps</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/glyphs/layout.png b/lib/freetype/docs/glyphs/layout.png Binary files differdeleted file mode 100644 index d08a30689..000000000 --- a/lib/freetype/docs/glyphs/layout.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/layout2.png b/lib/freetype/docs/glyphs/layout2.png Binary files differdeleted file mode 100644 index 2b0373089..000000000 --- a/lib/freetype/docs/glyphs/layout2.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/metrics.png b/lib/freetype/docs/glyphs/metrics.png Binary files differdeleted file mode 100644 index 1e7be4748..000000000 --- a/lib/freetype/docs/glyphs/metrics.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/metrics2.png b/lib/freetype/docs/glyphs/metrics2.png Binary files differdeleted file mode 100644 index 0bda5dc25..000000000 --- a/lib/freetype/docs/glyphs/metrics2.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/points_conic.png b/lib/freetype/docs/glyphs/points_conic.png Binary files differdeleted file mode 100644 index e87b2b3de..000000000 --- a/lib/freetype/docs/glyphs/points_conic.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/points_conic2.png b/lib/freetype/docs/glyphs/points_conic2.png Binary files differdeleted file mode 100644 index 5088aaa8c..000000000 --- a/lib/freetype/docs/glyphs/points_conic2.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/points_cubic.png b/lib/freetype/docs/glyphs/points_cubic.png Binary files differdeleted file mode 100644 index 5110da9bc..000000000 --- a/lib/freetype/docs/glyphs/points_cubic.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/points_segment.png b/lib/freetype/docs/glyphs/points_segment.png Binary files differdeleted file mode 100644 index b41481655..000000000 --- a/lib/freetype/docs/glyphs/points_segment.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/twlewis1.png b/lib/freetype/docs/glyphs/twlewis1.png Binary files differdeleted file mode 100644 index 1a0fa2ff4..000000000 --- a/lib/freetype/docs/glyphs/twlewis1.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/twlewis2.png b/lib/freetype/docs/glyphs/twlewis2.png Binary files differdeleted file mode 100644 index 05e02e1cb..000000000 --- a/lib/freetype/docs/glyphs/twlewis2.png +++ /dev/null diff --git a/lib/freetype/docs/glyphs/up_flow.png b/lib/freetype/docs/glyphs/up_flow.png Binary files differdeleted file mode 100644 index 0af4daee5..000000000 --- a/lib/freetype/docs/glyphs/up_flow.png +++ /dev/null diff --git a/lib/freetype/docs/image/BlendingExamples-thumbnail.png b/lib/freetype/docs/image/BlendingExamples-thumbnail.png Binary files differdeleted file mode 100644 index 165b9c0de..000000000 --- a/lib/freetype/docs/image/BlendingExamples-thumbnail.png +++ /dev/null diff --git a/lib/freetype/docs/image/BlendingExamples.png b/lib/freetype/docs/image/BlendingExamples.png Binary files differdeleted file mode 100644 index 8ba4f4b86..000000000 --- a/lib/freetype/docs/image/BlendingExamples.png +++ /dev/null diff --git a/lib/freetype/docs/image/favicon.ico b/lib/freetype/docs/image/favicon.ico Binary files differdeleted file mode 100644 index 72a53b6a6..000000000 --- a/lib/freetype/docs/image/favicon.ico +++ /dev/null diff --git a/lib/freetype/docs/image/favicon_-30.ico b/lib/freetype/docs/image/favicon_-30.ico Binary files differdeleted file mode 100644 index c695f0f29..000000000 --- a/lib/freetype/docs/image/favicon_-30.ico +++ /dev/null diff --git a/lib/freetype/docs/image/favicon_-60.ico b/lib/freetype/docs/image/favicon_-60.ico Binary files differdeleted file mode 100644 index a1a22ed43..000000000 --- a/lib/freetype/docs/image/favicon_-60.ico +++ /dev/null diff --git a/lib/freetype/docs/image/favicon_-90.ico b/lib/freetype/docs/image/favicon_-90.ico Binary files differdeleted file mode 100644 index 201ec2274..000000000 --- a/lib/freetype/docs/image/favicon_-90.ico +++ /dev/null diff --git a/lib/freetype/docs/image/favicon_30.ico b/lib/freetype/docs/image/favicon_30.ico Binary files differdeleted file mode 100644 index 3f719d1ea..000000000 --- a/lib/freetype/docs/image/favicon_30.ico +++ /dev/null diff --git a/lib/freetype/docs/image/favicon_60.ico b/lib/freetype/docs/image/favicon_60.ico Binary files differdeleted file mode 100644 index 6f5622114..000000000 --- a/lib/freetype/docs/image/favicon_60.ico +++ /dev/null diff --git a/lib/freetype/docs/image/favicon_90.ico b/lib/freetype/docs/image/favicon_90.ico Binary files differdeleted file mode 100644 index b5886effe..000000000 --- a/lib/freetype/docs/image/favicon_90.ico +++ /dev/null diff --git a/lib/freetype/docs/image/fond2-small.png b/lib/freetype/docs/image/fond2-small.png Binary files differdeleted file mode 100644 index 44144682b..000000000 --- a/lib/freetype/docs/image/fond2-small.png +++ /dev/null diff --git a/lib/freetype/docs/image/fond2.png b/lib/freetype/docs/image/fond2.png Binary files differdeleted file mode 100644 index 214d7d9df..000000000 --- a/lib/freetype/docs/image/fond2.png +++ /dev/null diff --git a/lib/freetype/docs/image/fond3.jpg b/lib/freetype/docs/image/fond3.jpg Binary files differdeleted file mode 100644 index dfb732738..000000000 --- a/lib/freetype/docs/image/fond3.jpg +++ /dev/null diff --git a/lib/freetype/docs/image/fond3.png b/lib/freetype/docs/image/fond3.png Binary files differdeleted file mode 100644 index fdebb227e..000000000 --- a/lib/freetype/docs/image/fond3.png +++ /dev/null diff --git a/lib/freetype/docs/image/fond3_-30.png b/lib/freetype/docs/image/fond3_-30.png Binary files differdeleted file mode 100644 index f6c655739..000000000 --- a/lib/freetype/docs/image/fond3_-30.png +++ /dev/null diff --git a/lib/freetype/docs/image/fond3_-60.png b/lib/freetype/docs/image/fond3_-60.png Binary files differdeleted file mode 100644 index 3771205b7..000000000 --- a/lib/freetype/docs/image/fond3_-60.png +++ /dev/null diff --git a/lib/freetype/docs/image/fond3_-90.png b/lib/freetype/docs/image/fond3_-90.png Binary files differdeleted file mode 100644 index 8ff9d6050..000000000 --- a/lib/freetype/docs/image/fond3_-90.png +++ /dev/null diff --git a/lib/freetype/docs/image/fond3_30.png b/lib/freetype/docs/image/fond3_30.png Binary files differdeleted file mode 100644 index 372155a69..000000000 --- a/lib/freetype/docs/image/fond3_30.png +++ /dev/null diff --git a/lib/freetype/docs/image/fond3_60.png b/lib/freetype/docs/image/fond3_60.png Binary files differdeleted file mode 100644 index f78c25108..000000000 --- a/lib/freetype/docs/image/fond3_60.png +++ /dev/null diff --git a/lib/freetype/docs/image/fond3_90.png b/lib/freetype/docs/image/fond3_90.png Binary files differdeleted file mode 100644 index 11374aaa4..000000000 --- a/lib/freetype/docs/image/fond3_90.png +++ /dev/null diff --git a/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo1-thumbnail.png b/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo1-thumbnail.png Binary files differdeleted file mode 100644 index a3ab62dfc..000000000 --- a/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo1-thumbnail.png +++ /dev/null diff --git a/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo1.png b/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo1.png Binary files differdeleted file mode 100644 index 7ec9eac9c..000000000 --- a/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo1.png +++ /dev/null diff --git a/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo2-thumbnail.png b/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo2-thumbnail.png Binary files differdeleted file mode 100644 index 8d7a7f432..000000000 --- a/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo2-thumbnail.png +++ /dev/null diff --git a/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo2.png b/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo2.png Binary files differdeleted file mode 100644 index 00805b4a5..000000000 --- a/lib/freetype/docs/image/freetype-262-autohinter-stem-darkening-demo2.png +++ /dev/null diff --git a/lib/freetype/docs/image/freetype-262-new-old-filter-thumbnail.png b/lib/freetype/docs/image/freetype-262-new-old-filter-thumbnail.png Binary files differdeleted file mode 100644 index a7aa37ca2..000000000 --- a/lib/freetype/docs/image/freetype-262-new-old-filter-thumbnail.png +++ /dev/null diff --git a/lib/freetype/docs/image/freetype-262-new-old-filter.png b/lib/freetype/docs/image/freetype-262-new-old-filter.png Binary files differdeleted file mode 100644 index 31ae667f6..000000000 --- a/lib/freetype/docs/image/freetype-262-new-old-filter.png +++ /dev/null diff --git a/lib/freetype/docs/image/freetype-27-consolas-v35-v40.png b/lib/freetype/docs/image/freetype-27-consolas-v35-v40.png Binary files differdeleted file mode 100644 index c48036733..000000000 --- a/lib/freetype/docs/image/freetype-27-consolas-v35-v40.png +++ /dev/null diff --git a/lib/freetype/docs/image/freetype-27-hinting-comparison.png b/lib/freetype/docs/image/freetype-27-hinting-comparison.png Binary files differdeleted file mode 100644 index e00557142..000000000 --- a/lib/freetype/docs/image/freetype-27-hinting-comparison.png +++ /dev/null diff --git a/lib/freetype/docs/image/freetype-27-v35-v40-different-hinting.png b/lib/freetype/docs/image/freetype-27-v35-v40-different-hinting.png Binary files differdeleted file mode 100644 index 431ad25a2..000000000 --- a/lib/freetype/docs/image/freetype-27-v35-v40-different-hinting.png +++ /dev/null diff --git a/lib/freetype/docs/image/freetype.jpg b/lib/freetype/docs/image/freetype.jpg Binary files differdeleted file mode 100644 index 0c6304fa1..000000000 --- a/lib/freetype/docs/image/freetype.jpg +++ /dev/null diff --git a/lib/freetype/docs/image/top.gif b/lib/freetype/docs/image/top.gif Binary files differdeleted file mode 100644 index 6ed55656a..000000000 --- a/lib/freetype/docs/image/top.gif +++ /dev/null diff --git a/lib/freetype/docs/index.html b/lib/freetype/docs/index.html deleted file mode 100644 index 1ff1295a7..000000000 --- a/lib/freetype/docs/index.html +++ /dev/null @@ -1,333 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Overview"> - - <link rel="icon" - href="image/favicon_-60.ico"> - <link rel="shortcut icon" - href="image/favicon_-60.ico"> - <link rel="stylesheet" - type="text/css" - href="css/freetype2_-60.css"> - - <script type="text/javascript" - src="../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../js/freetype2.js"> - </script> - - <title>FreeType Overview</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Overview</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="what-is-freetype"> - <h2>What is FreeType?</h2> - - <p>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.</p> - - <p>Note that FreeType is a <em>font service</em> 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.</p> - - <p>FreeType is released under two open-source licenses: our - own - BSD-like <a href="http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT">FreeType - License</a> and - the <a href="http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/GPLv2.TXT">GNU - Public License, Version 2</a>. It can thus be used - by any kind of projects, be they proprietary or not.</p> - - <p>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.</p> - </div> - - - <!-- ************************************************** --> - - <div id="features"> - <h2>Features</h2> - - <p>The following is a non-exhaustive list of features - provided by FreeType.</p> - - <ul> - <li> - <p>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.</p> - </li> - <li> - <p>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!</p> - </li> - <li> - <p>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.</p> - - <p>You can also reduce the size of the FreeType code by - only compiling the modules you need for your embedded - project or environment.</p> - </li> - <li> - <p>By default, FreeType supports the following font - formats.</p> - - <ul> - <li>TrueType fonts (TTF) and TrueType collections - (TTC)</li> - <li>CFF fonts</li> - <li>WOFF fonts</li> - <li>OpenType fonts (OTF, both TrueType and CFF - variants) and OpenType collections (OTC)</li> - <li>Type 1 fonts (PFA and PFB)</li> - <li>CID-keyed Type 1 fonts</li> - <li>SFNT-based bitmap fonts, including color Emoji</li> - <li>X11 PCF fonts</li> - <li>Windows FNT fonts</li> - <li>BDF fonts (including anti-aliased ones)</li> - <li>PFR fonts</li> - <li>Type 42 fonts (limited support)</li> - </ul> - </li> - <li> - <p>From a given glyph outline, FreeType is capable of - producing a high-quality monochrome bitmap, or - anti-aliased pixmap, using 256 levels of - ‘gray’.</p> - </li> - <li> - <p>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).</p> - </li> - <li> - <p>The FreeType core API provides simple functions to - access advanced information like glyph names or basic - kerning data.</p> - </li> - <li> - <p>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. <em>ClearType</em>, still under - development).</p> - </li> - <li> - <p>For those who don't need or want to use the bytecode - interpreter for TrueType fonts, we developed our - own <em>automatic hinter</em> module. It is also used - by other scalable formats.</p> - </li> - <li> - <p>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).</p> - </li> - <li> - <p>FreeType provides its own caching subsystem. It can - be used to cache either face instances or glyph images - efficiently.</p> - </li> - <li> - <p>A bundle of demo programs demonstrate the usage of - FreeType; look for the - ‘ft2demos-<i>x.x.x</i>’ archive (or - ‘ftdmo<i>xxx</i>’ in case you are on a - Windows platform) at the locations - given <a href="http://freetype.org/download.html">here</a>. - ‘<i>x.x.x</i>’ (or - ‘<i>xxx</i>’) gives the version number, - for example ‘2.4.10’ or - ‘2410’.</p> - </li> - </ul> - </div> - - - <!-- ************************************************** --> - - <div id="requirements"> - <h2>Requirements</h2> - - <p>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 <em>all warnings</em> when compiling with - popular compilers like gcc, Visual C++, and Borland - C++.</p> - - <p>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 <em>need</em> external libraries (e.g., for - handling fonts compressed with gzip or bz2), however, they - are optional and can be disabled.</p> - </div> - - - <!-- ************************************************** --> - - <div id="patents"> - <h2>Patent Issues</h2> - - <p>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.</p> - - <p>More information regarding this topic is available at - our <a href="http://freetype.org/patents.html">patents page</a>.</p> - </div> - - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="index.html" class="current">Overview</a> - </li> - <li class="primary"> - <a href="documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="#what-is-freetype">What is FreeType?</a> - </li> - <li class="secondary"> - <a href="#features">Features</a> - </li> - <li class="secondary"> - <a href="#requirements">Requirements</a> - </li> - <li class="secondary"> - <a href="#patents">Patents</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/js/freetype2.js b/lib/freetype/docs/js/freetype2.js deleted file mode 100644 index 0a15a21dd..000000000 --- a/lib/freetype/docs/js/freetype2.js +++ /dev/null @@ -1,78 +0,0 @@ -/*! - * 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('<div class="bar" id="bottom"></div>'); - } - } - 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/js/jquery-1.11.0.min.js b/lib/freetype/docs/js/jquery-1.11.0.min.js deleted file mode 100644 index 73f33fb3a..000000000 --- a/lib/freetype/docs/js/jquery-1.11.0.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! 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="<div class='a'></div><div class='a i'></div>",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="<select t=''><option selected=''></option></select>",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;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=jb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=kb(b);function nb(){}nb.prototype=d.filters=d.pseudos,d.setFilters=new nb;function ob(a,b){var c,e,f,g,h,i,j,k=x[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=Q.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?db.error(a):x(a,i).slice(0)}function pb(a){for(var b=0,c=a.length,d="";c>b;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 href='#'></a>","#"===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="<input/>",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.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},W=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;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=" <link/><table></table><a href='/a'>a</a>",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",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<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=$.test(e)?this.mouseHooks:Z.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||z),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||z,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==db()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===db()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=z.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===L&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&(a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault())?bb:cb):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:cb,isPropagationStopped:cb,isImmediatePropagationStopped:cb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=bb,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=bb,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submitBubbles||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?b.form:void 0;c&&!n._data(c,"submitBubbles")&&(n.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),n._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.changeBubbles||(n.event.special.change={setup:function(){return Y.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),n.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),n.event.simulate("change",this,a,!0)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;Y.test(b.nodeName)&&!n._data(b,"changeBubbles")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a,!0)}),n._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!Y.test(this.nodeName)}}),l.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=cb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return n().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=cb),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});function eb(a){var b=fb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var fb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gb=/ jQuery\d+="(?:null|\d+)"/g,hb=new RegExp("<(?:"+fb+")[\\s/>]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/<tbody/i,mb=/<|&#?\w+;/,nb=/<(?:script|style|link)/i,ob=/checked\s*(?:[^=]|=\s*.checked.)/i,pb=/^$|\/(?:java|ecma)script/i,qb=/^true\/(.*)/,rb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,sb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},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></$2>")+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)?"<table>"!==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></$2>");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("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Db[0].contentWindow||Db[0].contentDocument).document,b.write(),b.close(),c=Fb(a,b),Db.detach()),Eb[a]=c),c}!function(){var a,b,c=z.createElement("div"),d="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";c.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],a.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(a.style.opacity),l.cssFloat=!!a.style.cssFloat,c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===c.style.backgroundClip,a=c=null,l.shrinkWrapBlocks=function(){var a,c,e,f;if(null==b){if(a=z.getElementsByTagName("body")[0],!a)return;f="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",c=z.createElement("div"),e=z.createElement("div"),a.appendChild(c).appendChild(e),b=!1,typeof e.style.zoom!==L&&(e.style.cssText=d+";width:1px;padding:1px;zoom:1",e.innerHTML="<div></div>",e.firstChild.style.width="5px",b=3!==e.offsetWidth),a.removeChild(c),a=c=e=null}return b}}();var Hb=/^margin/,Ib=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Jb,Kb,Lb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Jb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),Ib.test(g)&&Hb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):z.documentElement.currentStyle&&(Jb=function(a){return a.currentStyle},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ib.test(g)&&!Lb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Mb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h=z.createElement("div"),i="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",j="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";h.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",b=h.getElementsByTagName("a")[0],b.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(b.style.opacity),l.cssFloat=!!b.style.cssFloat,h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,b=h=null,n.extend(l,{reliableHiddenOffsets:function(){if(null!=c)return c;var a,b,d,e=z.createElement("div"),f=z.getElementsByTagName("body")[0];if(f)return e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=z.createElement("div"),a.style.cssText=i,f.appendChild(a).appendChild(e),e.innerHTML="<table><tr><td></td><td>t</td></tr></table>",b=e.getElementsByTagName("td"),b[0].style.cssText="padding:0;margin:0;border:0;display:none",d=0===b[0].offsetHeight,b[0].style.display="",b[1].style.display="none",c=d&&0===b[0].offsetHeight,f.removeChild(a),e=f=null,c},boxSizing:function(){return null==d&&k(),d},boxSizingReliable:function(){return null==e&&k(),e},pixelPosition:function(){return null==f&&k(),f},reliableMarginRight:function(){var b,c,d,e;if(null==g&&a.getComputedStyle){if(b=z.getElementsByTagName("body")[0],!b)return;c=z.createElement("div"),d=z.createElement("div"),c.style.cssText=i,b.appendChild(c).appendChild(d),e=d.appendChild(z.createElement("div")),e.style.cssText=d.style.cssText=j,e.style.marginRight=e.style.width="0",d.style.width="1px",g=!parseFloat((a.getComputedStyle(e,null)||{}).marginRight),b.removeChild(c)}return g}});function k(){var b,c,h=z.getElementsByTagName("body")[0];h&&(b=z.createElement("div"),c=z.createElement("div"),b.style.cssText=i,h.appendChild(b).appendChild(c),c.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;display:block;padding:1px;border:1px;width:4px;margin-top:1%;top:1%",n.swap(h,null!=h.style.zoom?{zoom:1}:{},function(){d=4===c.offsetWidth}),e=!0,f=!1,g=!0,a.getComputedStyle&&(f="1%"!==(a.getComputedStyle(c,null)||{}).top,e="4px"===(a.getComputedStyle(c,null)||{width:"4px"}).width),h.removeChild(b),c=h=null)}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Nb=/alpha\([^)]*\)/i,Ob=/opacity\s*=\s*([^)]*)/,Pb=/^(none|table(?!-c[ea]).+)/,Qb=new RegExp("^("+T+")(.*)$","i"),Rb=new RegExp("^([+-])=("+T+")","i"),Sb={position:"absolute",visibility:"hidden",display:"block"},Tb={letterSpacing:0,fontWeight:400},Ub=["Webkit","O","Moz","ms"];function Vb(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ub.length;while(e--)if(b=Ub[e]+c,b in a)return b;return d}function Wb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=n._data(d,"olddisplay",Gb(d.nodeName)))):f[g]||(e=V(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Xb(a,b,c){var d=Qb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Yb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Zb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Jb(a),g=l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Kb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ib.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Yb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Kb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=Vb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Rb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]="",i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Vb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Kb(a,b,d)),"normal"===f&&b in Tb&&(f=Tb[b]),""===c||c?(e=parseFloat(f),c===!0||n.isNumeric(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&Pb.test(n.css(a,"display"))?n.swap(a,Sb,function(){return Zb(a,b,d)}):Zb(a,b,d):void 0},set:function(a,c,d){var e=d&&Jb(a);return Xb(a,c,d?Yb(a,b,d,l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Ob.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Nb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Nb.test(f)?f.replace(Nb,e):f+" "+e)}}),n.cssHooks.marginRight=Mb(l.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},Kb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Hb.test(a)||(n.cssHooks[a+b].set=Xb)}),n.fn.extend({css:function(a,b){return W(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Jb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b) -},a,b,arguments.length>1)},show:function(){return Wb(this,!0)},hide:function(){return Wb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function $b(a,b,c,d,e){return new $b.prototype.init(a,b,c,d,e)}n.Tween=$b,$b.prototype={constructor:$b,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=$b.propHooks[this.prop];return a&&a.get?a.get(this):$b.propHooks._default.get(this)},run:function(a){var b,c=$b.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):$b.propHooks._default.set(this),this}},$b.prototype.init.prototype=$b.prototype,$b.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},$b.propHooks.scrollTop=$b.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=$b.prototype.init,n.fx.step={};var _b,ac,bc=/^(?:toggle|show|hide)$/,cc=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),dc=/queueHooks$/,ec=[jc],fc={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=cc.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&cc.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function gc(){return setTimeout(function(){_b=void 0}),_b=n.now()}function hc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=U[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function ic(a,b,c){for(var d,e=(fc[b]||[]).concat(fc["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function jc(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&V(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k=Gb(a.nodeName),"none"===j&&(j=k),"inline"===j&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==k?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],bc.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}if(!n.isEmptyObject(o)){r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=ic(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function kc(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function lc(a,b,c){var d,e,f=0,g=ec.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=_b||gc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:_b||gc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(kc(k,j.opts.specialEasing);g>f;f++)if(d=ec[f].call(j,a,k,j.opts))return d;return n.map(k,ic,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(lc,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],fc[c]=fc[c]||[],fc[c].unshift(b)},prefilter:function(a,b){b?ec.unshift(a):ec.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=lc(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&dc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(hc(b,!0),a,d,e)}}),n.each({slideDown:hc("show"),slideUp:hc("hide"),slideToggle:hc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(_b=n.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),_b=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ac||(ac=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(ac),ac=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e=z.createElement("div");e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=e.getElementsByTagName("a")[0],c=z.createElement("select"),d=c.appendChild(z.createElement("option")),b=e.getElementsByTagName("input")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==e.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=d.selected,l.enctype=!!z.createElement("form").enctype,c.disabled=!0,l.optDisabled=!d.disabled,b=z.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value,a=b=c=d=e=null}();var mc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(mc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.text(a)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var nc,oc,pc=n.expr.attrHandle,qc=/^(?:checked|selected)$/i,rc=l.getSetAttribute,sc=l.input;n.fn.extend({attr:function(a,b){return W(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===L?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?oc:nc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(F);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?sc&&rc||!qc.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(rc?c:d)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),oc={set:function(a,b,c){return b===!1?n.removeAttr(a,c):sc&&rc||!qc.test(c)?a.setAttribute(!rc&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=pc[b]||n.find.attr;pc[b]=sc&&rc||!qc.test(b)?function(a,b,d){var e,f;return d||(f=pc[b],pc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,pc[b]=f),e}:function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),sc&&rc||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void(a.defaultValue=b):nc&&nc.set(a,b,c)}}),rc||(nc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},pc.id=pc.name=pc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:nc.set},n.attrHooks.contenteditable={set:function(a,b,c){nc.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var tc=/^(?:input|select|textarea|button|object)$/i,uc=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return W(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):tc.test(a.nodeName)||uc.test(a.nodeName)&&a.href?0:-1}}}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var vc=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(F)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===L||"boolean"===c)&&(this.className&&n._data(this,"__className__",this.className),this.className=this.className||a===!1?"":n._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(vc," ").indexOf(b)>=0)return!0;return!1}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var wc=n.now(),xc=/\?/,yc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(yc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var zc,Ac,Bc=/#.*$/,Cc=/([?&])_=[^&]*/,Dc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ec=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Fc=/^(?:GET|HEAD)$/,Gc=/^\/\//,Hc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ic={},Jc={},Kc="*/".concat("*");try{Ac=location.href}catch(Lc){Ac=z.createElement("a"),Ac.href="",Ac=Ac.href}zc=Hc.exec(Ac.toLowerCase())||[];function Mc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(F)||[];if(n.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nc(a,b,c,d){var e={},f=a===Jc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Oc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Pc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Qc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ac,type:"GET",isLocal:Ec.test(zc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Oc(Oc(a,n.ajaxSettings),b):Oc(n.ajaxSettings,a)},ajaxPrefilter:Mc(Ic),ajaxTransport:Mc(Jc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Dc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||Ac)+"").replace(Bc,"").replace(Gc,zc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(F)||[""],null==k.crossDomain&&(c=Hc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===zc[1]&&c[2]===zc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(zc[3]||("http:"===zc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),Nc(Ic,k,b,v),2===t)return v;h=k.global,h&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Fc.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(xc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Cc.test(e)?e.replace(Cc,"$1_="+wc++):e+(xc.test(e)?"&":"?")+"_="+wc++)),k.ifModified&&(n.lastModified[e]&&v.setRequestHeader("If-Modified-Since",n.lastModified[e]),n.etag[e]&&v.setRequestHeader("If-None-Match",n.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Kc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Nc(Jc,k,b,v)){v.readyState=1,h&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Pc(k,v,c)),u=Qc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(n.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!l.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||n.css(a,"display"))},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var Rc=/%20/g,Sc=/\[\]$/,Tc=/\r?\n/g,Uc=/^(?:submit|button|image|reset|file)$/i,Vc=/^(?:input|select|textarea|keygen)/i;function Wc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Sc.test(a)?d(a,e):Wc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Wc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Wc(c,a[c],b,e);return d.join("&").replace(Rc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Vc.test(this.nodeName)&&!Uc.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Tc,"\r\n")}}):{name:b.name,value:c.replace(Tc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&$c()||_c()}:$c;var Xc=0,Yc={},Zc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Yc)Yc[a](void 0,!0)}),l.cors=!!Zc&&"withCredentials"in Zc,Zc=l.ajax=!!Zc,Zc&&n.ajaxTransport(function(a){if(!a.crossDomain||l.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Xc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Yc[g],b=void 0,f.onreadystatechange=n.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Yc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function $c(){try{return new a.XMLHttpRequest}catch(b){}}function _c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=z.head||n("head")[0]||z.documentElement;return{send:function(d,e){b=z.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var ad=[],bd=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=ad.pop()||n.expando+"_"+wc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(bd.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&bd.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(bd,"$1"+e):b.jsonp!==!1&&(b.url+=(xc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,ad.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||z;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var cd=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&cd)return cd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h,a.length),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&n.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var dd=a.document.documentElement;function ed(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?(typeof e.getBoundingClientRect!==L&&(d=e.getBoundingClientRect()),c=ed(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||dd;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||dd})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return W(this,function(a,d,e){var f=ed(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Mb(l.pixelPosition,function(a,c){return c?(c=Kb(a,b),Ib.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return W(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var fd=a.jQuery,gd=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=gd),b&&a.jQuery===n&&(a.jQuery=fd),n},typeof b===L&&(a.jQuery=a.$=n),n}); diff --git a/lib/freetype/docs/js/jquery.ba-resize.min.js b/lib/freetype/docs/js/jquery.ba-resize.min.js deleted file mode 100644 index c67888314..000000000 --- a/lib/freetype/docs/js/jquery.ba-resize.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * jQuery resize event - v1.1 - 3/14/2010 - * http://benalman.com/projects/jquery-resize-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ -(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
\ No newline at end of file diff --git a/lib/freetype/docs/subpixel-hinting.html b/lib/freetype/docs/subpixel-hinting.html deleted file mode 100644 index cd92041d8..000000000 --- a/lib/freetype/docs/subpixel-hinting.html +++ /dev/null @@ -1,313 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - - <link rel="icon" - href="image/favicon_-90.ico"> - <link rel="shortcut icon" - href="image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../js/freetype2.js"> - </script> - - <title>The new v40 TrueType interpreter mode</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Subpixel Hinting</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - <!-- ************************************************** --> - - <div id="subpixel-hinting"> - <h2>The new v40 TrueType interpreter mode</h2> - <div class="date">2016-09-08, contributed by Nikolaus - Waxweiler</div> - - <p>FreeType 2.7 ships the new v40 TrueType instructions - interpreter version enabled by default. It finally brings - DirectWrite/ClearType-like rendering to the screen, or - ‘subpixel hinting’ as some FreeType code calls - it. Actually, there is no subpixel hinting. Read on.</p> - - <p><img src="image/freetype-27-hinting-comparison.png" - alt="Demonstration and comparison of the various - hinting modes."></p> - - <p>For the past years, the previous v35 interpreter did as - the TrueType specification from the 90s said. The - TrueType hinting machinery was originally conceived to - make vector outlines render well as black-and-white - bitmaps on the coarse-pixeled CRTs of back in the days. - Look at screenshots of Windows 95 and you'll see pixely, - bitmappy text. In reality, the single glyphs are scalable - vector outlines beaten into the pixel grid by small - programs run on them inside the font before being handed - off to the rasterizer. Read: glyphs were designed to be - reprogrammed on the fly, per size, for sharper on-screen - display. Microsoft invested significant manpower into - what is commonly called the core web fonts (Arial, Times - New Roman, Courier New, etc.) to beat and re-beat each and - every glyph to a full pixel grid at all commonly used - sizes. If this sounds like a lot of sisyphean work, - that's because it is. To this day, only few font families - have had the same amount of work put into them.</p> - - <p>Times changed, LCDs came along and Microsoft rediscovered - subpixel rendering that exploits the physical structure of - LCD subpixels, usually RGB stripes, to increase the - horizontal resolution approximately three times (not quite - actually since you need to apply a blurrying filter to - lessen color fringes). More resolution meant that less - work had to be put into a font and instead of snapping - things to full pixels, they could now be snapped to one of - those three subpixels or a fraction of that for a much - finer appearance (‘subpixel hinting’) while - still appearing sharper than with plain old grayscale - antialiasing. Since fonts are explicitly programmed in - the TrueType model, they now had a lot of older fonts that - would need to be updated to take advantage of the new - possibilities or to even render correctly. Knowing this - would never happen, they implemented supersampling and a - compatibility mode that contained several interpreter rigs - and preventive measures for dirty hacks used in older - fonts to achieve pixel perfection. Older fonts that were - snapping things to full pixels all around could now at - least benefit a little from the increased horizontal - resolution. Beat Stamm describes this work in detail - <a href="http://www.beatstamm.com/typography/RTRCh4.htm#Sec1">on - his site</a>. Microsoft later released the ClearType - collection fonts (Calibri, Cambria, Consolas, etc.) to - demonstrate the new possibilities that just so happened - to rely on this compatibility mode to render correctly. - Many new fonts did and still do.</p> - - <p>FreeType didn't implement a similar compatibility mode. - This had two side effects.</p> - - <ol> - <li> - <p>It lead to glitches when rendering fonts that assumed - a compatibility mode with supersampler and interpreter - rigs is present, i.e., most modern fonts.</p> - - <p><img src="image/freetype-27-consolas-v35-v40.png" - alt="Hinting comparison of the Consolas font."></p> - - <p>The same can happen on Windows if you disable - ClearType in the system settings and look at random - web pages with custom fonts.</p> - </li> - - <li> - <p>Different fonts in a browser could look jarringly - different next to each other. Older fonts like the - core web fonts snap things to full hard pixels on both - axes, newer fonts and especially web fonts often use a - hinting strategy that snaps glyphs to the pixel grid - mainly or only vertically and with varying - strength.</p> - - <p><img src="image/freetype-27-v35-v40-different-hinting.png" - alt="Hinting comparison between Georgia and NotoSerif."></p> - - <p>Snapping things to the grid on one axis instead of - two greatly reduces the complexity and cost of - hinting, looks smoother and comes with important - spacing benefits for horizontal (Latin!) text. And - it's just as readable.</p> - </li> - </ol> - - <p>For some time already, FreeType shipped with a v38 - interpreter, also known as ‘Infinality’. Its - developer set out to make fonts render better than on - Windows and give users the ability to configure font - rendering to their liking. Out of the box, it made fonts - look like they were rendered through ClearType instead of - on Windows 95. It was disabled by default because it was - painfully slow and the original developer lost interest in - developing the code further. You'll find it used in - several distribution repositories maintained by community - members.</p> - - <p>My work on stem darkening (incompatible with explicit - horizontal hinting, i.e., TrueType) and frustration that - v35 was still the default (I prefer what - DirectWrite/ClearType puts on the screen) led me to strip - the v38 Infinality code to the bare minimum and remove all - configurability in the name of speed and simplicity. The - result is called v40 and it's just as fast as v35. v38 is - still there and usable, it just isn't compiled in by - default. If you compile it in, you can switch between the - different interpreters at runtime, using an environment - variable (or using the property API of FreeType). There - is currently no way to switch this from FontConfig or any - other means. Packagers of ‘Infinality’ - packages will probably jump in and update the packages - accordingly.</p> - - <p>Here is the core secret to making fonts render like - through DirectWrite/ClearType on Windows: There actually - is no subpixel hinting going on here. Shock. The code - simply ignores <em>all</em> horizontal hinting - instructions. That's less work than supersampling and - gets us almost identical results <em>and</em> additionally - prevents changes to the advance width of glyphs. This - greatly harmonizes the look of older and newer TrueType - fonts and incidentally solves glyph spacing problems of - less well instructed fonts. Switching to the new mode - might take some getting used to though, so if you think - your fonts are suddenly fat, fuzzy or weird, give your - brain some time to adjust.</p> - - <p>No upside without a downside, though. What made v38 so - slow was its attempt to implement the hacks Microsoft - describes in - a <a href="https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx">whitepaper</a> - for their interpreter and rasterizer <em>and</em> a - configuration layer on top of that so fonts could be - specially handled down to single glyphs. Given the bugs - in and dirty hacks used by Arial and co., this was - necessary to make them render better than on Windows. In - my opinion, this is solid over-engineering in times where - the web is full of good-quality typefaces that display - well without horizontal hinting or don't even have it.</p> - - <p>The v40 code does not use any whitelist or other means to - handle certain fonts differently. It focuses on ignoring - horizontal hinting and preventing the dirtiest hacks that - dent more than they help. Modern fonts like Calibri, - Cambria, Consolas, etc., render well with this approach, - older fonts like Arial, Times New Roman, Georgia and - Verdana display mostly fine with smaller details off. And - that's okay. Basically, the harder a font tries to create - pixel-perfect black and white bitmaps for old CRT - monitors, the worse the results in the new mode. If - someone finds ways to make older fonts render better - without introducing lists or overly complex hacks, I'm - interested.</p> - - <p>PS: I recommend using the Liberation family of fonts - (version 2 and up, important!) instead of Arial, - Times New Roman, and Courier. The family harmonizes much - better internally and is equipped with much better - ClearType-ready hinting. Fedora still ships some 1.x - version; you can get the newer 2.x with improved hinting - and glyph coverage from - <a href="https://fedorahosted.org/liberation-fonts">here</a>.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="index.html">Overview</a> - </li> - <li class="primary"> - <a href="documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="#subpixel-hinting" class="current">The v40 Hinting - Mode</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/text-rendering-general.html b/lib/freetype/docs/text-rendering-general.html deleted file mode 100644 index ec33c246f..000000000 --- a/lib/freetype/docs/text-rendering-general.html +++ /dev/null @@ -1,507 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - - <link rel="icon" - href="image/favicon_-90.ico"> - <link rel="shortcut icon" - href="image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../js/freetype2.js"> - </script> - - <title>On slight hinting, proper text rendering, stem darkening and - LCD filters</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> LCD Support</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - <!-- ************************************************** --> - - <div id="slight-hinting"> - <h2>On Slight Hinting, Proper Text Rendering, Stem Darkening - and LCD Filters</h2> - <div class="date">2015-11-30, contributed by Nikolaus - Waxweiler (with corrections from Graham Asher), updated - 2015-12-08</div> - - <p><em>This article was originally written for the 2.6.2 - release of FreeType and explains the technical - background of several features. The information was - deemed useful enough to be added to the documentation - and has therefore been retitled.</em></p> - - <p>FreeType 2.6.2 ships with three interesting details for - users and developers of rendering libraries that deal with - text.</p> - - <ul> - <li> - <a href="#slight-hinting-invokes-the-native-hinter-if-possible">(S)light - hinting invokes the native hinter if possible</a> - </li> - <li> - <a href="#experimental-stem-darkening-for-the-auto-hinter">Experimental: - Stem darkening for the auto-hinter</a> - <ul> - <li><a href="#background">Background</a></li> - <li><a href="#back-to-stem-darkening">Back to stem - darkening</a></li> - </ul> - </li> - <li> - <a href="#disabled-stem-darkening-for-the-autohinter-and-adobes-cff-otf-engine">Disabled - stem darkening for the autohinter and Adobe’s CFF - (<code>.otf</code>) engine</a> - </li> - <li><a href="#the-default-lcd-filter-for-subpixel-rendering-has-been-changed">The - default LCD filter for subpixel rendering has been - changed</a> - </li> - </ul> - - <h3 id="slight-hinting-invokes-the-native-hinter-if-possible">(S)light - hinting invokes the native hinter if possible</h3> - - <p>In the past, setting ‘slight’ hinting via FontConfig or - configuration GUIs meant that native hints within a font - were ignored; FreeType’s auto-hinter would analyze the - font on the fly and automatically do what the font - designer would have to do at least semi-manually. - Technically, the auto-hinter set to (s)light snaps glyphs - to the pixel grid only vertically, just like Adobe’s - proprietary font engine and in a certain way also - Microsoft’s ClearType/DirectWrite. The result is a - compromise between design fidelity and sharpness that - preserves inter-glyph spacing, something very important - for horizontal text such as what you are reading right - now. The sharpness has usually been enhanced with - ‘subpixel rendering’ (ClearType on Windows), exploiting - the physical properties of modern but low-resolution LCD - panels.</p> - - <p>This worked out well so far, Ubuntu has been using this - setting for every font for years now. Werner Lemberg is - adding support for more and more scripts and has also spun - off the code - into <a href="http://www.freetype.org/ttfautohint/">ttfautohint</a>, - to help font designers ease the pain of manual - hinting.</p> - - <p>This also meant that the native hinting machinery of the - font drivers went unused. Historically, this decision was - sound because the native hinting mechanics for Postscript - (<code>.pfa</code>, <code>.pfb</code>), TrueType - (<code>.ttf</code>) and OpenType/CFF (<code>.otf</code>) - were subpar for the longest time. The PostScript hinter - still is, but with Adobe’s high-quality OpenType/CFF - engine contributed to FreeType and recent advances of the - TrueType driver towards full ClearType support, things - have changed.</p> - - <p>Setting ‘slight’ hinting usually leads - to <code>FT_LOAD_TARGET_LIGHT</code>. This mode implied - the auto-hinter before and has now been changed to mean - “Use native vertical-grid-only-snapping if driver and font - supports it and vertical-grid-only auto-hinter otherwise”. - Right now, only the OpenType/CFF driver is supported. In - the future, this will hopefully include the TrueType - engine once full support for ClearType arrives. - Technically, ClearType fonts can and will snap to the - vertical <em>and</em> the horizontal - grid <a href="http://www.beatstamm.com/typography/RTRCh4.htm#Sec12">depending - on several details</a>, but the net result is going in the - direction we want.</p> - - <p>This decision was driven by my personal whim; I wanted - native vertical grid-fitting if the font driver and font - supports it, and the auto-hinter otherwise. I assume that - native hints are made more carefully and take the - (auto-hinting) guesswork out of the process. Instead of - introducing per-format configuration in FontConfig and - fighting <a href="http://www.gtk.org/">GTK</a>/<a href="https://www.gnome.org/">GNOME</a> - that only support a single global hinting setting, it was - found to make more sense to change the definition of light - hinting in FreeType.</p> - - <p>I also hope this change will make it easier for the - non-Windows-and-Apple ecosystem to switch over to slight - hinting as the default. Current full/medium native - hinting, as is the default, tends to bring out the worst - in many, many fonts that haven’t seen the same insane - dedication to on-screen display and hinting as many - popular Microsoft fonts, for example. And since ClearType - is still not fully supported, you usually get a very poor - default experience. Slight hinting gives a much better - one, as Ubuntu has proven over the years.</p> - - - <h3 id="experimental-stem-darkening-for-the-auto-hinter">Experimental: - Stem darkening for the auto-hinter</h3> - - <p><a href="image/freetype-262-autohinter-stem-darkening-demo1.png"> - <img src="image/freetype-262-autohinter-stem-darkening-demo1-thumbnail.png" - alt="Demonstration and comparison of the - emboldening autohinter."></a></p> - - <p>Stem darkening emboldens glyphs at smaller sizes to make - them more readable on common low-DPI screens. If this - sounds familiar to you, that’s because Adobe’s CFF engine - has been doing it since it was contributed in 2013. You - might have noticed that OpenType/CFF fonts (commonly - suffixed <code>.otf</code>) like GNOME 3’s default UI - font <a href="https://en.wikipedia.org/wiki/Cantarell_%28typeface%29">Cantarell</a> - appear bolder and fuzzier than other fonts, at least until - this release. The auto-hinter can do the exact same thing - now, it is just disabled by default.</p> - - <p>But why would you do this if small glyphs are already - fairly readable? It turns out that font rendering in the - Linux ecosystem has been wrong since scalable fonts were - introduced to it. Text must be rendered with linear alpha - blending and gamma correction, which no toolkit or - rendering library does by default on - <a href="http://www.x.org/">X11</a>, even - though <a href="http://www.qt.io/">Qt5</a> - and <a href="https://skia.org/">Skia</a> (as used by - Google Chrome and other browsers) can do it.</p> - - - <h4 id="background">Background</h4> - - <p>First, to understand why they are required, you must know - that when FreeType outputs a grayscale glyph image, it - really outputs a coverage bitmap. If a pixel is - completely covered by a filled-in outline, the pixel is - made 100% black (0% brightness, which is simply black). - If a pixel is only 50% covered, the pixel is made 50% - black (50% brightness or a middle shade of gray) and 0% - covered means 0% black (100% brightness or white). On - high-DPI screens like on smartphones and tablets, the - pixels are so small that the chance of being completely - covered and therefore completely black is fairly good. On - low-DPI screens most of us are sadly stuck with, the - situation is different. The pixels are too large for most - of the details of a glyph and shades of gray are the norm - rather than the exception.</p> - - <p>This is relevant because all our screens have a second - problem: they are not linear. 1 + 1 is - not 2. Twice the value does not result in twice the - brightness. When a pixel is only 50% covered, the - coverage map says 50% black, and this translates to a - pixel value of 128 when you use 8 bits per - channel (0-255). However, this does not translate to 50% - brightness for that pixel on our sRGB and gamma 2.2 - screens. Due to their non-linearity, they dwell longer in - the darks and only a pixel value of about 186 results - in 50% brightness – 128 ends up too dark on both - bright and dark backgrounds. The net result is that dark - text looks burnt-out, pixely and blotchy on bright - background, bright text too frail on dark backgrounds, and - colored text on colored background (for example, red on - green) seems to have dark halos or ‘dirt’ around it. The - situation is especially ugly for diagonal stems like in - glyph ‘w’, where the quality of FreeType’s anti-aliasing - depends on the correct display of grays. On high-DPI - screens where smaller, fully black pixels reign supreme, - this doesn’t matter, but on our low-DPI screens with all - the gray shades, it does. 0% and 100% brightness are the - same things in linear and non-linear space, just all the - shades in-between are not.</p> - - <p>The correct way of rendering a glyph image on a surface - is - to <a href="https://en.wikipedia.org/wiki/Alpha_compositing">alpha - blend</a> it onto the surface in linear space and then - apply <a href="https://en.wikipedia.org/wiki/Gamma_correction">gamma - correction</a> to translate the linear coverage map to - something that is correct for our screens.<sup>1</sup> No - toolkit in the Linux ecosystem does it by default, even - though Qt5 and Skia can and will do it on other platforms. - Windows and Mac OS X do it natively. This procedure - is especially important if glyphs should be - subpixel-rendered (ClearType and Mac - OS X) <a href="http://lists.nongnu.org/archive/html/freetype-devel/2015-11/msg00020.html">with - as few color fringes as possible</a>.</p> - - <p><sup>1</sup> This process can cost performance. There is - an approximation that does not need to know about the - background color. - See <a href="https://bel.fi/alankila/lcd/">https://bel.fi/alankila/lcd/</a> - and <a href="https://bel.fi/alankila/lcd/alpcor.html">https://bel.fi/alankila/lcd/alpcor.html</a> - for details. There is a proof-of-concept pixman hack for - cairo.</p> - - - <h4 id="back-to-stem-darkening">Back to stem darkening</h4> - - <p>Assume we render fonts correctly. Gamma correction - essentially lightens fonts since shades of gray are - shifted to higher pixel values (corresponding to higher - brightness) to match the original intention to the reality - of our screens. The side-effect is that glyphs that were - rendered incorrectly but fairly readable suddenly thin - out. Correctly rendered but hard-to-read text doesn’t do - anyone a favor. So Mac OS X and Adobe’s proprietary - font engine implement a counter-measure: stem darkening at - smaller sizes where shades of gray dominate. By - emboldening a glyph slightly in relation to its pixel - size, individual pixels get higher coverage of filled-in - outlines and are therefore blacker. This increases - contrast and prevents thinning out of glyphs. Text - remains readable at smaller sizes.</p> - - <p><a href="image/BlendingExamples.png"> - <img src="image/BlendingExamples-thumbnail.png" - alt="Comparison of different ways of - blending."></a></p> - - <p>“Gamma 1.0” shows what happens when you take a grayscale - coverage bitmap from FreeType and blend it onto a surface - in linear space. Black-on-white is heavier than - white-on-black and red-on-green has dark halos or dirt - around it. Note that this picture is unrealistic in the - sense that no rendering system on X11 does linear alpha - blending, so imagine something worse. “Gamma 1.8” is the - result of linear alpha blending and gamma correction. It - is much better, but text thins out, making it harder to - read. Adding stem darkening gets us to “Gamma 1.8, - darkened”. Note how it is the cleanest rendering of all. - “Gamma 1.0, darkened”, meaning linear alpha blending - without gamma correction but with stem darkening, - exaggerates the effects of “Gamma 1.0”. Stem darkening - should only be enabled when doing gamma correction, so - ideally it should always be done.</p> - - <p><a href="image/freetype-262-autohinter-stem-darkening-demo2.png"> - <img src="image/freetype-262-autohinter-stem-darkening-demo2-thumbnail.png" - alt="Waterfall comparison of non-emboldening and - emboldening autohinter."></a></p> - - <p>The autohinter has a new toggleable stem darkening - property that works like the stem darkener in Adobe’s CFF - engine. Note how it makes text slightly bolder with the - default parameters, down to small pixel sizes. Gamma - correction is active to demonstrate the thinning out of - text especially at smaller pixel sizes with lots of gray - pixels.</p> - - <p>And that is the story behind this feature.</p> - - - <h3 id="disabled-stem-darkening-for-the-autohinter-and-adobes-cff-otf-engine">Disabled - stem darkening for the autohinter and Adobe’s CFF - (<code>.otf</code>) engine</h3> - - <p>No library supports linear alpha blending and gamma - correction out of the box on X11. Turning on stem - darkening leads to heavy and fuzzy looking glyphs as in - “Gamma 1.0, darkened” above, so it’s better to disable - it.</p> - - <p>Qt5 actually had gamma correction enabled for a short - time while until someone complained that text was too - light and unlike rendering in other toolkits, so the - maintainers disabled it for - the <a href="https://bugreports.qt.io/browse/QTBUG-41590">XCB-backend</a>. - Skia (Chrome) can do gamma-correction, but turns it off - for X11.</p> - - <p>I see autohinter stem darkening as a technology preview - for playing around with until we get stem darkening - generic within FreeType. The plan is to provide it for - all font drivers and make it toggleable - per <code>FT_Library</code> just like - <code>FT_Library_SetLcdFilter</code>. Libraries that - support linear alpha blending and gamma correction can - then just flip the switch and get appropriate glyphs no - matter the font.</p> - - <p>A notable side-effect of disabling all stem darkening by - default is that natively hinted <code>.otf</code> fonts - will render remarkably similar to the auto-hinter and are - no longer heavy and fuzzy. Slight hinting will result in - consistent font rendering.</p> - - - <h3 id="the-default-lcd-filter-for-subpixel-rendering-has-been-changed">The - default LCD filter for subpixel rendering has been - changed</h3> - - <p><a href="image/freetype-262-new-old-filter.png"> - <img src="image/freetype-262-new-old-filter-thumbnail.png" - alt="Comparison of the old and new - filter."></a></p> - - <p>When you look at subpixel-rendered text, no matter - whether it is on some kind of Unix, Windows, or Mac - OS X, you might notice that it is slightly colored. - Using subpixel rendering on LCD panels is a trade-off; you - get three times higher resolution in the direction of the - pixel-substripe (usually horizontal RGB) in exchange for - color artifacts, also called color fringes. For this - reason it is necessary to filter a subpixel-rendered glyph - to reduce those color fringes before putting it somewhere - on the screen. The filter distributes the values of a - subpixel to its neighbors, sacrificing some of the higher - resolution and making the resulting glyph image blurrier, - but the positioning improvement remains! The ideal filter - for you depends on your screen (gamma curves), the - capabilities of the rendering system (linear alpha - blending and gamma correction), your vision and your - taste, probably in that order.</p> - - <p>A filter should have two properties: it should be - normalized, meaning the values used in the filter should - sum up to a figurative 1 (here: 0x100 or 256) and it - should be color-balanced, meaning that values for one - subpixel are equally distributed to all other subpixels of - a pixel to sacrifice some of the higher resolution to - drastically reduce color fringes.</p> - - <p>Previously, FreeType’s default LCD filter was neither - normalized nor color-balanced. That was a deliberate - choice because there is still no rendering system on - Unix-like operating systems that does linear alpha - blending and gamma correction by default to render glyphs - correctly. Going above a filter sum of 1 increased - contrast somewhat at the expense of slight distortions and - increased color-fringing, so this can be seen as a hack. - You might have noticed that thumbnails in various places - on your computer that show text could be quite colorful. - Now you know why.</p> - - <p>The new default filter is both normalized and - color-balanced. It is indeed ever so slightly blurrier - than the previous default one, but also lacks its - harshness and is less color-happy. The blurriness also - means higher tolerance for non-ideal screen gamma (viewing - angles) and rendering systems without linear alpha - blending. Note that color fringes can only be really - minimized when the rendering system will do linear alpha - blending of text.</p> - - <p>The ‘light’ filter that has accompanied the default one - for so long stays unchanged: it already is normalized and - color-balanced. It is sharper than the default one but - less tolerant of uncalibrated screens and rendering - systems without linear alpha blending, producing more - color fringes.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="index.html">Overview</a> - </li> - <li class="primary"> - <a href="documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="#slight-hinting" class="current">On Slight - Hinting, …</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/tutorial/example1.c b/lib/freetype/docs/tutorial/example1.c deleted file mode 100644 index f80141105..000000000 --- a/lib/freetype/docs/tutorial/example1.c +++ /dev/null @@ -1,156 +0,0 @@ -/* example1.c */ -/* */ -/* This small program shows how to print a rotated string with the */ -/* FreeType 2 library. */ - - -#include <stdio.h> -#include <string.h> -#include <math.h> - -#include <ft2build.h> -#include FT_FREETYPE_H - - -#define WIDTH 640 -#define HEIGHT 480 - - -/* origin is the upper left corner */ -unsigned char image[HEIGHT][WIDTH]; - - -/* Replace this function with something useful. */ - -void -draw_bitmap( FT_Bitmap* bitmap, - FT_Int x, - FT_Int y) -{ - FT_Int i, j, p, q; - FT_Int x_max = x + bitmap->width; - FT_Int y_max = y + bitmap->rows; - - - /* for simplicity, we assume that `bitmap->pixel_mode' */ - /* is `FT_PIXEL_MODE_GRAY' (i.e., not a bitmap font) */ - - for ( i = x, p = 0; i < x_max; i++, p++ ) - { - for ( j = y, q = 0; j < y_max; j++, q++ ) - { - if ( i < 0 || j < 0 || - i >= WIDTH || j >= HEIGHT ) - continue; - - image[j][i] |= bitmap->buffer[q * bitmap->width + p]; - } - } -} - - -void -show_image( void ) -{ - int i, j; - - - for ( i = 0; i < HEIGHT; i++ ) - { - for ( j = 0; j < WIDTH; j++ ) - putchar( image[i][j] == 0 ? ' ' - : image[i][j] < 128 ? '+' - : '*' ); - putchar( '\n' ); - } -} - - -int -main( int argc, - char** argv ) -{ - FT_Library library; - FT_Face face; - - FT_GlyphSlot slot; - FT_Matrix matrix; /* transformation matrix */ - FT_Vector pen; /* untransformed origin */ - FT_Error error; - - char* filename; - char* text; - - double angle; - int target_height; - int n, num_chars; - - - if ( argc != 3 ) - { - fprintf ( stderr, "usage: %s font sample-text\n", argv[0] ); - exit( 1 ); - } - - filename = argv[1]; /* first argument */ - text = argv[2]; /* second argument */ - num_chars = strlen( text ); - angle = ( 25.0 / 360 ) * 3.14159 * 2; /* use 25 degrees */ - target_height = HEIGHT; - - error = FT_Init_FreeType( &library ); /* initialize library */ - /* error handling omitted */ - - error = FT_New_Face( library, filename, 0, &face );/* create face object */ - /* error handling omitted */ - - /* use 50pt at 100dpi */ - error = FT_Set_Char_Size( face, 50 * 64, 0, - 100, 0 ); /* set character size */ - /* error handling omitted */ - - /* cmap selection omitted; */ - /* for simplicity we assume that the font contains a Unicode cmap */ - - slot = face->glyph; - - /* set up matrix */ - matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L ); - matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L ); - matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L ); - matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L ); - - /* the pen position in 26.6 cartesian space coordinates; */ - /* start at (300,200) relative to the upper left corner */ - pen.x = 300 * 64; - pen.y = ( target_height - 200 ) * 64; - - for ( n = 0; n < num_chars; n++ ) - { - /* set transformation */ - FT_Set_Transform( face, &matrix, &pen ); - - /* load glyph image into the slot (erase previous one) */ - error = FT_Load_Char( face, text[n], FT_LOAD_RENDER ); - if ( error ) - continue; /* ignore errors */ - - /* now, draw to our target surface (convert position) */ - draw_bitmap( &slot->bitmap, - slot->bitmap_left, - target_height - slot->bitmap_top ); - - /* increment pen position */ - pen.x += slot->advance.x; - pen.y += slot->advance.y; - } - - show_image(); - - FT_Done_Face ( face ); - FT_Done_FreeType( library ); - - return 0; -} - -/* EOF */ diff --git a/lib/freetype/docs/tutorial/example2.cpp b/lib/freetype/docs/tutorial/example2.cpp deleted file mode 100644 index 1a4753fd5..000000000 --- a/lib/freetype/docs/tutorial/example2.cpp +++ /dev/null @@ -1,402 +0,0 @@ -// example2.cpp - -// This file demonstrates how to render a coloured glyph with a differently -// coloured outline. -// -// Written Feb. 2009 by Erik Möller, -// with slight modifications by Werner Lemberg -// -// Public domain. -// -// Eric uses similar code in real applications; see -// -// http://www.timetrap.se -// http://www.emberwind.se -// -// for more. - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_STROKER_H - -#include <vector> -#include <fstream> -#include <iostream> - - -#ifdef _MSC_VER -#define MIN __min -#define MAX __max -#else -#define MIN std::min -#define MAX std::max -#endif - - -// Define some fixed size types. - -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned int uint32; - - -// Try to figure out what endian this machine is using. Note that the test -// below might fail for cross compilation; additionally, multi-byte -// characters are implementation-defined in C preprocessors. - -#if (('1234' >> 24) == '1') -#elif (('4321' >> 24) == '1') - #define BIG_ENDIAN -#else - #error "Couldn't determine the endianness!" -#endif - - -// A simple 32-bit pixel. - -union Pixel32 -{ - Pixel32() - : integer(0) { } - Pixel32(uint8 bi, uint8 gi, uint8 ri, uint8 ai = 255) - { - b = bi; - g = gi; - r = ri; - a = ai; - } - - uint32 integer; - - struct - { -#ifdef BIG_ENDIAN - uint8 a, r, g, b; -#else // BIG_ENDIAN - uint8 b, g, r, a; -#endif // BIG_ENDIAN - }; -}; - - -struct Vec2 -{ - Vec2() { } - Vec2(float a, float b) - : x(a), y(b) { } - - float x, y; -}; - - -struct Rect -{ - Rect() { } - Rect(float left, float top, float right, float bottom) - : xmin(left), xmax(right), ymin(top), ymax(bottom) { } - - void Include(const Vec2 &r) - { - xmin = MIN(xmin, r.x); - ymin = MIN(ymin, r.y); - xmax = MAX(xmax, r.x); - ymax = MAX(ymax, r.y); - } - - float Width() const { return xmax - xmin + 1; } - float Height() const { return ymax - ymin + 1; } - - float xmin, xmax, ymin, ymax; -}; - - -// TGA Header struct to make it simple to dump a TGA to disc. - -#if defined(_MSC_VER) || defined(__GNUC__) -#pragma pack(push, 1) -#pragma pack(1) // Dont pad the following struct. -#endif - -struct TGAHeader -{ - uint8 idLength, // Length of optional identification sequence. - paletteType, // Is a palette present? (1=yes) - imageType; // Image data type (0=none, 1=indexed, 2=rgb, - // 3=grey, +8=rle packed). - uint16 firstPaletteEntry, // First palette index, if present. - numPaletteEntries; // Number of palette entries, if present. - uint8 paletteBits; // Number of bits per palette entry. - uint16 x, // Horiz. pixel coord. of lower left of image. - y, // Vert. pixel coord. of lower left of image. - width, // Image width in pixels. - height; // Image height in pixels. - uint8 depth, // Image color depth (bits per pixel). - descriptor; // Image attribute flags. -}; - -#if defined(_MSC_VER) || defined(__GNUC__) -#pragma pack(pop) -#endif - - -bool -WriteTGA(const std::string &filename, - const Pixel32 *pxl, - uint16 width, - uint16 height) -{ - std::ofstream file(filename.c_str(), std::ios::binary); - if (file) - { - TGAHeader header; - memset(&header, 0, sizeof(TGAHeader)); - header.imageType = 2; - header.width = width; - header.height = height; - header.depth = 32; - header.descriptor = 0x20; - - file.write((const char *)&header, sizeof(TGAHeader)); - file.write((const char *)pxl, sizeof(Pixel32) * width * height); - - return true; - } - return false; -} - - -// A horizontal pixel span generated by the FreeType renderer. - -struct Span -{ - Span() { } - Span(int _x, int _y, int _width, int _coverage) - : x(_x), y(_y), width(_width), coverage(_coverage) { } - - int x, y, width, coverage; -}; - -typedef std::vector<Span> Spans; - - -// Each time the renderer calls us back we just push another span entry on -// our list. - -void -RasterCallback(const int y, - const int count, - const FT_Span * const spans, - void * const user) -{ - Spans *sptr = (Spans *)user; - for (int i = 0; i < count; ++i) - sptr->push_back(Span(spans[i].x, y, spans[i].len, spans[i].coverage)); -} - - -// Set up the raster parameters and render the outline. - -void -RenderSpans(FT_Library &library, - FT_Outline * const outline, - Spans *spans) -{ - FT_Raster_Params params; - memset(¶ms, 0, sizeof(params)); - params.flags = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT; - params.gray_spans = RasterCallback; - params.user = spans; - - FT_Outline_Render(library, outline, ¶ms); -} - - -// Render the specified character as a colored glyph with a colored outline -// and dump it to a TGA. - -void -WriteGlyphAsTGA(FT_Library &library, - const std::string &fileName, - wchar_t ch, - FT_Face &face, - int size, - const Pixel32 &fontCol, - const Pixel32 outlineCol, - float outlineWidth) -{ - // Set the size to use. - if (FT_Set_Char_Size(face, size << 6, size << 6, 90, 90) == 0) - { - // Load the glyph we are looking for. - FT_UInt gindex = FT_Get_Char_Index(face, ch); - if (FT_Load_Glyph(face, gindex, FT_LOAD_NO_BITMAP) == 0) - { - // Need an outline for this to work. - if (face->glyph->format == FT_GLYPH_FORMAT_OUTLINE) - { - // Render the basic glyph to a span list. - Spans spans; - RenderSpans(library, &face->glyph->outline, &spans); - - // Next we need the spans for the outline. - Spans outlineSpans; - - // Set up a stroker. - FT_Stroker stroker; - FT_Stroker_New(library, &stroker); - FT_Stroker_Set(stroker, - (int)(outlineWidth * 64), - FT_STROKER_LINECAP_ROUND, - FT_STROKER_LINEJOIN_ROUND, - 0); - - FT_Glyph glyph; - if (FT_Get_Glyph(face->glyph, &glyph) == 0) - { - FT_Glyph_StrokeBorder(&glyph, stroker, 0, 1); - // Again, this needs to be an outline to work. - if (glyph->format == FT_GLYPH_FORMAT_OUTLINE) - { - // Render the outline spans to the span list - FT_Outline *o = - &reinterpret_cast<FT_OutlineGlyph>(glyph)->outline; - RenderSpans(library, o, &outlineSpans); - } - - // Clean up afterwards. - FT_Stroker_Done(stroker); - FT_Done_Glyph(glyph); - - // Now we need to put it all together. - if (!spans.empty()) - { - // Figure out what the bounding rect is for both the span lists. - Rect rect(spans.front().x, - spans.front().y, - spans.front().x, - spans.front().y); - for (Spans::iterator s = spans.begin(); - s != spans.end(); ++s) - { - rect.Include(Vec2(s->x, s->y)); - rect.Include(Vec2(s->x + s->width - 1, s->y)); - } - for (Spans::iterator s = outlineSpans.begin(); - s != outlineSpans.end(); ++s) - { - rect.Include(Vec2(s->x, s->y)); - rect.Include(Vec2(s->x + s->width - 1, s->y)); - } - -#if 0 - // This is unused in this test but you would need this to draw - // more than one glyph. - float bearingX = face->glyph->metrics.horiBearingX >> 6; - float bearingY = face->glyph->metrics.horiBearingY >> 6; - float advance = face->glyph->advance.x >> 6; -#endif - - // Get some metrics of our image. - int imgWidth = rect.Width(), - imgHeight = rect.Height(), - imgSize = imgWidth * imgHeight; - - // Allocate data for our image and clear it out to transparent. - Pixel32 *pxl = new Pixel32[imgSize]; - memset(pxl, 0, sizeof(Pixel32) * imgSize); - - // Loop over the outline spans and just draw them into the - // image. - for (Spans::iterator s = outlineSpans.begin(); - s != outlineSpans.end(); ++s) - for (int w = 0; w < s->width; ++w) - pxl[(int)((imgHeight - 1 - (s->y - rect.ymin)) * imgWidth - + s->x - rect.xmin + w)] = - Pixel32(outlineCol.r, outlineCol.g, outlineCol.b, - s->coverage); - - // Then loop over the regular glyph spans and blend them into - // the image. - for (Spans::iterator s = spans.begin(); - s != spans.end(); ++s) - for (int w = 0; w < s->width; ++w) - { - Pixel32 &dst = - pxl[(int)((imgHeight - 1 - (s->y - rect.ymin)) * imgWidth - + s->x - rect.xmin + w)]; - Pixel32 src = Pixel32(fontCol.r, fontCol.g, fontCol.b, - s->coverage); - dst.r = (int)(dst.r + ((src.r - dst.r) * src.a) / 255.0f); - dst.g = (int)(dst.g + ((src.g - dst.g) * src.a) / 255.0f); - dst.b = (int)(dst.b + ((src.b - dst.b) * src.a) / 255.0f); - dst.a = MIN(255, dst.a + src.a); - } - - // Dump the image to disk. - WriteTGA(fileName, pxl, imgWidth, imgHeight); - - delete [] pxl; - } - } - } - } - } -} - - -int -main(int argc, - char **argv) -{ - if (argc != 3) - { - std::cerr << "Render letter `B' of given font as a TGA image.\n"; - std::cerr << "\n"; - std::cerr << "usage: example2 <font> <TGA-file>\n"; - return 1; - } - - // Initialize FreeType. - FT_Library library; - FT_Init_FreeType(&library); - - // Open up a font file. - std::ifstream fontFile(argv[1], std::ios::binary); - if (fontFile) - { - // Read the entire file to a memory buffer. - fontFile.seekg(0, std::ios::end); - std::fstream::pos_type fontFileSize = fontFile.tellg(); - fontFile.seekg(0); - unsigned char *fontBuffer = new unsigned char[fontFileSize]; - fontFile.read((char *)fontBuffer, fontFileSize); - - // Create a face from a memory buffer. Be sure not to delete the memory - // buffer until you are done using that font as FreeType will reference - // it directly. - FT_Face face; - FT_New_Memory_Face(library, fontBuffer, fontFileSize, 0, &face); - - // Dump out a single glyph to a tga. - WriteGlyphAsTGA(library, - argv[2], - L'B', - face, - 100, - Pixel32(255, 90, 30), - Pixel32(255, 255, 255), - 3.0f); - - // Now that we are done it is safe to delete the memory. - delete [] fontBuffer; - } - - // Clean up the library - FT_Done_FreeType(library); - - return 1; -} - -// Local Variables: -// coding: utf-8 -// End: diff --git a/lib/freetype/docs/tutorial/example3.cpp b/lib/freetype/docs/tutorial/example3.cpp deleted file mode 100644 index f903b3df7..000000000 --- a/lib/freetype/docs/tutorial/example3.cpp +++ /dev/null @@ -1,148 +0,0 @@ -// example3.cpp - -// This file demonstrates how to use FreeType's stand-alone B/W renderer. -// -// Copy the files ftraster.c, ftimage.h, and ftmisc.h into the same -// directory as this file, then say -// -// g++ -D STANDALONE_ \ -// -o example3 example3.cpp -// -// You need FreeType version 2.3.10 or newer. -// -// Written Sep. 2009 by Werner Lemberg, -// based on code contributed by Erik Möller. -// -// Public domain. - -#include "ftraster.c" -#include <fstream> - -// Define an acorn-like shape to test with. -struct Vec2 -{ - Vec2(float a, float b) : x(a), y(b) { } - - float x, y; -}; - -static Vec2 k_shape[] = -{ Vec2(-3, -18), Vec2(0, -12), Vec2(6, -10), Vec2(12, -6), Vec2(12, -4), - Vec2(11, -4), Vec2(10, -5), Vec2(10, 1), Vec2(9, 6), Vec2(7, 10), - Vec2(5, 12), Vec2(4, 15), Vec2(3, 14), Vec2(1, 13), Vec2(-1, 13), - Vec2(-5, 11), Vec2(-8, 8), Vec2(-11, 2), Vec2(-11, -2), Vec2(-14, 0), - Vec2(-14, -2), Vec2(-11, -7), Vec2(-9, -9), Vec2(-8, -9), Vec2(-5, -12), - Vec2(-5, -14), Vec2(-7, -15), Vec2(-8, -14), Vec2(-9, -15), Vec2(-9, -17), - Vec2(-7, -17), Vec2(-6, -18) -}; - -void* -MY_Alloc_Func(FT_Memory /* memory */, - long size) -{ - return malloc((size_t)size); -} - -void -MY_Free_Func(FT_Memory /* memory */, - void *block) -{ - free(block); -} - -void* -MY_Realloc_Func(FT_Memory /* memory */, - long /* cur_size */, - long new_size, - void* block) -{ - return realloc(block, (size_t)new_size); -} - - -static FT_Memory mem; - - -// Render a shape and dump it out as out-mono.pbm (b/w) and -// out-gray.pgm (grayscale). -int -main() -{ - // Set up the memory management. - mem = new FT_MemoryRec; - mem->alloc = MY_Alloc_Func; - mem->free = MY_Free_Func; - mem->realloc = MY_Realloc_Func; - - - // Build an outline manually. - FT_Outline_ outline; - outline.n_contours = 1; - outline.n_points = sizeof (k_shape) / sizeof (Vec2); - outline.points = new FT_Vector[outline.n_points]; - for (int i = 0; i < outline.n_points; ++i) - { - FT_Vector v; - // Offset it to fit in the image and scale it up 10 times. - v.x = (20 + k_shape[i].x) * 10 * 64; - v.y = (20 + k_shape[i].y) * 10 * 64; - outline.points[i] = v; - } - outline.tags = new char[outline.n_points]; - for (int i = 0; i < outline.n_points; ++i) - outline.tags[i] = 1; - outline.contours = new short[outline.n_contours]; - outline.contours[0] = outline.n_points - 1; - outline.flags = 0; - - - const int width = 500; - const int rows = 400; - - // 1 bit per pixel. - const int pitch_mono = (width + 7) >> 3; - - - FT_Bitmap bmp; - FT_Raster raster; - FT_Raster_Params params; - - - // Allocate a chunk of memory for the render pool. - const int kRenderPoolSize = 1024 * 1024; - unsigned char *renderPool = new unsigned char[kRenderPoolSize]; - - - // Set up a bitmap. - bmp.buffer = new unsigned char[rows * pitch_mono]; - memset(bmp.buffer, 0, rows * pitch_mono); - bmp.width = width; - bmp.rows = rows; - bmp.pitch = pitch_mono; - bmp.pixel_mode = FT_PIXEL_MODE_MONO; - - // Set up the necessary raster parameters. - memset(¶ms, 0, sizeof (params)); - params.source = &outline; - params.target = &bmp; - - // Initialize the rasterer and get it to render into the bitmap. - ft_standard_raster.raster_new(mem, &raster); - ft_standard_raster.raster_reset(raster, renderPool, kRenderPoolSize); - ft_standard_raster.raster_render(raster, ¶ms); - - // Dump out the raw image data (in PBM format). - std::ofstream out_mono("out-mono.pbm", std::ios::binary); - out_mono << "P4 " << width << " " << rows << "\n"; - out_mono.write((const char *)bmp.buffer, rows * pitch_mono); - - // Cleanup. - delete[] renderPool; - delete[] bmp.buffer; - delete[] outline.points; - delete[] outline.tags; - delete[] outline.contours; - delete mem; - - return 0; -} diff --git a/lib/freetype/docs/tutorial/example4.cpp b/lib/freetype/docs/tutorial/example4.cpp deleted file mode 100644 index 35cb5c158..000000000 --- a/lib/freetype/docs/tutorial/example4.cpp +++ /dev/null @@ -1,240 +0,0 @@ -// example4.cpp - -// This file holds the source code of a very simple application using the Qt -// framework to render a single glyph into a window. For demonstration -// purposes, both direct rendering using a callback and rendering using a -// buffer are implemented (yielding the same output). -// -// Due to a bug in the FreeType's direct rendering support you should use -// version 2.4.3 or newer to get correct results. -// -// Written Sept. 2010 by Róbert Márki <gsmiko@gmail.com>, -// with slight modifications by Werner Lemberg -// -// Public domain. -// -// -// To compile this application, check the `example4.pro' proto-makefile -// whether all paths are fine, then say `qmake example4.pro' followed by -// `make'. -// -// It has been tested with Qt versions 4.8.6 and 5.6.2. - -#include <QtGui/QApplication> -#include <QWidget> -#include <QPainter> -#include <QFile> -#include <QImage> -#include <iostream> - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_GLYPH_H -#include FT_TYPES_H -#include FT_OUTLINE_H -#include FT_RENDER_H - - -QString g_usageText = - "usage:\n" - "example4 FONT_PATH CHARACTER SIZE DIRECT_RENDERING_MODE(1|0)"; - - -#define TRUNC(x) ((x) >> 6) - - -class Widget : public QWidget -{ - Q_OBJECT - -public: - Widget(const QString& fileName, - QChar character, - int pointSize, - bool directRender, - QWidget *parent = 0) - : QWidget(parent), m_directRender(directRender) - { - FT_Error error = FT_Err_Ok; - m_face = 0; - m_library = 0; - - // For simplicity, the error handling is very rudimentary. - error = FT_Init_FreeType(&m_library); - if (!error) - { - error = FT_New_Face(m_library, - fileName.toLatin1().constData(), - 0, - &m_face); - if (!error) - { - error = FT_Set_Char_Size(m_face, - 0, - pointSize * 64, - physicalDpiX(), - physicalDpiY()); - - if (!error) - { - FT_UInt glyph_index = 0; - glyph_index = FT_Get_Char_Index(m_face, - character.unicode()); - - error = FT_Load_Glyph(m_face, - glyph_index, - FT_LOAD_DEFAULT); - - if (!error) - { - FT_Pos left = m_face->glyph->metrics.horiBearingX; - FT_Pos right = left + m_face->glyph->metrics.width; - FT_Pos top = m_face->glyph->metrics.horiBearingY; - FT_Pos bottom = top - m_face->glyph->metrics.height; - - m_glyphRect = QRect(QPoint(TRUNC(left), - -TRUNC(top) + 1), - QSize(TRUNC(right - left) + 1, - TRUNC(top - bottom) + 1)); - setFixedSize(m_glyphRect.width(), - m_glyphRect.height()); - } - } - } - } - } - - ~Widget() - { - FT_Done_Face(m_face); - FT_Done_FreeType(m_library); - } - -private: - FT_Library m_library; - FT_Face m_face; - QRect m_glyphRect; - bool m_directRender; - - // The callback function for direct rendering. - static void graySpans(int y, - int count, - const FT_Span_ *spans, - void *user) - { - QPainter *painter = (QPainter *)user; - y = -y; - - for (int i = 0; i < count; i++) - { - const FT_Span span = spans[i]; - qreal opacity = qreal(span.coverage) / 255.0; - - painter->setOpacity(opacity); - - if (span.len > 1) - painter->drawLine(span.x, y, span.x + span.len - 1, y); - else - painter->drawPoint(span.x, y); - } - } - -protected: - void paintEvent(QPaintEvent *event) - { - QWidget::paintEvent(event); - - if (m_library && m_face) - { - FT_Error error = FT_Err_Ok; - QPainter painter(this); - - painter.translate(-m_glyphRect.x(), - -m_glyphRect.y()); - - if (m_directRender) - { - // Direct rendering. - - painter.setPen(Qt::black); - - FT_Raster_Params params; - - params.target = 0; - params.flags = FT_RASTER_FLAG_DIRECT | FT_RASTER_FLAG_AA; - params.user = &painter; - params.gray_spans = &Widget::graySpans; - params.black_spans = 0; - params.bit_set = 0; - params.bit_test = 0; - - FT_Outline* outline = &m_face->glyph->outline; - - FT_Outline_Render(m_library, - outline, - ¶ms); - } - else - { - // Rendering using a buffer. - - error = FT_Render_Glyph(m_face->glyph, - FT_RENDER_MODE_NORMAL); - - QImage glyphImage(m_face->glyph->bitmap.buffer, - m_face->glyph->bitmap.width, - m_face->glyph->bitmap.rows, - m_face->glyph->bitmap.pitch, - QImage::Format_Indexed8); - - painter.translate(m_glyphRect.x(), - m_glyphRect.y()); - - QVector<QRgb> colorTable; - for (int i = 0; i < 256; ++i) - colorTable << qRgba(0, 0, 0, i); - glyphImage.setColorTable(colorTable); - - painter.drawImage(QPoint(0, 0), - glyphImage); - } - } - } -}; - - -int main(int argc, - char **argv) -{ - bool status = false; - - if (argc == 5) - { - bool isSizeOk = false; - QString path = argv[1]; - QChar character = *argv[2]; - int size = QString(argv[3]).toInt(&isSizeOk); - bool directRender = QString(argv[4]).toInt(); - - if (QFile::exists(path) && isSizeOk) - { - status = true; - QApplication a(argc, argv); - Widget w(path, character, size, directRender); - w.show(); - return a.exec(); - } - } - - if (!status) - { - std::cout << qPrintable(g_usageText) << std::endl; - return 0; - } -} - -#include "example4.moc" - -// Local Variables: -// coding: utf-8 -// End: diff --git a/lib/freetype/docs/tutorial/example4.pro b/lib/freetype/docs/tutorial/example4.pro deleted file mode 100644 index 5e4baa055..000000000 --- a/lib/freetype/docs/tutorial/example4.pro +++ /dev/null @@ -1,13 +0,0 @@ -# example4.pro - -QT += core gui widgets -TARGET = example4 -TEMPLATE = app -SOURCES += example4.cpp -MOC_DIR = ./moc -LIBS += -lz -lfreetype -INCLUDEPATH += $$MOC_DIR \ - /usr/local/include \ - /usr/local/include/freetype2 - -# EOF diff --git a/lib/freetype/docs/tutorial/example5.cpp b/lib/freetype/docs/tutorial/example5.cpp deleted file mode 100644 index 3251ba71a..000000000 --- a/lib/freetype/docs/tutorial/example5.cpp +++ /dev/null @@ -1,498 +0,0 @@ -// example5.cpp - -// This program is a simple example that prints a character's outline in the -// SVG format to stdout, demonstrating the usage of FT_Outline_Decompose(). -// -// Developed by Static Jobs LLC and contributed to the FreeType project. -// -// Copyright (c) 2016-2018 Static Jobs LLC -// IT and software engineering jobs in the US, Canada and the UK -// https://www.staticjobs.com -// -// License: MIT (see below) -// -// The source code was reformatted by Werner Lemberg, also including a few -// minor code changes and comments for didactic purposes. -// -// On a Unix box like GNU/Linux or OS X, compile with -// -// g++ -o example5 example5.cpp `pkg-config freetype2 --cflags --libs` -// -// or -// -// g++ -o example5 example5.cpp `freetype-config --cflags --libs` -// -// on the command line. -// -// On other platforms that don't have the `freetype-config' shell script or -// the `pkg-config' tool, you have to pass the necessary compiler flags -// manually. - - -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT -// OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -// THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -#include <iostream> -#include <sstream> -#include <stdexcept> -#include <cstring> -#include <cctype> - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_OUTLINE_H -#include FT_BBOX_H - - -using namespace std; - - -// A minimal wrapper for RAII (`resource acquisition is initialization'). -class FreeTypeLibrary -{ -public: - FreeTypeLibrary(); - ~FreeTypeLibrary(); - - operator FT_Library() const; - -private: - FreeTypeLibrary(const FreeTypeLibrary &); - FreeTypeLibrary &operator =(const FreeTypeLibrary &); - -private: - FT_Library m_ftLibrary; -}; - - -inline -FreeTypeLibrary::FreeTypeLibrary() -{ - FT_Error error = FT_Init_FreeType(&m_ftLibrary); - - if (error) - throw runtime_error("Couldn't initialize the library:" - " FT_Init_FreeType() failed"); -} - - -inline -FreeTypeLibrary::~FreeTypeLibrary() -{ - FT_Done_FreeType(m_ftLibrary); -} - - -inline -FreeTypeLibrary::operator FT_Library() const -{ - return m_ftLibrary; -} - - -// Another minimal wrapper for RAII. -class FreeTypeFace -{ -public: - FreeTypeFace(const FreeTypeLibrary &library, - const char *filename); - ~FreeTypeFace(); - - operator FT_Face() const; - -private: - FreeTypeFace(const FreeTypeFace &); - FreeTypeFace &operator =(const FreeTypeFace &); - -private: - FT_Face m_ftFace; -}; - - -inline -FreeTypeFace::FreeTypeFace(const FreeTypeLibrary &library, - const char *filename) -{ - // For simplicity, always use the first face index. - FT_Error error = FT_New_Face(library, filename, 0, &m_ftFace); - - if (error) - throw runtime_error("Couldn't load the font file:" - " FT_New_Face() failed"); -} - - -inline -FreeTypeFace::~FreeTypeFace() -{ - FT_Done_Face(m_ftFace); -} - - -inline -FreeTypeFace::operator FT_Face() const -{ - return m_ftFace; -} - - -class OutlinePrinter -{ -public: - OutlinePrinter(const char *filename); - int Run(const char *symbol); - -private: - OutlinePrinter(const OutlinePrinter &); - OutlinePrinter &operator =(const OutlinePrinter &); - -private: - void LoadGlyph(const char *symbol) const; - bool OutlineExists() const; - void FlipOutline() const; - void ExtractOutline(); - void ComputeViewBox(); - void PrintSVG() const; - - static int MoveToFunction(const FT_Vector *to, - void *user); - static int LineToFunction(const FT_Vector *to, - void *user); - static int ConicToFunction(const FT_Vector *control, - const FT_Vector *to, - void *user); - static int CubicToFunction(const FT_Vector *controlOne, - const FT_Vector *controlTwo, - const FT_Vector *to, - void *user); - -private: - // These two lines initialize the library and the face; - // the order is important! - FreeTypeLibrary m_library; - FreeTypeFace m_face; - - ostringstream m_path; - - // These four variables are for the `viewBox' attribute. - FT_Pos m_xMin; - FT_Pos m_yMin; - FT_Pos m_width; - FT_Pos m_height; -}; - - -inline -OutlinePrinter::OutlinePrinter(const char *filename) -: m_face(m_library, filename), - m_xMin(0), - m_yMin(0), - m_width(0), - m_height(0) -{ - // Empty body. -} - - -int -OutlinePrinter::Run(const char *symbol) -{ - LoadGlyph(symbol); - - // Check whether outline exists. - bool outlineExists = OutlineExists(); - - if (!outlineExists) // Outline doesn't exist. - throw runtime_error("Outline check failed.\n" - "Please, inspect your font file or try another one," - " for example LiberationSerif-Bold.ttf"); - - FlipOutline(); - - ExtractOutline(); - - ComputeViewBox(); - - PrintSVG(); - - return 0; -} - - -void -OutlinePrinter::LoadGlyph(const char *symbol) const -{ - FT_ULong code = symbol[0]; - - // For simplicity, use the charmap FreeType provides by default; - // in most cases this means Unicode. - FT_UInt index = FT_Get_Char_Index(m_face, code); - - FT_Error error = FT_Load_Glyph(m_face, - index, - FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP); - - if (error) - throw runtime_error("Couldn't load the glyph: FT_Load_Glyph() failed"); -} - - -// While working on this example, we found fonts with no outlines for -// printable characters such as `A', i.e., `outline.n_contours' and -// `outline.n_points' were zero. FT_Outline_Check() returned `true'. -// FT_Outline_Decompose() also returned `true' without walking the outline. -// That is, we had no way of knowing whether the outline existed and could -// be (or was) decomposed. Therefore, we implemented this workaround to -// check whether the outline does exist and can be decomposed. -bool -OutlinePrinter::OutlineExists() const -{ - FT_Face face = m_face; - FT_GlyphSlot slot = face->glyph; - FT_Outline &outline = slot->outline; - - if (slot->format != FT_GLYPH_FORMAT_OUTLINE) - return false; // Should never happen. Just an extra check. - - if (outline.n_contours <= 0 || outline.n_points <= 0) - return false; // Can happen for some font files. - - FT_Error error = FT_Outline_Check(&outline); - - return error == 0; -} - - -// This function flips outline around x-axis. We need it because -// FreeType and SVG use opposite vertical directions. -void -OutlinePrinter::FlipOutline() const -{ - const FT_Fixed multiplier = 65536L; - - FT_Matrix matrix; - - matrix.xx = 1L * multiplier; - matrix.xy = 0L * multiplier; - matrix.yx = 0L * multiplier; - matrix.yy = -1L * multiplier; - - FT_Face face = m_face; - FT_GlyphSlot slot = face->glyph; - FT_Outline &outline = slot->outline; - - FT_Outline_Transform(&outline, &matrix); -} - - -void -OutlinePrinter::ExtractOutline() -{ - m_path << " <path d='\n"; - - FT_Outline_Funcs callbacks; - - callbacks.move_to = MoveToFunction; - callbacks.line_to = LineToFunction; - callbacks.conic_to = ConicToFunction; - callbacks.cubic_to = CubicToFunction; - - callbacks.shift = 0; - callbacks.delta = 0; - - FT_Face face = m_face; - FT_GlyphSlot slot = face->glyph; - FT_Outline &outline = slot->outline; - - FT_Error error = FT_Outline_Decompose(&outline, &callbacks, this); - - if (error) - throw runtime_error("Couldn't extract the outline:" - " FT_Outline_Decompose() failed"); - - m_path << " '\n" - " fill='red'/>\n"; -} - - -void -OutlinePrinter::ComputeViewBox() -{ - FT_Face face = m_face; - FT_GlyphSlot slot = face->glyph; - FT_Outline &outline = slot->outline; - - FT_BBox boundingBox; - - FT_Outline_Get_BBox(&outline, &boundingBox); - - FT_Pos xMin = boundingBox.xMin; - FT_Pos yMin = boundingBox.yMin; - FT_Pos xMax = boundingBox.xMax; - FT_Pos yMax = boundingBox.yMax; - - m_xMin = xMin; - m_yMin = yMin; - m_width = xMax - xMin; - m_height = yMax - yMin; -} - - -void -OutlinePrinter::PrintSVG() const -{ - cout << "<svg xmlns='http://www.w3.org/2000/svg'\n" - " xmlns:xlink='http://www.w3.org/1999/xlink'\n" - " viewBox='" - << m_xMin << ' ' << m_yMin << ' ' << m_width << ' ' << m_height - << "'>\n" - << m_path.str() - << "</svg>" - << endl; -} - - -int -OutlinePrinter::MoveToFunction(const FT_Vector *to, - void *user) -{ - OutlinePrinter *self = static_cast<OutlinePrinter *>(user); - - FT_Pos x = to->x; - FT_Pos y = to->y; - - self->m_path << " " - "M " << x << ' ' << y << '\n'; - - return 0; -} - - -int -OutlinePrinter::LineToFunction(const FT_Vector *to, - void *user) -{ - OutlinePrinter *self = static_cast<OutlinePrinter *>(user); - - FT_Pos x = to->x; - FT_Pos y = to->y; - - self->m_path << " " - "L " << x << ' ' << y << '\n'; - - return 0; -} - - -int -OutlinePrinter::ConicToFunction(const FT_Vector *control, - const FT_Vector *to, - void *user) -{ - OutlinePrinter *self = static_cast<OutlinePrinter *>(user); - - FT_Pos controlX = control->x; - FT_Pos controlY = control->y; - - FT_Pos x = to->x; - FT_Pos y = to->y; - - self->m_path << " " - "Q " << controlX << ' ' << controlY << ", " - << x << ' ' << y << '\n'; - - return 0; -} - - -int -OutlinePrinter::CubicToFunction(const FT_Vector *controlOne, - const FT_Vector *controlTwo, - const FT_Vector *to, - void *user) -{ - OutlinePrinter *self = static_cast<OutlinePrinter *>(user); - - FT_Pos controlOneX = controlOne->x; - FT_Pos controlOneY = controlOne->y; - - FT_Pos controlTwoX = controlTwo->x; - FT_Pos controlTwoY = controlTwo->y; - - FT_Pos x = to->x; - FT_Pos y = to->y; - - self->m_path << " " - "C " << controlOneX << ' ' << controlOneY << ", " - << controlTwoX << ' ' << controlTwoY << ", " - << x << ' ' << y << '\n'; - - return 0; -} - - -int -main(int argc, - char **argv) -{ - if (argc != 3) - { - const char *program = argv[0]; - - cerr << "This program prints a single character's outline" - " in the SVG format to stdout.\n" - "Usage: " << program << " font symbol\n" - "Example: " << program << " LiberationSerif-Bold.ttf A" << endl; - - return 1; - } - - const char *symbol = argv[2]; - - // For simplicity, only accept single-byte characters like `A'. - if (strlen(symbol) != 1 || isspace(*symbol)) - { - cerr << "Error: '" << symbol - << "' is not a single printable character" << endl; - - return 2; - } - - int status; - - try - { - const char *filename = argv[1]; - - OutlinePrinter printer(filename); - - status = printer.Run(symbol); - } - catch (const exception &e) - { - cerr << "Error: " << e.what() << endl; - - status = 3; - } - - return status; -} - -// EOF diff --git a/lib/freetype/docs/tutorial/example5.svg b/lib/freetype/docs/tutorial/example5.svg deleted file mode 100644 index 0034bf911..000000000 --- a/lib/freetype/docs/tutorial/example5.svg +++ /dev/null @@ -1,60 +0,0 @@ -<svg xmlns='http://www.w3.org/2000/svg' - xmlns:xlink='http://www.w3.org/1999/xlink' - viewBox='107 -1364 1691 1753'> - <path d=' - M 1798 -752 - Q 1798 -564, 1701 -396 - Q 1604 -229, 1437 -127 - Q 1270 -25, 1085 -25 - Q 961 -25, 957 -150 - L 905 -107 - Q 805 -25, 686 -25 - Q 600 -25, 550 -95 - Q 500 -165, 500 -283 - Q 500 -412, 551 -534 - Q 602 -657, 692 -745 - Q 783 -834, 895 -879 - Q 1007 -924, 1184 -924 - Q 1271 -924, 1367 -913 - L 1246 -372 - Q 1237 -335, 1230 -285 - Q 1223 -235, 1223 -215 - Q 1223 -192, 1231 -175 - Q 1240 -159, 1273 -159 - Q 1367 -159, 1445 -239 - Q 1523 -319, 1568 -459 - Q 1614 -599, 1614 -751 - Q 1614 -994, 1471 -1128 - Q 1329 -1263, 1079 -1263 - Q 853 -1263, 674 -1150 - Q 496 -1038, 393 -829 - Q 291 -621, 291 -363 - Q 291 -174, 364 -26 - Q 437 121, 573 202 - Q 710 284, 895 284 - Q 1042 284, 1171 244 - Q 1300 204, 1436 109 - L 1480 173 - Q 1338 287, 1189 338 - Q 1040 389, 864 389 - Q 636 389, 464 295 - Q 292 201, 199 29 - Q 107 -142, 107 -362 - Q 107 -648, 236 -879 - Q 365 -1110, 588 -1237 - Q 811 -1364, 1083 -1364 - Q 1424 -1364, 1611 -1203 - Q 1798 -1043, 1798 -752 - M 740 -316 - Q 740 -244, 761 -206 - Q 783 -169, 811 -169 - Q 845 -169, 889 -189 - Q 934 -209, 965 -237 - L 1085 -798 - Q 1068 -803, 1024 -803 - Q 922 -803, 868 -750 - Q 814 -698, 777 -571 - Q 740 -444, 740 -316 - ' - fill='red'/> -</svg> diff --git a/lib/freetype/docs/tutorial/index.html b/lib/freetype/docs/tutorial/index.html deleted file mode 100644 index 5c4721580..000000000 --- a/lib/freetype/docs/tutorial/index.html +++ /dev/null @@ -1,218 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Tutorial</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> Tutorial</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="introduction"> - <p>This tutorial presents a step-by-step introduction into - the FreeType library, covering the most basic needs.</p> - </div> - - <!-- ************************************************** --> - - <div id="contents"> - <h3><a href="step1.html">I. Simple Glyph Loading</a></h3> - <ul> - <li> - <a href="step1.html#section-1">1. Header Files</a> - </li> - <li> - <a href="step1.html#section-2">2. Library - Initialization</a> - </li> - <li> - <a href="step1.html#section-3">3. Loading a Font - Face</a> - </li> - <li> - <a href="step1.html#section-4">4. Accessing the Face - Data</a> - </li> - <li> - <a href="step1.html#section-5">5. Setting the Current - Pixel Size</a> - </li> - <li> - <a href="step1.html#section-6">6. Loading a Glyph - Image</a> - </li> - <li> - <a href="step1.html#section-7">7. Simple Text - Rendering</a> - </li> - </ul> - - <h3><a href="step2.html">II. Managing Glyphs</a></h3> - <ul> - <li> - <a href="step2.html#section-1">1. Glyph Metrics</a> - </li> - <li> - <a href="step2.html#section-2">2. Managing Glyph - Images</a> - </li> - <li> - <a href="step2.html#section-3">3. Global Glyph - Metrics</a> - </li> - <li> - <a href="step2.html#section-4">4. Simple Text Rendering: - Kerning and Centering</a> - </li> - <li> - <a href="step2.html#section-5">5. Advanced Text - Rendering: Transformation and Centering and - Kerning</a> - </li> - <li> - <a href="step2.html#section-6">6. Accessing Metrics in - Design Font Units, and Scaling Them</a> - </li> - <li> - <a href="step2.html#conclusion">Conclusion</a> - </li> - </ul> - - <h3><a href="step3.html">III. Examples</a></h3> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html" class="current">FreeType Tutorial</a> - </li> - <li class="tertiary"> - <a href="step1.html">Simple Glyph Loading</a> - </li> - <li class="tertiary"> - <a href="step2.html">Managing Glyphs</a> - </li> - <li class="tertiary"> - <a href="step3.html">Examples</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/tutorial/metrics.png b/lib/freetype/docs/tutorial/metrics.png Binary files differdeleted file mode 100644 index 1e7be4748..000000000 --- a/lib/freetype/docs/tutorial/metrics.png +++ /dev/null diff --git a/lib/freetype/docs/tutorial/metrics2.png b/lib/freetype/docs/tutorial/metrics2.png Binary files differdeleted file mode 100644 index 0bda5dc25..000000000 --- a/lib/freetype/docs/tutorial/metrics2.png +++ /dev/null diff --git a/lib/freetype/docs/tutorial/step1.html b/lib/freetype/docs/tutorial/step1.html deleted file mode 100644 index fddd9ef1d..000000000 --- a/lib/freetype/docs/tutorial/step1.html +++ /dev/null @@ -1,1094 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Tutorial / I</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> - Tutorial / I</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="simple-glyph-loading"> - <h2>I. Simple Glyph Loading</h2> - - <h3 id="section-1">1. Header Files</h3> - - <p>The following are instructions required to compile an - application that uses the FreeType 2 library.</p> - - <ol> - <li class="emph"> - <p>Locate the FreeType 2 <code>include</code> - directory.</p> - - <p>You have to add it to your compilation include - path.</p> - - <p>In Unix-like environments you can use the - <code>pkg-config</code> program to retrieve the - appropriate compilation flags; say.</p> - - <pre> -pkg-config --cflags freetype2</pre> - - <p>to get the compilation flags.</p> - - <p>This program can also be used to check the version of - the library that is installed on your system, as well - as the required librarian and linker flags.</p> - - <p>Another solution is the <code>freetype-config</code> - script. However, its use is deprecated since it can't - be used reliably for cross compilation.</p> - - </li> - - <li class="emph"> - <p>Include the file named <code>ft2build.h</code>.</p> - - <p>It contains various macro declarations that are later - used to <code>#include</code> the appropriate public - FreeType 2 header files.</p> - </li> - - <li class="emph"> - <p>Include the main FreeType 2 API header file.</p> - - <p>You should do that using the - macro <code>FT_FREETYPE_H</code>, like in the - following example.</p> - - <pre> -#include <ft2build.h> -#include FT_FREETYPE_H</pre> - - <p><code>FT_FREETYPE_H</code> is a special macro defined - in file <code>ftheader.h</code>. It contains some - installation-specific macros to name other public - header files of the FreeType 2 API.</p> - - <p>You can - read <a href="../reference/ft2-header_file_macros.html">this - section of the FreeType 2 API Reference</a> for a - complete listing of the header macros.</p> - </li> - </ol> - - <p>The use of macros in <code>#include</code> statements is - ANSI-compliant. It is used for several reasons.</p> - - <ul> - <li>It avoids conflicts with (deprecated) FreeType 1.x - public header files.</li> - - <li>The macro names are not limited to the DOS 8.3 file - naming limit; names - like <code>FT_MULTIPLE_MASTERS_H</code> - or <code>FT_SFNT_NAMES_H</code> are a lot more readable - and explanatory than the real file names - <code>ftmm.h</code> and <code>ftsnames.h</code>.</li> - - <li>It allows special installation tricks that will not be - discussed here.</li> - </ul> - - - <h3 id="section-2">2. Library Initialization</h3> - - <p>To initialize the FreeType library, create a variable of - type <a href="../reference/ft2-base_interface.html#ft_library"><code>FT_Library</code></a> - named, for example, <code>library</code>, and call the - function <a href="../reference/ft2-base_interface.html#ft_init_freetype"><code>FT_Init_FreeType</code></a>.</p> - - <pre> -#include <ft2build.h> -#include FT_FREETYPE_H - -FT_Library library; - - -... - -error = FT_Init_FreeType( &library ); -if ( error ) -{ - ... an error occurred during library initialization ... -}</pre> - - <p>This function is in charge of</p> - - <ul> - <li>creating a new instance of the FreeType 2 library - and setting the handle <code>library</code> to it, - and</li> - - <li>loading each module that FreeType knows about in the - library. Among others, your new <code>library</code> - object is able to handle TrueType, Type 1, - CID-keyed & OpenType/CFF fonts gracefully.</li> - </ul> - - <p>As you can see, the function returns an error code, like - most other functions of the FreeType API. An error code - of 0 (also known - as <code>FT_Err_Ok</code>) <em>always</em> means that the - operation was successful; otherwise, the value describes - the error, and <code>library</code> is set to NULL.</p> - - <p>A list of all FreeType error codes can be found in - file <code>fterrdef.h</code>.</p> - - - <h3 id="section-3">3. Loading a Font Face</h3> - - <h4>a. From a Font File</h4> - - <p>Create a new <code>face</code> object by - calling <a href="../reference/ft2-base_interface.html#ft_new_face"><code>FT_New_Face</code></a>. - A <em>face</em> describes a given typeface and style. For - example, ‘Times New Roman Regular’ and - ‘Times New Roman Italic’ correspond to two - different faces.</p> - - <pre> -FT_Library library; <span class="comment">/* handle to library */</span> -FT_Face face; <span class="comment">/* handle to face object */</span> - - -error = FT_Init_FreeType( &library ); -if ( error ) { ... } - -error = FT_New_Face( library, - "/usr/share/fonts/truetype/arial.ttf", - 0, - &face ); -if ( error == FT_Err_Unknown_File_Format ) -{ - ... the font file could be opened and read, but it appears - ... that its font format is unsupported -} -else if ( error ) -{ - ... another error code means that the font file could not - ... be opened or read, or that it is broken... -}</pre> - - <p>As you can certainly imagine, <code>FT_New_Face</code> - opens a font file, then tries to extract one face from it. - Its parameters are as follows.</p> - - <dl> - <dt>library</dt> - <dd>A handle to the FreeType library instance where the - face object is created.</dd> - - <dt>filepathname</dt> - <dd>The font file pathname (a standard C string).</dd> - - <dt>face_index</dt> - <dd> - <p>Certain font formats allow several font faces to be - embedded in a single file.</p> - - <p>This index tells which face you want to load. An - error is returned if its value is too large.</p> - - <p>Index 0 always works, though.</p> - </dd> - - <dt>face</dt> - <dd> - <p>A <em>pointer</em> to the handle that is set to - describe the new face object.</p> - - <p>It is set to NULL in case of error.</p> - </dd> - </dl> - - <p>To know how many faces a given font file contains, set - <code>face_index</code> to <code>-1</code>, then - check the value of <code>face->num_faces</code>, which - indicates how many faces are embedded in the font - file.</p> - - <h4>b. From Memory</h4> - - <p>In the case where you have already loaded the font file - into memory, you can similarly create a new face object - for it by - calling <a href="../reference/ft2-base_interface.html#ft_new_memory_face"><code>FT_New_Memory_Face</code></a>.</p> - - <pre> -FT_Library library; <span class="comment">/* handle to library */</span> -FT_Face face; <span class="comment">/* handle to face object */</span> - - -error = FT_Init_FreeType( &library ); -if ( error ) { ... } - -error = FT_New_Memory_Face( library, - buffer, <span class="comment">/* first byte in memory */</span> - size, <span class="comment">/* size in bytes */</span> - 0, <span class="comment">/* face_index */</span> - &face ); -if ( error ) { ... }</pre> - - <p>As you can see, <code>FT_New_Memory_Face</code> takes a - pointer to the font file buffer and its size in bytes - instead of a file pathname. Other than that, it has - exactly the same semantics as - <code>FT_New_Face</code>.</p> - - <p>Note that you must not deallocate the font file buffer - before calling - <a href="../reference/ft2-base_interface.html#ft_done_face"><code>FT_Done_Face</code></a>.</p> - - <h4>c. From Other Sources (Compressed Files, Network, - etc.)</h4> - - <p>There are cases where using a file pathname or preloading - the file into memory is not sufficient. With - FreeType 2, it is possible to provide your own - implementation of I/O routines.</p> - - <p>This is done through - the <a href="../reference/ft2-base_interface.html#ft_open_face"><code>FT_Open_Face</code></a> - function, which can be used to open a new font face with a - custom input stream, select a specific driver for opening, - or even pass extra parameters to the font driver when - creating the object. We advise you to look up - the <a href="../reference/index.html">FreeType 2 - reference manual</a> in order to learn how to use it.</p> - - - <h3 id="section-4">4. Accessing the Face Data</h3> - - <p>A <em>face object</em> models all information that - globally describes the face. Usually, this data can be - accessed directly by dereferencing a handle, like - in <code>face−>num_glyphs</code>.</p> - - <p>The complete list of available fields is in - the <a href="../reference/ft2-base_interface.html#ft_facerec"><code>FT_FaceRec</code></a> - structure description. However, we describe here a few of - them in more detail.</p> - - <dl> - <dt>num_glyphs</dt> - <dd>This variable gives the number of <em>glyphs</em> - available in the font face. A glyph is a character - image, nothing more – it thus doesn't necessarily - correspond to a <em>character code</em>.</dd> - - <dt>face_flags</dt> - <dd>A 32-bit integer containing bit flags that describe - some face properties. For example, the flag - <code>FT_FACE_FLAG_SCALABLE</code> indicates that the - face's font format is scalable and that glyph images can - be rendered for all character pixel sizes. For more - information on face flags, please read - the <a href="../reference/ft2-base_interface.html#ft_face_flag_xxx">FreeType 2 - API Reference</a>.</dd> - - <dt>units_per_EM</dt> - <dd>This field is only valid for scalable formats (it is - set to 0 otherwise). It indicates the number of - font units covered by the EM.</dd> - - <dt>num_fixed_sizes</dt> - <dd>This field gives the number of embedded bitmap strikes - in the current face. A <em>strike</em> is a series of - glyph images for a given character pixel size. For - example, a font face could include strikes for pixel - sizes 10, 12, and 14. Note that even scalable font - formats can have embedded bitmap strikes!</dd> - - <dt>available_sizes</dt> - <dd> - <p>A pointer to an array - of <a href="../reference/ft2-base_interface.html#ft_bitmap_size"><code>FT_Bitmap_Size</code></a> - elements. Each <code>FT_Bitmap_Size</code> indicates - the horizontal and vertical <em>character pixel - sizes</em> for each of the strikes that are present in - the face.</p> - - <p class="warning">Note that, generally speaking, these - are <em>not</em> the <em>cell size</em> of the bitmap - strikes.</p> - </dd> - </dl> - - - <h3 id="section-5">5. Setting the Current Pixel Size</h3> - - <p>FreeType 2 uses <em>size objects</em> to model all - information related to a given character size for a given - face. For example, a size object holds the value of - certain metrics like the ascender or text height, - expressed in 1/64th of a pixel, for a character size of - 12 points (however, those values are rounded to - integers, i.e., multiples of 64).</p> - - <p>When the <code>FT_New_Face</code> function is called (or - one of its siblings), it <em>automatically</em> creates a - new size object for the returned face. This size object - is directly accessible as - <code>face−>size</code>.</p> - - <p class="note">NOTE: A single face object can deal with one - or more size objects at a time; however, this is something - that few programmers really need to do. We have thus - decided to make this feature available through additional - functions.</p> - - <p>When a new face object is created, all elements are set - to 0 during initialization. To populate the - structure with sensible values, you should - call <a href="../reference/ft2-base_interface.html#ft_set_char_size"><code>FT_Set_Char_Size</code></a>. - Here is an example, setting the character size to 16pt for - a 300×300dpi device:</p> - - <pre> -error = FT_Set_Char_Size( - face, <span class="comment">/* handle to face object */</span> - 0, <span class="comment">/* char_width in 1/64th of points */</span> - 16*64, <span class="comment">/* char_height in 1/64th of points */</span> - 300, <span class="comment">/* horizontal device resolution */</span> - 300 ); <span class="comment">/* vertical device resolution */</span></pre> - - <p>Some notes.</p> - - <ul> - <li>The character widths and heights are specified in - 1/64th of points. A point is a <em>physical</em> - distance, equaling 1/72th of an inch. Normally, it is - not equivalent to a pixel.</li> - - <li>Value of 0 for the character width means - ‘same as character height’, value of 0 - for the character height means ‘same as character - width’. Otherwise, it is possible to specify - different character widths and heights.</li> - - <li>The horizontal and vertical device resolutions are - expressed in <em>dots-per-inch</em>, or <em>dpi</em>. - Standard values are 72 or 96 dpi for display - devices like the screen. The resolution is used to - compute the character pixel size from the character - point size.</li> - - <li>Value of 0 for the horizontal resolution means - ‘same as vertical resolution’, value - of 0 for the vertical resolution means ‘same - as horizontal resolution’. If both values are - zero, 72 dpi is used for both dimensions.</li> - - <li>The first argument is a handle to a face object, not a - size object.</li> - </ul> - - <p>This function computes the (possibly fractional) - character pixel size that corresponds to the character - width and height and device resolutions. A common acronym - for the pixel size is <em>ppem</em> (pixel per em).</p> - - <p>If you want to specify the (integer) pixel sizes - yourself, you can call - <a href="../reference/ft2-base_interface.html#ft_set_pixel_sizes"><code>FT_Set_Pixel_Sizes</code></a>.</p> - - <pre> -error = FT_Set_Pixel_Sizes( - face, <span class="comment">/* handle to face object */</span> - 0, <span class="comment">/* pixel_width */</span> - 16 ); <span class="comment">/* pixel_height */</span></pre> - - <p>This example sets the character pixel sizes to - 16×16 pixels. As previously, a value of 0 - for one of the dimensions means ‘same as the - other’.</p> - - <p>Note that both functions return an error code. Usually, - an error occurs with a fixed-size font format (like FNT or - PCF) when trying to set the pixel size to a value that is - not listed in the <code>face->fixed_sizes</code> - array.</p> - - <p>Be aware that fractional ppem values are not always - supported. For example, the native bytecode engine for - hinting TrueType fonts (TTFs) only supports integer ppem - values, and FreeType rounds fractional ppem values - accordingly.</p> - - - <h3 id="section-6">6. Loading a Glyph Image</h3> - - <h4>a. Converting a Character Code Into a Glyph Index</h4> - - <p>Normally, an application wants to load a glyph image - based on its <em>character code</em>, which is a unique - value that defines the character for a - given <em>encoding</em>. For example, code 65 (0x41) - represents character ‘A’ in ASCII - encoding.</p> - - <p>A face object contains one or more tables, called - <em>charmaps</em>, to convert character codes to glyph - indices. For example, most older TrueType fonts contain - two charmaps: One is used to convert Unicode character - codes to glyph indices, the other one is used to convert - Apple Roman encoding to glyph indices. Such fonts can - then be used either on Windows (which uses Unicode) and - old MacOS versions (which use Apple Roman). Note also - that a given charmap might not map to all the glyphs - present in the font.</p> - - <p>By default, when a new face object is created, FreeType - tries to select a Unicode charmap. It emulates a Unicode - charmap if the font doesn't contain such a charmap, based - on glyph names. Note that it is possible that the - emulation misses glyphs if glyph names are non-standard. - For some fonts like symbol fonts, no Unicode emulation is - possible at all.</p> - - <p>Later on we will describe how to look for specific - charmaps in a face. For now, we assume that the face - contains at least a Unicode charmap that was selected - during a call to <code>FT_New_Face</code>. To convert a - Unicode character code to a font glyph index, we use - <a href="../reference/ft2-base_interface.html#ft_get_char_index"><code>FT_Get_Char_Index</code></a>.</p> - - <pre> -glyph_index = FT_Get_Char_Index( face, charcode );</pre> - - <p>This code line looks up the glyph index corresponding to - the given <code>charcode</code> in the charmap that is - currently selected for the face. You should use the - UTF-32 representation form of Unicode; for example, if you - want to load character U+1F028, use value 0x1F028 as the - value for <code>charcode</code>. - - <p>If no charmap was selected, the function returns - the charcode.</p> - - <p>Note that this is one of the rare FreeType functions that - do not return an error code. However, when a given - character code has no glyph image in the face, - value 0 is returned. By convention, it always - corresponds to a special glyph image called - the <em>missing glyph</em>, which is commonly displayed as - a box or a space.</p> - - <h4>b. Loading a Glyph From the Face</h4> - - <p>Once you have a glyph index, you can load the - corresponding glyph image. The latter can be stored in - various formats within the font file. For fixed-size - formats like FNT or PCF, each image is a bitmap. Scalable - formats like TrueType or CFF use vectorial shapes - (<em>outlines</em>) to describe each glyph. Some formats - may have even more exotic ways of representing glyphs - (e.g., MetaFont – but this format is not supported). - Fortunately, FreeType 2 is flexible enough to support - any kind of glyph format through a simple API.</p> - - <p>The glyph image is always stored in a special object called a - <em>glyph slot</em>. As its name suggests, a glyph slot - is a container that is able to hold one glyph image at a - time, be it a bitmap, an outline, or something else. Each - face object has a single glyph slot object that can be - accessed as <code>face->glyph</code>. Its fields are - explained by - the <a href="../reference/ft2-base_interface.html#ft_glyphslotrec"><code>FT_GlyphSlotRec</code></a> - structure documentation.</p> - - <p>Loading a glyph image into the slot is performed by - calling <a href="../reference/ft2-base_interface.html#ft_load_glyph"><code>FT_Load_Glyph</code></a>.</p> - - <pre> -error = FT_Load_Glyph( - face, <span class="comment">/* handle to face object */</span> - glyph_index, <span class="comment">/* glyph index */</span> - load_flags ); <span class="comment">/* load flags, see below */</span></pre> - - <p>The <code>load_flags</code> value is a set of bit flags - to indicate some special operations. The default value - <code>FT_LOAD_DEFAULT</code> is 0.</p> - - <p>This function tries to load the corresponding glyph image - from the face.</p> - - <ul> - <li>If a bitmap is found for the corresponding glyph and - pixel size, it is loaded into the slot. Embedded - bitmaps are always favoured over native image formats, - because we assume that they are higher-quality versions - of the same glyph. This can be changed by using - the <code>FT_LOAD_NO_BITMAP</code> flag.</li> - - <li>Otherwise, a native image for the glyph is loaded. It - is also scaled to the current pixel size, as well as - hinted for certain formats like TrueType and - Type 1.</li> - </ul> - - <p>The - field <code>face−>glyph−>format</code> - describes the format used for storing the glyph image in - the slot. If it is - not <code>FT_GLYPH_FORMAT_BITMAP</code>, one can - immediately convert it to a bitmap - through <a href="../reference/ft2-base_interface.html#ft_render_glyph"><code>FT_Render_Glyph</code></a>.</p> - - <pre> -error = FT_Render_Glyph( face->glyph, <span class="comment">/* glyph slot */</span> - render_mode ); <span class="comment">/* render mode */</span></pre> - - <p>The parameter <code>render_mode</code> is a set of bit - flags to specify how to render the glyph image. - <code>FT_RENDER_MODE_NORMAL</code>, the default, renders - an anti-aliased coverage bitmap with 256 gray levels (also - called a <em>pixmap</em>), as this is the default. You - can alternatively use <code>FT_RENDER_MODE_MONO</code> if - you want to generate a 1-bit monochrome bitmap. More - values are available for - the <a href="../reference/ft2-base_interface.html#ft_render_mode"><code>FT_Render_Mode</code></a> - enumeration value.</p> - - <p>Once you have a bitmapped glyph image, you can access it - directly through <code>glyph->bitmap</code> (a simple - descriptor for bitmaps or pixmaps), and position it - through <code>glyph->bitmap_left</code> and - <code>glyph->bitmap_top</code>. For optimal rendering - on a screen the bitmap should be used as an alpha channel - in linear blending with gamma correction.</p> - - <p>Note that <code>bitmap_left</code> is the horizontal - distance from the current pen position to the leftmost - border of the glyph bitmap, while <code>bitmap_top</code> - is the vertical distance from the pen position (on the - baseline) to the topmost border of the glyph - bitmap. <em>It is positive to indicate an upwards - distance</em>.</p> - - <h4>c. Using Other Charmaps</h4> - - <p>As said before, when a new face object is created, it - looks for a Unicode charmap and select it. The currently - selected charmap can be accessed - via <code>face->charmap</code>. This field is NULL if - no charmap is selected, which typically happens when you - create a new <code>FT_Face</code> object from a font file - that doesn't contain a Unicode charmap (which is rather - infrequent today).</p> - - <p>There are two ways to select a different charmap with - FreeType. It's easiest if the encoding you need already - has a corresponding enumeration defined - in <code>FT_FREETYPE_H</code>, for - example <code>FT_ENCODING_BIG5</code>. In this case, you - can call - <a href="../reference/ft2-base_interface.html#ft_select_charmap"><code>FT_Select_Charmap</code></a>.</p> - - <pre> -error = FT_Select_Charmap( - face, <span class="comment">/* target face object */</span> - FT_ENCODING_BIG5 ); <span class="comment">/* encoding */</span></pre> - - <p>Another way is to manually parse the list of charmaps for - the face; this is accessible through the - fields <code>num_charmaps</code> and - <code>charmaps</code> (notice the ‘s’) of the - face object. As you could expect, the first is the number - of charmaps in the face, while the second is <em>a table - of pointers to the charmaps</em> embedded in the face.</p> - - <p>Each charmap has a few visible fields to describe it more - precisely. The most important ones are - <code>charmap->platform_id</code> - and <code>charmap->encoding_id</code>, defining a pair - of values that describe the charmap in a rather generic - way: Each value pair corresponds to a given encoding. For - example, the pair (3,1) corresponds to Unicode. The list - is defined in the OpenType specification; you can also use - the file <code>FT_TRUETYPE_IDS_H</code>, which defines - several helpful constants to deal with them. Note that we - use the OpenType enumeration values for non-OpenType fonts - also (by defining additional constants where - necessary).</p> - - <p>To select a specific encoding, you need to find a - corresponding value pair in the specification, then look - for it in the charmaps list.</p> - - <pre> -FT_CharMap found = 0; -FT_CharMap charmap; -int n; - - -for ( n = 0; n < face->num_charmaps; n++ ) -{ - charmap = face->charmaps[n]; - if ( charmap->platform_id == my_platform_id && - charmap->encoding_id == my_encoding_id ) - { - found = charmap; - break; - } -} - -if ( !found ) { ... } - -<span class="comment">/* now, select the charmap for the face object */</span> -error = FT_Set_Charmap( face, found ); -if ( error ) { ... }</pre> - - <p>Once a charmap has been selected, either through - <code>FT_Select_Charmap</code> - or <a href="../reference/ft2-base_interface.html#ft_set_charmap"><code>FT_Set_Charmap</code></a>, - it is used by all subsequent calls - to <code>FT_Get_Char_Index</code>.</p> - - <h4>d. Glyph Transformations</h4> - - <p>It is possible to specify an affine transformation with - <a href="../reference/ft2-base_interface.html#ft_set_transform"><code>FT_Set_Transform</code></a>, - to be applied to glyph images when they are loaded. Of - course, this only works for scalable (vectorial) font - formats.</p> - - <pre> -error = FT_Set_Transform( - face, <span class="comment">/* target face object */</span> - &matrix, <span class="comment">/* pointer to 2x2 matrix */</span> - &delta ); <span class="comment">/* pointer to 2d vector */</span></pre> - - <p>This function sets the current transformation for a given - face object. Its second parameter is a pointer to an - <a href="../reference/ft2-basic_types.html#ft_matrix"><code>FT_Matrix</code></a> - structure that describes a 2×2 affine matrix. The - third parameter is a pointer to - an <a href="../reference/ft2-basic_types.html#ft_vector"><code>FT_Vector</code></a> - structure, describing a two-dimensional vector that - translates the glyph image <em>after</em> the 2×2 - transformation.</p> - - <p>Note that the matrix pointer can be set to NULL, in which - case the identity transformation is used. Coefficients of - the matrix are otherwise in 16.16 fixed-point units.</p> - - <p>The vector pointer can also be set to NULL (in which case - a delta of (0,0) is used). The vector coordinates are - expressed in 1/64th of a pixel (also known as 26.6 - fixed-point numbers).</p> - - <p class="warning">The transformation is applied to every - glyph that is loaded through <code>FT_Load_Glyph</code> - and is <em>completely independent of any hinting - process</em>. This means that you won't get the same - results if you load a glyph at the size of 24 pixels, - or a glyph at the size of 12 pixels scaled by 2 - through a transformation, because the hints are computed - differently (except if you have disabled hints).</p> - - <p>If you ever need to use a non-orthogonal transformation - with optimal hints, you first have to decompose your - transformation into a scaling part and a rotation/shearing - part. Use the scaling part to compute a new character - pixel size, then the other one to call - <code>FT_Set_Transform</code>. This is explained in more - detail in part II of this tutorial.</p> - - <p class="warning">Rotation usually disables hinting.</p> - - <p>Loading a glyph bitmap with a non-identity transformation - works; the transformation is ignored in this case.</p> - - - <h3 id="section-7">7. Simple Text Rendering</h3> - - <p>We now present a simple example to render a string of - 8-bit Latin-1 text, assuming a face that contains a - Unicode charmap.</p> - - <p>The idea is to create a loop that loads one glyph image - on each iteration, converts it to a pixmap, draws it on - the target surface, then increments the current pen - position.</p> - - <h4 id="basic-code">a. Basic Code</h4> - - <p>The following code performs our simple text rendering - with the functions previously described.</p> - - <pre> -FT_GlyphSlot slot = face->glyph; <span class="comment">/* a small shortcut */</span> -int pen_x, pen_y, n; - - -... initialize library ... -... create face object ... -... set character size ... - -pen_x = 300; -pen_y = 200; - -for ( n = 0; n < num_chars; n++ ) -{ - FT_UInt glyph_index; - - - <span class="comment">/* retrieve glyph index from character code */</span> - glyph_index = FT_Get_Char_Index( face, text[n] ); - - <span class="comment">/* load glyph image into the slot (erase previous one) */</span> - error = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT ); - if ( error ) - continue; <span class="comment">/* ignore errors */</span> - - <span class="comment">/* convert to an anti-aliased bitmap */</span> - error = FT_Render_Glyph( face->glyph, FT_RENDER_MODE_NORMAL ); - if ( error ) - continue; - - <span class="comment">/* now, draw to our target surface */</span> - my_draw_bitmap( &slot->bitmap, - pen_x + slot->bitmap_left, - pen_y - slot->bitmap_top ); - - <span class="comment">/* increment pen position */</span> - pen_x += slot->advance.x >> 6; - pen_y += slot->advance.y >> 6; <span class="comment">/* not useful for now */</span> -}</pre> - - <p>This code needs a few explanations.</p> - - <ul> - <li>We define a handle named <code>slot</code> that points - to the face object's glyph slot. (The - type <a href="../reference/ft2-base_interface.html#ft_glyphslot"><code>FT_GlyphSlot</code></a> - is a pointer). That is a convenience to avoid using - <code>face->glyph->XXX</code> every time.</li> - - <li>We increment the pen position with the vector - <code>slot->advance</code>, which correspond to the - glyph's <em>advance width</em> (also known as - its <em>escapement</em>). The advance vector is - expressed in 1/64th of pixels, and is truncated to - integer pixels on each iteration.</li> - - <li>The function <code>my_draw_bitmap</code> is not part - of FreeType but must be provided by the application to - draw the bitmap to the target surface. In this example, - it takes a pointer to - an <a href="../reference/ft2-basic_types.html#ft_bitmap"><code>FT_Bitmap</code></a> - descriptor and the position of its top-left corner as - arguments. For ideal rendering on a screen this - function should perform linear blending with gamma - correction, using the bitmap as an alpha channel.</li> - - <li>The value of <code>slot->bitmap_top</code> is - positive for an <em>upwards</em> vertical distance. - Assuming that the coordinates taken - by <code>my_draw_bitmap</code> use the opposite - convention (increasing Y corresponds to downwards - scanlines), we subtract it from <code>pen_y</code>, - instead of adding to it.</li> - </ul> - - <h4>b.Refined code</h4> - - <p>The following code is a refined version of the example - above. It uses features and functions of FreeType that - have not yet been introduced, and which are explained - below.</p> - - <pre> -FT_GlyphSlot slot = face->glyph; <span class="comment">/* a small shortcut */</span> -FT_UInt glyph_index; -int pen_x, pen_y, n; - - -... initialize library ... -... create face object ... -... set character size ... - -pen_x = 300; -pen_y = 200; - -for ( n = 0; n < num_chars; n++ ) -{ - <span class="comment">/* load glyph image into the slot (erase previous one) */</span> - error = FT_Load_Char( face, text[n], FT_LOAD_RENDER ); - if ( error ) - continue; <span class="comment">/* ignore errors */</span> - - <span class="comment">/* now, draw to our target surface */</span> - my_draw_bitmap( &slot->bitmap, - pen_x + slot->bitmap_left, - pen_y - slot->bitmap_top ); - - <span class="comment">/* increment pen position */</span> - pen_x += slot->advance.x >> 6; -}</pre> - - <p>We have reduced the size of our code, but it does exactly - the same thing.</p> - - <ul> - <li>We use the - function <a href="../reference/ft2-base_interface.html#ft_load_char"><code>FT_Load_Char</code></a> - instead of <code>FT_Load_Glyph</code>. As you probably - imagine, it is equivalent to - calling <code>FT_Get_Char_Index</code>, then - <code>FT_Load_Glyph</code>.</li> - - <li> - <p>We do not use <code>FT_LOAD_DEFAULT</code> for the - loading mode, but the bit - flag <code>FT_LOAD_RENDER</code>. It indicates that - the glyph image must be immediately converted to an - anti-aliased bitmap. This is of course a shortcut - that avoids calling <code>FT_Render_Glyph</code> - explicitly but is strictly equivalent.</p> - - <p>Note that you can also specify that you want a - monochrome bitmap instead by using the - additional <code>FT_LOAD_MONOCHROME</code> load - flag.</p> - </li> - </ul> - - <h4 id="transformed-text">c. More Advanced Rendering</h4> - - <p>Let us try to render transformed text now (for example - through a rotation). We can do this - using <code>FT_Set_Transform</code>.</p> - - <pre> -FT_GlyphSlot slot; -FT_Matrix matrix; <span class="comment">/* transformation matrix */</span> -FT_UInt glyph_index; -FT_Vector pen; <span class="comment">/* untransformed origin */</span> -int n; - - -... initialize library ... -... create face object ... -... set character size ... - -slot = face->glyph; <span class="comment">/* a small shortcut */</span> - -<span class="comment">/* set up matrix */</span> -matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L ); -matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L ); -matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L ); -matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L ); - -<span class="comment">/* the pen position in 26.6 cartesian space coordinates */</span> -<span class="comment">/* start at (300,200) */</span> -pen.x = 300 * 64; -pen.y = ( my_target_height - 200 ) * 64; - -for ( n = 0; n < num_chars; n++ ) -{ - <span class="comment">/* set transformation */</span> - FT_Set_Transform( face, &matrix, &pen ); - - <span class="comment">/* load glyph image into the slot (erase previous one) */</span> - error = FT_Load_Char( face, text[n], FT_LOAD_RENDER ); - if ( error ) - continue; <span class="comment">/* ignore errors */</span> - - <span class="comment">/* now, draw to our target surface (convert position) */</span> - my_draw_bitmap( &slot->bitmap, - slot->bitmap_left, - my_target_height - slot->bitmap_top ); - - <span class="comment">/* increment pen position */</span> - pen.x += slot->advance.x; - pen.y += slot->advance.y; -}</pre> - - <p>Some remarks.</p> - - <ul> - <li>We now use a vector of type <code>FT_Vector</code> to - store the pen position, with coordinates expressed as - 1/64th of pixels, hence a multiplication. The position - is expressed in cartesian space.</li> - - <li>Glyph images are always loaded, transformed, and - described in the cartesian coordinate system within - FreeType (which means that increasing Y corresponds - to upper scanlines), unlike the system typically used - for bitmaps (where the topmost scanline has - coordinate 0). We must thus convert between the - two systems when we define the pen position, and when we - compute the topleft position of the bitmap.</li> - - <li>We set the transformation on each glyph to indicate - the rotation matrix as well as a delta that moves the - transformed image to the current pen position (in - cartesian space, not bitmap space). As a consequence, - the values of <code>bitmap_left</code> - and <code>bitmap_top</code> correspond to the bitmap - origin in target space pixels. We thus don't - add <code>pen.x</code> or <code>pen.y</code> to their - values when calling <code>my_draw_bitmap</code>.</li> - - <li>The advance width is always returned transformed, - which is why it can be directly added to the current pen - position. Note that it is <em>not</em> rounded this - time.</li> - </ul> - - <p>A complete source code example can be found - <a href="example1.c">here</a>.</p> - - <p>It is important to note that, while this example is a bit - more complex than the previous one, it is strictly - equivalent for the case where the transformation is the - identity. Hence it can be used as a replacement (but a - more powerful one).</p> - - <p>The still present few shortcomings will be explained, and - solved, in the next part of this tutorial.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Tutorial</a> - </li> - <li class="tertiary"> - <a href="step1.html" class="current">Simple Glyph Loading</a> - </li> - <li class="tertiary"> - <a href="step2.html">Managing Glyphs</a> - </li> - <li class="tertiary"> - <a href="step3.html">Examples</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/tutorial/step2.html b/lib/freetype/docs/tutorial/step2.html deleted file mode 100644 index b7db6bffe..000000000 --- a/lib/freetype/docs/tutorial/step2.html +++ /dev/null @@ -1,1610 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Tutorial / II</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> - Tutorial / II</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="simple-glyph-loading"> - <h2>II. Managing Glyphs</h2> - - - <h3 id="section-1">1. Glyph Metrics</h3> - - <p>Glyph metrics are, as the name suggests, certain - distances associated with each glyph that describe how to - position this glyph while creating a text layout.</p> - - <p>There are usually two sets of metrics for a single glyph: - Those used to represent glyphs in horizontal text layouts - (Latin, Cyrillic, Arabic, Hebrew, etc.), and those used to - represent glyphs in vertical text layouts (Chinese, - Japanese, Korean, Mongolian, etc.).</p> - - <p>Note that only a few font formats provide vertical - metrics. You can test whether a given face object - contains them by using the - macro <a href="../reference/ft2-base_interface.html#ft_has_vertical"><code>FT_HAS_VERTICAL</code></a>, - which returns true if appropriate.</p> - - <p>Individual glyph metrics can be accessed by first loading - the glyph in a face's glyph slot, then accessing them - through the <code>face->glyph->metrics</code> - structure, whose type - is <a href="../reference/ft2-base_interface.html#ft_glyph_metrics"><code>FT_Glyph_Metrics</code></a>. - We will discuss this in more detail below; for now, we - only note that it contains the following fields.</p> - - <dl> - <dt>width</dt> - <dd>This is the width of the glyph image's bounding box. - It is independent of the layout direction.</dd> - - <dt>height</dt> - <dd>This is the height of the glyph image's bounding box. - It is independent of the layout direction. Be careful - not to confuse it with the ‘height’ field in - the <a href="../reference/ft2-base_interface.html#ft_size_metrics"> - <code>FT_Size_Metrics</code></a> structure.</dd> - - <dt>horiBearingX</dt> - <dd>For <em>horizontal text layouts</em>, this is the - horizontal distance from the current cursor position to - the leftmost border of the glyph image's bounding - box.</dd> - - <dt>horiBearingY</dt> - <dd>For <em>horizontal text layouts</em>, this is the - vertical distance from the current cursor position (on - the baseline) to the topmost border of the glyph image's - bounding box.</dd> - - <dt>horiAdvance</dt> - <dd>For <em>horizontal text layouts</em>, this is the - horizontal distance to increment the pen position when - the glyph is drawn as part of a string of text.</dd> - - <dt>vertBearingX</dt> - <dd>For <em>vertical text layouts</em>, this is the - horizontal distance from the current cursor position to - the leftmost border of the glyph image's bounding - box.</dd> - - <dt>vertBearingY</dt> - <dd>For <em>vertical text layouts</em>, this is the - vertical distance from the current cursor position (on - the baseline) to the topmost border of the glyph image's - bounding box.</dd> - - <dt>vertAdvance</dt> - <dd>For <em>vertical text layouts</em>, this is the - vertical distance used to increment the pen position - when the glyph is drawn as part of a string of - text.</dd> - </dl> - - <p class="warning">As not all fonts do contain vertical - metrics, the values of <code>vertBearingX</code>, - <code>vertBearingY</code> and <code>vertAdvance</code> - should not be considered reliable - if <code>FT_HAS_VERTICAL</code> returns false.</p> - - <p>The following graphics illustrate the metrics more - clearly. In case a distance is directed, it is marked - with a single arrow, indicating a positive value. The - first image displays horizontal metrics, where the - baseline is the horizontal axis.</p> - - <div class="figure"> - <img src="metrics.png" - alt="horizontal layout" - width=388 - height=253> - </div> - - <p>For vertical text layouts, the baseline is vertical, - identical to the vertical axis. Contrary to all other - arrows, <code>bearingX</code> shows a negative value in - this image.</p> - - <div class="figure"> - <img src="metrics2.png" - alt="vertical layout" - width=294 - height=278> - </div> - - <p>The metrics found - in <code>face->glyph->metrics</code> are normally - expressed in 26.6 pixel format (i.e., 1/64th of pixels), - unless you use the <code>FT_LOAD_NO_SCALE</code> flag when - calling <code>FT_Load_Glyph</code> - or <code>FT_Load_Char</code>. In this case, the metrics - are expressed in original font units.</p> - - <p>The glyph slot object has also a few other interesting - fields that eases a developer's work. You can access them - through <code>face->glyph->xxx</code>, - where <code>xxx</code> is one of the following fields.</p> - - <dl> - <dt>advance</dt> - <dd>This field is a <code>FT_Vector</code> that holds the - transformed advance for the glyph. That is useful when - you are using a transformation - through <code>FT_Set_Transform</code>, as shown in the - <a href="step1.html#transformed-text">rotated text - example</a> of part I. Other than that, its value - is by default (metrics.horiAdvance,0), unless you - specify <code>FT_LOAD_VERTICAL</code> when loading the - glyph image; it is then (0,metrics.vertAdvance).</dd> - - <dt>linearHoriAdvance</dt> - <dd>This field contains the linearly scaled value of the - glyph's horizontal advance width. Indeed, the value of - <code>metrics.horiAdvance</code> that is returned in the - glyph slot is normally rounded to integer pixel - coordinates (i.e., being a multiple of 64) by the - font driver that actually loads the glyph - image. <code>linearHoriAdvance</code> is a 16.16 - fixed-point number that gives the value of the original - glyph advance width in 1/65536th of pixels. It can be - use to perform pseudo device-independent text - layouts.</dd> - - <dt>linearVertAdvance</dt> - <dd>This is the similar to <code>linearHoriAdvance</code> - but for the glyph's vertical advance height. Its value - is only reliable if the font face contains vertical - metrics.</dd> - </dl> - - - <h3 id="section-2">2. Managing Glyph Images</h3> - - <p>The glyph image that is loaded in a glyph slot can be - converted into a bitmap, either by - using <code>FT_LOAD_RENDER</code> when loading it, or by - calling <a href="../reference/ft2-base_interface.html#ft_render_glyph"><code>FT_Render_Glyph</code></a>. - Each time you load a new glyph image, the previous one is - erased from the glyph slot.</p> - - <p>There are situations, however, where you may need to - extract this image from the glyph slot in order to cache - it within your application, and even perform additional - transformations and measures on it before converting it to - a bitmap.</p> - - <p>The FreeType 2 API has a specific extension that is - capable of dealing with glyph images in a flexible and - generic way. To use it, you first need to include - the <a href="../reference/ft2-header_file_macros.html#ft_glyph_h"><code>FT_GLYPH_H</code></a> - header file.</p> - - <pre> -#include FT_GLYPH_H</pre> - - <h4>a.Extracting the Glyph Image</h4> - - <p>You can extract a single glyph image very easily. Here - some code that shows how to do it.</p> - - <pre> -FT_Glyph glyph; <span class="comment">/* a handle to the glyph image */</span> - - -... -error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NORMAL ); -if ( error ) { ... } - -error = FT_Get_Glyph( face->glyph, &glyph ); -if ( error ) { ... }</pre> - - <p>The following steps are performed.</p> - - <ul> - <li>Create a variable named <code>glyph</code>, of - type <a href="../reference/ft2-glyph_management.html#ft_glyph"><code>FT_Glyph</code></a>. - This is a handle (pointer) to an individual glyph - image.</li> - - <li>Load the glyph image in the normal way into the face's - glyph slot. We don't use <code>FT_LOAD_RENDER</code> - because we want to grab a scalable glyph image that we - can transform later on.</li> - - <li>Copy the glyph image from the slot into a - new <code>FT_Glyph</code> object by - calling <a href="../reference/ft2-glyph_management.html#ft_get_glyph"><code>FT_Get_Glyph</code></a>. - This function returns an error code and - sets <code>glyph</code>.</li> - </ul> - - <p>It is important to note that the extracted glyph is in - the same format as the original one that is still in the - slot. For example, if we are loading a glyph from a - TrueType font file, the glyph image is really a scalable - vector outline. You can access the - field <code>glyph->format</code> if you want to know - exactly how the glyph is modeled and stored.</p> - - <p>A new glyph object can be destroyed with a call - to <a href="../reference/ft2-glyph_management.html#ft_done_glyph"><code>FT_Done_Glyph</code></a>.</p> - - <p>The glyph object contains exactly one glyph image and a - 2D vector representing the glyph's advance in 16.16 - fixed-point coordinates. The latter can be accessed - directly as <code>glyph->advance</code></p> - - <p class="warning">Note that unlike other FreeType objects, - the library doesn't keep a list of all allocated glyph - objects. This means you have to destroy them yourself - instead of relying on <code>FT_Done_FreeType</code> doing - all the clean-up.</p> - - <h4>b. Transforming & Copying the Glyph Image</h4> - - <p>If the glyph image is scalable (i.e., - if <code>glyph->format</code> is not equal - to <code>FT_GLYPH_FORMAT_BITMAP</code>), it is possible to - transform the image anytime by a call - to <a href="../reference/ft2-glyph_management.html#ft_glyph_transform"><code>FT_Glyph_Transform</code></a>.</p> - - <p>You can also copy a single glyph image - with <a href="../reference/ft2-glyph_management.html#ft_glyph_copy"><code>FT_Glyph_Copy</code></a>.</p> - - <pre> -FT_Glyph glyph, glyph2; -FT_Matrix matrix; -FT_Vector delta; - - -... load glyph image in `glyph' ... - -<span class="comment">/* copy glyph to glyph2 */</span> - -error = FT_Glyph_Copy( glyph, &glyph2 ); -if ( error ) { ... could not copy (out of memory) ... } - -<span class="comment">/* translate `glyph' */</span> - -delta.x = -100 * 64; <span class="comment">/* coordinates are in 26.6 pixel format */</span> -delta.y = 50 * 64; - -FT_Glyph_Transform( glyph, 0, &delta ); - -<span class="comment">/* transform glyph2 (horizontal shear) */</span> - -matrix.xx = 0x10000L; -matrix.xy = 0.12 * 0x10000L; -matrix.yx = 0; -matrix.yy = 0x10000L; - -FT_Glyph_Transform( glyph2, &matrix, 0 );</pre> - - <p>Note that the 2×2 transformation matrix is always - applied to the 16.16 advance vector in the glyph; you thus - don't need to recompute it.</p> - - <h4>c. Measuring the Glyph Image</h4> - - <p>You can also retrieve the control (bounding) box of any - glyph image (scalable or not) through - the <a href="../reference/ft2-glyph_management.html#ft_glyph_get_cbox"><code>FT_Glyph_Get_CBox</code></a> - function.</p> - - <pre> -FT_BBox bbox; - - -... -FT_Glyph_Get_CBox( glyph, <em>bbox_mode</em>, &bbox );</pre> - - <p>Coordinates are relative to the glyph origin (0,0), using - the y upwards convention. This function takes a - special argument, the <em>bbox mode</em>, to indicate how - box coordinates are expressed.</p> - - <p>If the glyph has been loaded - with <code>FT_LOAD_NO_SCALE</code>, <code>bbox_mode</code> - must be set to <code>FT_GLYPH_BBOX_UNSCALED</code> to get - unscaled font units in 26.6 pixel format. The - value <code>FT_GLYPH_BBOX_SUBPIXELS</code> is another name - for this constant.</p> - - <p>Note that the box's maximum coordinates are exclusive, - which means that you can always compute the width and - height of the glyph image (regardless of using integer or - 26.6 coordinates) with a simple subtraction.</p> - - <pre class="example"> -width = bbox.xMax - bbox.xMin; -height = bbox.yMax - bbox.yMin;</pre> - - <p>Note also that for 26.6 coordinates, if - <code>FT_GLYPH_BBOX_GRIDFIT</code> is used as the bbox - mode, the coordinates are also grid-fitted, which - corresponds to the following four lines of - pseudo-code.</p> - - <pre class="example"> -bbox.xMin = FLOOR( bbox.xMin ) -bbox.yMin = FLOOR( bbox.yMin ) -bbox.xMax = CEILING( bbox.xMax ) -bbox.yMax = CEILING( bbox.yMax )</pre> - - <p>To get the bbox in <em>integer</em> pixel coordinates, - set <code>bbox_mode</code> - to <code>FT_GLYPH_BBOX_TRUNCATE</code>.</p> - - <p>Finally, to get the bounding box in grid-fitted pixel - coordinates, set <code>bbox_mode</code> - to <code>FT_GLYPH_BBOX_PIXELS</code>.</p> - - <p>[Computing <em>exact</em> bounding boxes can be done with - function <a href="../reference/ft2-outline_processing.html#ft_outline_get_bbox"><code>FT_Outline_Get_BBox</code></a>, - at the cost of slower execution. You probably don't need - it with the possible exception of rotated glyphs.]</p> - - <h4>d. Converting the Glyph Image to a Bitmap</h4> - - <p>You may need to convert the glyph object to a bitmap once - you have conveniently cached or transformed it. This can - be done easily with - the <a href="../reference/ft2-glyph_management.html"><code>FT_Glyph_To_Bitmap</code></a> - function, which handles any glyph object.</p> - - <pre> -FT_Vector origin; - - -origin.x = 32; <span class="comment">/* 1/2 pixel in 26.6 format */</span> -origin.y = 0; - -error = FT_Glyph_To_Bitmap( - &glyph, - <em>render_mode</em>, - &origin, - 1 ); <span class="comment">/* destroy original image == true */</span></pre> - - <p>Some notes.</p> - - <ul> - <li>The first parameter is the address of the source - glyph's handle. When the function is called, it reads - it to access the source glyph object. After the call, - the handle points to a <em>new</em> glyph object that - contains the rendered bitmap.</li> - - <li>The second parameter is a standard render mode to - specify what kind of bitmap we want. For example, it - can be <code>FT_RENDER_MODE_DEFAULT</code> for an 8-bit - anti-aliased pixmap, or <code>FT_RENDER_MODE_MONO</code> - for a 1-bit monochrome bitmap.</li> - - <li>The third parameter is a pointer to a two-dimensional - vector to translate the source glyph image before the - conversion. After the call, the source image is - translated back to its original position (and is thus - left unchanged). If you do not need to translate the - source glyph before rendering, set this pointer - to NULL.</li> - - <li>The last parameter is a boolean that indicates whether - the source glyph object should be destroyed by the - function. If false, the original glyph object is never - destroyed, even if its handle is lost (it is up to - client applications to keep it).</li> - </ul> - - <p>The new glyph object always contains a bitmap (if no - error is returned), and you must <em>typecast</em> its - handle to the <code>FT_BitmapGlyph</code> type in order to - access its content. This type is a sort of - ‘subclass’ of <code>FT_Glyph</code> that - contains additional fields - (see <a href="../reference/ft2-glyph_management.html#ft_bitmapglyphrec"><code>FT_BitmapGlyphRec</code></a>).</p> - - <dl> - <dt>left</dt> - <dd>Just like the <code>bitmap_left</code> field of a - glyph slot, this is the horizontal distance from the - glyph origin (0,0) to the leftmost pixel of the glyph - bitmap. It is expressed in integer pixels.</dd> - - <dt>top</dt> - <dd>Just like the <code>bitmap_top</code> field of a glyph - slot, this is the vertical distance from the glyph - origin (0,0) to the topmost pixel of the glyph bitmap - (more precise, to the pixel just above the bitmap). - This distance is expressed in integer pixels, and is - positive for upwards y.</dd> - - <dt>bitmap</dt> - <dd>This is a bitmap descriptor for the glyph object, just - like the <code>bitmap</code> field in a glyph slot.</dd> - </dl> - - - <h3 id="section-3">3. Global Glyph Metrics</h3> - - <p>Unlike glyph metrics, global metrics are used to describe - distances and features of a whole font face. They can be - expressed either in 26.6 pixel format or in (unscaled) - font units for scalable formats.</p> - - <h4> a. Design global metrics</h4> - - <p>For scalable formats, all global metrics are expressed in - font units in order to be later scaled to the device - space, according to the rules described in the last - section of this tutorial part. You can access them - directly as fields of an <code>FT_Face</code> handle.</p> - - <p>However, you need to check that the font face's format is - scalable before using them. One can do it with - macro <code>FT_IS_SCALABLE</code>, which returns true when - appropriate.</p> - - <p>Here a table of the global design metrics for scalable - faces.</p> - - <dl> - <dt>units_per_EM</dt> - <dd>This is the size of the EM square for the font face. - It is used by scalable formats to scale design - coordinates to device pixels, as described in the last - section of this tutorial part. Its value usually is - 2048 (for TrueType) or 1000 (for Type 1 or CFF), - but other values are possible, too. It is set to 1 - for fixed-size formats like FNT, FON, PCF, or BDF.</dd> - - <dt>bbox</dt> - <dd>The global bounding box is defined as the smallest - rectangle that can enclose all the glyphs in a font - face.</dd> - - <dt>ascender</dt> - <dd>The ascender is the vertical distance from the - horizontal baseline to the highest - ‘character’ coordinate in a font face. - Unfortunately, font formats don't define the ascender in - a uniform way. For some formats, it represents the - ascent of all capital latin characters (without - accents), for others it is the ascent of the highest - accented character, and finally, other formats define it - as being equal to <code>bbox.yMax</code>.</dd> - - <dt>descender</dt> - <dd>The descender is the vertical distance from the - horizontal baseline to the lowest - ‘character’ coordinate in a font face. - Unfortunately, font formats don't define the descender - in a uniform way. For some formats, it represents the - descent of all capital latin characters (without - accents), for others it is the ascent of the lowest - accented character, and finally, other formats define it - as being equal to <code>bbox.yMin</code>. This field is - negative for values below the baseline.</dd> - - <dt>height</dt> - <dd>This field represents a <em>default line spacing</em> - (i.e., the baseline-to-baseline distance) when writing - text with this font. Note that it usually is larger - than the sum of the ascender and descender taken as - absolute values. There is also no guarantee that no - glyphs extend above or below subsequent baselines when - using this distance – think of it as a value the - designer of the font finds appropriate.</dd> - - <dt>max_advance_width</dt> - <dd>This field gives the maximum horizontal cursor advance - for all glyphs in the font. It can be used to quickly - compute the maximum advance width of a string of - text. <em>It doesn't correspond to the maximum glyph - image width!</em></dd> - - <dt>max_advance_height</dt> - <dd>Same as <code>max_advance_width</code> but for - vertical text layout.</dd> - - <dt>underline_position</dt> - <dd>When displaying or rendering underlined text, this - value corresponds to the vertical position, relative to - the baseline, of the underline bar's center. It is - negative if it is below the baseline.</dd> - - <dt>underline_thickness</dt> - <dd>When displaying or rendering underlined text, this - value corresponds to the vertical thickness of the - underline.</dd> - </dl> - - <p>Notice that the values of the ascender and the descender - are not reliable (due to various discrepancies in font - formats), unfortunately.</p> - - <h4>b. Scaled Global Metrics</h4> - - <p>Each size object also contains a scaled version of some - of the global metrics described above, to be directly - accessed through - the <code>face->size->metrics</code> structure (of - type <a href="../reference/ft2-base_interface.html#ft_size_metrics"> - <code>FT_Size_Metrics</code></a>). <em>No grid-fitting - is performed for those values</em>. They are also - completely independent of any hinting process. In other - words, don't rely on them to get exact metrics at the - pixel level. They are expressed in 26.6 pixel format but - rounded for historical reasons.</p> - - <dl> - <dt>ascender</dt> - <dd>The scaled version of the original design ascender; - rounded up to an integer value.</dd> - - <dt>descender</dt> - <dd>The scaled version of the original design descender, - rounded down to an integer value.</dd> - - <dt>height</dt> - <dd> - <p>The scaled version of the original design text height - (the vertical distance from one baseline to the next). - This is probably the only field you should really use - in this structure. It is rounded to an integer - value.</p> - - <p>Be careful not to confuse it with the - ‘height’ field in - the <a href="../reference/ft2-base_interface.html#ft_glyph_metrics"><code>FT_Glyph_Metrics</code></a> - structure.</p> - </dd> - - <dt>max_advance</dt> - <dd>The scaled version of the original design maximum - advance, rounded to an integer value.</dd> - </dl> - - <p>Note that the <code>face->size->metrics</code> - structure contains other fields that are used to scale - design coordinates to device space. They are described in - the last section.</p> - - <h4>c. Kerning</h4> - - <p>Kerning is the process of adjusting the position of two - subsequent glyph images in a string of text in order to - improve the general appearance of text. For example, if a - glyph for an uppercase ‘A’ is followed by a - glyph for an uppercase ‘V’, the space between - the two glyphs can be slightly reduced to avoid extra - ‘diagonal whitespace’.</p> - - <p>Note that in theory kerning can happen both in the - horizontal and vertical direction between two glyphs; - however, it only happens in a single direction in nearly - all cases.</p> - - <p>Not all font formats contain kerning information, and not - all kerning formats are supported by FreeType; in - particular, for TrueType fonts, the API can only access - kerning via the ‘kern’ - table. <span class="important">OpenType kerning via the - ‘GPOS’ table is not supported!</span> You - need a higher-level library - like <a href="http://www.harfbuzz.org">HarfBuzz</a>, - <a href="http://www.pango.org">Pango</a>, - or <a href="http://www.icu-project.org">ICU</a>, since - GPOS kerning requires contextual string handling.</p> - - <p>Sometimes, the font file is associated with an additional - file that contains various glyph metrics, including - kerning, but no glyph images. A good example is the - Type 1 format where glyph images are stored in files - with extension <code>.pfa</code> or <code>.pfb</code>, - while kerning metrics can be found in files with extension - <code>.afm</code> or <code>.pfm</code>.</p> - - <p>FreeType 2 allows you to deal with this, by - providing - the <a href="../reference/ft2-base_interface.html#ft_attach_file"><code>FT_Attach_File</code></a> - and <a href="../reference/ft2-base_interface.html#ft_attach_stream"><code>FT_Attach_Stream</code></A> - APIs. Both functions are used to load additional metrics - into a face object by reading them from an additional - format-specific file. Here an example, opening a - Type 1 font.</p> - - <pre> -error = FT_New_Face( library, "/usr/share/fonts/cour.pfb", - 0, &face ); -if ( error ) { ... } - -error = FT_Attach_File( face, "/usr/share/fonts/cour.afm" ); -if ( error ) -{ ... could not read kerning and additional metrics ... }</pre> - - <p>Note that <code>FT_Attach_Stream</code> is similar to - <code>FT_Attach_File</code> except that it doesn't take a - C string to name the extra file but - an <a href="../reference/ft2-system_interface.html#ft_streamrec"><code>FT_Stream</code></a> - handle. Also, <em>reading a metrics file is in no way - mandatory</em>.</p> - - <p>Finally, the file attachment APIs are very generic and - can be used to load any kind of extra information for a - given face. The nature of the additional content is - entirely font format specific.</p> - - <p>FreeType 2 allows you to retrieve the kerning - information between two glyphs through - the <a href="../reference/ft2-base_interface.html#ft_get_kerning"><code>FT_Get_Kerning</code></a> - function.</p> - - <pre> -FT_Vector kerning; - - -... -error = FT_Get_Kerning( face, <span class="comment">/* handle to face object */</span> - left, <span class="comment">/* left glyph index */</span> - right, <span class="comment">/* right glyph index */</span> - <em>kerning_mode</em>, <span class="comment">/* kerning mode */</span> - &kerning ); <span class="comment">/* target vector */</span></pre> - - <p>This function takes a handle to a face object, the - indices of the left and right glyph for which the kerning - value is desired, an integer, called the <em>kerning - mode</em>, and a pointer to a destination vector that - receives the corresponding distances.</p> - - <p>The kerning mode is very similar to the <em>bbox - mode</em> described in a previous section. It is a - enumeration that indicates how the kerning distances are - expressed in the target vector.</p> - - <p>The default value is <code>FT_KERNING_DEFAULT</code>, - which has value 0. It corresponds to kerning - distances expressed in 26.6 grid-fitted pixels (which - means that the values are multiples of 64). For scalable - formats, this means that the design kerning distance is - scaled, then rounded.</p> - - <p>The value <code>FT_KERNING_UNFITTED</code> corresponds to - kerning distances expressed in 26.6 unfitted pixels (i.e., - that do not correspond to integer coordinates). It is the - design kerning distance that is scaled without - rounding.</p> - - <p>Finally, the value <code>FT_KERNING_UNSCALED</code> - indicates to return the design kerning distance, expressed - in font units. You can later scale it to the device space - using the computations explained in the last section of - this part.</p> - - <p>Note that the ‘left’ and ‘right’ - positions correspond to the <em>visual order</em> of the - glyphs in the string of text. This is important for - bidirectional or right-to-left text.</p> - - - <h3 id="section-4">4. Simple Text Rendering: Kerning and Centering</h3> - - <p>In order to show off what we have just learned, we now - demonstrate how to modify - the <a href="step1.html#basic-code">example code</a> that - was provided in part I to render a string of text, - and enhance it to support kerning and delayed - rendering.</p> - - <h4>a. Kerning Support</h4> - - <p>Adding support for kerning to our code is trivial, as - long as we consider that we are still dealing with a - left-to-right script like Latin. We simply need to - retrieve the kerning distance between two glyphs in order - to alter the pen position appropriately.</p> - - <pre> -FT_GlyphSlot slot = face->glyph; <span class="comment">/* a small shortcut */</span> -FT_UInt glyph_index; -FT_Bool use_kerning; -FT_UInt previous; -int pen_x, pen_y, n; - - -... initialize library ... -... create face object ... -... set character size ... - -pen_x = 300; -pen_y = 200; - -use_kerning = FT_HAS_KERNING( face ); -previous = 0; - -for ( n = 0; n < num_chars; n++ ) -{ - <span class="comment">/* convert character code to glyph index */</span> - glyph_index = FT_Get_Char_Index( face, text[n] ); - - <span class="comment">/* retrieve kerning distance and move pen position */</span> - if ( use_kerning && previous && glyph_index ) - { - FT_Vector delta; - - - FT_Get_Kerning( face, previous, glyph_index, - FT_KERNING_DEFAULT, &delta ); - - pen_x += delta.x >> 6; - } - - <span class="comment">/* load glyph image into the slot (erase previous one) */</span> - error = FT_Load_Glyph( face, glyph_index, FT_LOAD_RENDER ); - if ( error ) - continue; <span class="comment">/* ignore errors */</span> - - <span class="comment">/* now draw to our target surface */</span> - my_draw_bitmap( &slot->bitmap, - pen_x + slot->bitmap_left, - pen_y - slot->bitmap_top ); - - <span class="comment">/* increment pen position */</span> - pen_x += slot->advance.x >> 6; - - <span class="comment">/* record current glyph index */</span> - previous = glyph_index; -}</pre> - - <p>We are done. Some notes.</p> - - <ul> - <li>As kerning is determined by glyph indices, we need to - explicitly convert our character codes into glyph - indices, then later call <code>FT_Load_Glyph</code> - instead of <code>FT_Load_Char</code>.</li> - - <li>We use a boolean named <code>use_kerning</code>, which - is set to the result of the - macro <code>FT_HAS_KERNING</code>. It is certainly - faster not to call <code>FT_Get_Kerning</code> when we - know that the font face does not contain kerning - information.</li> - - <li>We move the position of the pen <em>before</em> a new - glyph is drawn.</li> - - <li>We initialize the variable <code>previous</code> with - the value 0, which always corresponds to the - ‘missing glyph’ (also - called <code>.notdef</code> in the PostScript world). - There is never any kerning distance associated with this - glyph.</li> - - <li>We do not check the error code returned by - <code>FT_Get_Kerning</code>. This is because the - function always sets the content of <code>delta</code> - to (0,0) if an error occurs.</li> - </ul> - - <h4>b. Centering</h4> - - <p>Our code begins to become interesting but it is still a - bit too simple for normal use. For example, the position - of the pen is determined before we do the rendering; - normally, you would rather determine the layout of the - text and measure it before computing its final position - (centering, etc.), or perform things like - word-wrapping.</p> - - <p>Let us now decompose our text rendering function into two - distinct but successive parts: The first one positions - individual glyph images on the baseline, while the second - one renders the glyphs. As we will see, this has many - advantages.</p> - - <p>We thus start by storing individual glyph images, as well - as their position on the baseline.</p> - - <pre> -FT_GlyphSlot slot = face->glyph; <span class="comment">/* a small shortcut */</span> -FT_UInt glyph_index; -FT_Bool use_kerning; -FT_UInt previous; -int pen_x, pen_y, n; - -FT_Glyph glyphs[MAX_GLYPHS]; <span class="comment">/* glyph image */</span> -FT_Vector pos [MAX_GLYPHS]; <span class="comment">/* glyph position */</span> -FT_UInt num_glyphs; - - -... initialize library ... -... create face object ... -... set character size ... - -pen_x = 0; <span class="comment">/* start at (0,0) */</span> -pen_y = 0; - -num_glyphs = 0; -use_kerning = FT_HAS_KERNING( face ); -previous = 0; - -for ( n = 0; n < num_chars; n++ ) -{ - <span class="comment">/* convert character code to glyph index */</span> - glyph_index = FT_Get_Char_Index( face, text[n] ); - - <span class="comment">/* retrieve kerning distance and move pen position */</span> - if ( use_kerning && previous && glyph_index ) - { - FT_Vector delta; - - - FT_Get_Kerning( face, previous, glyph_index, - FT_KERNING_DEFAULT, &delta ); - - pen_x += delta.x >> 6; - } - - <span class="comment">/* store current pen position */</span> - pos[num_glyphs].x = pen_x; - pos[num_glyphs].y = pen_y; - - <span class="comment">/* load glyph image into the slot without rendering */</span> - error = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT ); - if ( error ) - continue; <span class="comment">/* ignore errors, jump to next glyph */</span> - - <span class="comment">/* extract glyph image and store it in our table */</span> - error = FT_Get_Glyph( face->glyph, &glyphs[num_glyphs] ); - if ( error ) - continue; <span class="comment">/* ignore errors, jump to next glyph */</span> - - <span class="comment">/* increment pen position */</span> - pen_x += slot->advance.x >> 6; - - <span class="comment">/* record current glyph index */</span> - previous = glyph_index; - - <span class="comment">/* increment number of glyphs */</span> - num_glyphs++; -}</pre> - - <p>This is a very slight variation of our previous code; we - extract each glyph image from the slot, then store it, - along with the corresponding position, in our tables.</p> - - <p>Note also that <code>pen_x</code> contains the total - advance for the string of text. We can now compute the - bounding box of the text string with a simple - function.</p> - - <pre> -void compute_string_bbox( FT_BBox *abbox ) -{ - FT_BBox bbox; - FT_BBox glyph_bbox; - - - <span class="comment">/* initialize string bbox to "empty" values */</span> - bbox.xMin = bbox.yMin = 32000; - bbox.xMax = bbox.yMax = -32000; - - <span class="comment">/* for each glyph image, compute its bounding box, */</span> - <span class="comment">/* translate it, and grow the string bbox */</span> - for ( n = 0; n < num_glyphs; n++ ) - { - FT_Glyph_Get_CBox( glyphs[n], ft_glyph_bbox_pixels, - &glyph_bbox ); - - glyph_bbox.xMin += pos[n].x; - glyph_bbox.xMax += pos[n].x; - glyph_bbox.yMin += pos[n].y; - glyph_bbox.yMax += pos[n].y; - - if ( glyph_bbox.xMin < bbox.xMin ) - bbox.xMin = glyph_bbox.xMin; - - if ( glyph_bbox.yMin < bbox.yMin ) - bbox.yMin = glyph_bbox.yMin; - - if ( glyph_bbox.xMax > bbox.xMax ) - bbox.xMax = glyph_bbox.xMax; - - if ( glyph_bbox.yMax > bbox.yMax ) - bbox.yMax = glyph_bbox.yMax; - } - - <span class="comment">/* check that we really grew the string bbox */</span> - if ( bbox.xMin > bbox.xMax ) - { - bbox.xMin = 0; - bbox.yMin = 0; - bbox.xMax = 0; - bbox.yMax = 0; - } - - <span class="comment">/* return string bbox */</span> - *abbox = bbox; -}</pre> - - <p>The resulting bounding box dimensions are expressed in - integer pixels and can then be used to compute the final - pen position before rendering the string.</p> - - <p class="warning">In general, the above function - does <em>not</em> compute an exact bounding box of a - string! As soon as hinting is involved, glyph - dimensions <em>must</em> be derived from the resulting - outlines. For anti-aliased pixmaps, - <code>FT_Outline_Get_BBox</code> then yields proper - results. In case you need 1-bit monochrome bitmaps, it is - even necessary to actually render the glyphs because the - rules for the conversion from outline to bitmap can also - be controlled by hinting instructions - (cf. <a href="https://docs.microsoft.com/en-us/typography/opentype/spec/ttch01#the-scan-converter">dropout - control</a>).</p> - - <pre> -<span class="comment">/* compute string dimensions in integer pixels */</span> -string_width = string_bbox.xMax - string_bbox.xMin; -string_height = string_bbox.yMax - string_bbox.yMin; - -<span class="comment">/* compute start pen position in 26.6 Cartesian pixels */</span> -start_x = ( ( my_target_width - string_width ) / 2 ) * 64; -start_y = ( ( my_target_height - string_height ) / 2 ) * 64; - -for ( n = 0; n < num_glyphs; n++ ) -{ - FT_Glyph image; - FT_Vector pen; - - - image = glyphs[n]; - - pen.x = start_x + pos[n].x; - pen.y = start_y + pos[n].y; - - error = FT_Glyph_To_Bitmap( &image, FT_RENDER_MODE_NORMAL, - &pen, 0 ); - if ( !error ) - { - FT_BitmapGlyph bit = (FT_BitmapGlyph)image; - - - my_draw_bitmap( bit->bitmap, - bit->left, - my_target_height - bit->top ); - - FT_Done_Glyph( image ); - } -}</pre> - - <p>Some remarks.</p> - - <ul> - <li>The pen position is expressed in the Cartesian space - (i.e., y upwards).</li> - - <li>We call <code>FT_Glyph_To_Bitmap</code> with - the <code>destroy</code> parameter set to 0 - (false), in order to avoid destroying the original glyph - image. The new glyph bitmap is accessed through - <code>image</code> after the call and is typecast to - <code>FT_BitmapGlyph</code>.</li> - - <li>We use translation when - calling <code>FT_Glyph_To_Bitmap</code>. This ensures - that the <code>left</code> and <code>top</code> fields - of the bitmap glyph object are already set to the - correct pixel coordinates in the Cartesian space.</li> - - <li>Of course, we still need to convert pixel coordinates - from Cartesian to device space before rendering, hence - the <code>my_target_height - bitmap->top</code> in the - call to <code>my_draw_bitmap</code>.</li> - </ul> - - <p>The same loop can be used to render the string anywhere - on our display surface, without the need to reload our - glyph images each time.</p> - - - <h3 id="section-5">5. Advanced Text Rendering: - Transformation and Centering and Kerning</h3> - - <p>We are now going to modify our code in order to be able - to easily transform the rendered string, for example, to - rotate it. First, some minor improvements.</p> - - <h4>a. Packing and Translating Glyphs</h4> - - <p>We start by packing the information related to a single - glyph image into a single structure instead of parallel - arrays.</p> - - <pre> -typedef struct TGlyph_ -{ - FT_UInt index; <span class="comment">/* glyph index */</span> - FT_Vector pos; <span class="comment">/* glyph origin on the baseline */</span> - FT_Glyph image; <span class="comment">/* glyph image */</span> - -} TGlyph, *PGlyph;</pre> - - <p>We also translate each glyph image directly after it is - loaded to its position on the baseline at load time. As - we will see, this has several advantages. Here is our new - glyph sequence loader.</p> - - <pre> -FT_GlyphSlot slot = face->glyph; <span class="comment">/* a small shortcut */</span> -FT_UInt glyph_index; -FT_Bool use_kerning; -FT_UInt previous; -int pen_x, pen_y, n; - -TGlyph glyphs[MAX_GLYPHS]; <span class="comment">/* glyphs table */</span> -PGlyph glyph; <span class="comment">/* current glyph in table */</span> -FT_UInt num_glyphs; - - -... initialize library ... -... create face object ... -... set character size ... - -pen_x = 0; <span class="comment">/* start at (0,0) */</span> -pen_y = 0; - -num_glyphs = 0; -use_kerning = FT_HAS_KERNING( face ); -previous = 0; - -glyph = glyphs; -for ( n = 0; n < num_chars; n++ ) -{ - glyph->index = FT_Get_Char_Index( face, text[n] ); - - if ( use_kerning && previous && glyph->index ) - { - FT_Vector delta; - - - FT_Get_Kerning( face, previous, glyph->index, - FT_KERNING_MODE_DEFAULT, &delta ); - - pen_x += delta.x >> 6; - } - - <span class="comment">/* store current pen position */</span> - glyph->pos.x = pen_x; - glyph->pos.y = pen_y; - - error = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT ); - if ( error ) continue; - - error = FT_Get_Glyph( face->glyph, &glyph->image ); - if ( error ) continue; - - <span class="comment">/* translate the glyph image now */</span> - FT_Glyph_Transform( glyph->image, 0, &glyph->pos ); - - pen_x += slot->advance.x >> 6; - previous = glyph->index; - - <span class="comment">/* increment number of glyphs */</span> - glyph++; -} - -<span class="comment">/* count number of glyphs loaded */</span> -num_glyphs = glyph - glyphs;</pre> - - <p>Note that translating glyphs now has several advantages. - The first one is that we don't need to translate the glyph - bbox when we compute the string's bounding box.</p> - - <pre> -void compute_string_bbox( FT_BBox *abbox ) -{ - FT_BBox bbox; - - - bbox.xMin = bbox.yMin = 32000; - bbox.xMax = bbox.yMax = -32000; - - for ( n = 0; n < num_glyphs; n++ ) - { - FT_BBox glyph_bbox; - - - FT_Glyph_Get_CBox( glyphs[n], ft_glyph_bbox_pixels, - &glyph_bbox ); - - if (glyph_bbox.xMin < bbox.xMin) - bbox.xMin = glyph_bbox.xMin; - - if (glyph_bbox.yMin < bbox.yMin) - bbox.yMin = glyph_bbox.yMin; - - if (glyph_bbox.xMax > bbox.xMax) - bbox.xMax = glyph_bbox.xMax; - - if (glyph_bbox.yMax > bbox.yMax) - bbox.yMax = glyph_bbox.yMax; - } - - if ( bbox.xMin > bbox.xMax ) - { - bbox.xMin = 0; - bbox.yMin = 0; - bbox.xMax = 0; - bbox.yMax = 0; - } - - *abbox = bbox; -}</pre> - - <p>With the above modifications, - the <code>compute_string_bbox</code> function can now - compute the bounding box of a transformed glyph string, - which allows further code simplications.</p> - - <pre> -FT_BBox bbox; -FT_Matrix matrix; -FT_Vector delta; - - -... load glyph sequence ... -... set up `matrix' and `delta' ... - -<span class="comment">/* transform glyphs */</span> -for ( n = 0; n < num_glyphs; n++ ) - FT_Glyph_Transform( glyphs[n].image, &matrix, &delta ); - -<span class="comment">/* compute bounding box of transformed glyphs */</span> -compute_string_bbox( &bbox );</pre> - - <h4>b. Rendering a Transformed Glyph Sequence</h4> - - <p>However, directly transforming the glyphs in our sequence - is not a good idea if we want to reuse them in order to - draw the text string with various angles or - transformations. It is better to perform the affine - transformation just before the glyph is rendered.</p> - - <pre> -FT_Vector start; -FT_Matrix matrix; - -FT_Glyph image; -FT_Vector pen; -FT_BBox bbox; - - -<span class="comment">/* get bbox of original glyph sequence */</span> -compute_string_bbox( &string_bbox ); - -<span class="comment">/* compute string dimensions in integer pixels */</span> -string_width = (string_bbox.xMax - string_bbox.xMin) / 64; -string_height = (string_bbox.yMax - string_bbox.yMin) / 64; - -<span class="comment">/* set up start position in 26.6 Cartesian space */</span> -start.x = ( ( my_target_width - string_width ) / 2 ) * 64; -start.y = ( ( my_target_height - string_height ) / 2 ) * 64; - -<span class="comment">/* set up transform (a rotation here) */</span> -matrix.xx = (FT_Fixed)( cos( angle ) * 0x10000L ); -matrix.xy = (FT_Fixed)(-sin( angle ) * 0x10000L ); -matrix.yx = (FT_Fixed)( sin( angle ) * 0x10000L ); -matrix.yy = (FT_Fixed)( cos( angle ) * 0x10000L ); - -pen = start; - -for ( n = 0; n < num_glyphs; n++ ) -{ - <span class="comment">/* create a copy of the original glyph */</span> - error = FT_Glyph_Copy( glyphs[n].image, &image ); - if ( error ) continue; - - <span class="comment">/* transform copy (this will also translate it to the */</span> - <span class="comment">/* correct position */</span> - FT_Glyph_Transform( image, &matrix, &pen ); - - <span class="comment">/* check bounding box; if the transformed glyph image */</span> - <span class="comment">/* is not in our target surface, we can avoid rendering it */</span> - FT_Glyph_Get_CBox( image, ft_glyph_bbox_pixels, &bbox ); - if ( bbox.xMax <= 0 || bbox.xMin >= my_target_width || - bbox.yMax <= 0 || bbox.yMin >= my_target_height ) - continue; - - <span class="comment">/* convert glyph image to bitmap (destroy the glyph copy!) */</span> - error = FT_Glyph_To_Bitmap( - &image, - FT_RENDER_MODE_NORMAL, - 0, <span class="comment">/* no additional translation */</span> - 1 ); <span class="comment">/* destroy copy in "image" */</span> - if ( !error ) - { - FT_BitmapGlyph bit = (FT_BitmapGlyph)image; - - - my_draw_bitmap( bit->bitmap, - bit->left, - my_target_height - bit->top ); - - <span class="comment">/* increment pen position -- */</span> - <span class="comment">/* we don't have access to a slot structure, */</span> - <span class="comment">/* so we have to use advances from glyph structure */</span> - <span class="comment">/* (which are in 16.16 fixed float format) */</span> - pen.x += image.advance.x >> 10; - pen.y += image.advance.y >> 10; - - FT_Done_Glyph( image ); - } -}</pre> - - <p>There are a few changes compared to the original version - of this code.</p> - - <ul> - <li>We keep the original glyph images untouched; instead, - we transform a copy.</li> - - <li>We perform clipping computations in order to avoid - rendering and drawing glyphs that are not within our - target surface.</li> - - <li>We always destroy the copy when calling - <code>FT_Glyph_To_Bitmap</code> in order to get rid of - the transformed scalable image. Note that the image is - not destroyed if the function returns an error code - (which is why <code>FT_Done_Glyph</code> is only called - within the compound statement).</li> - - <li>The translation of the glyph sequence to the start pen - position is integrated into the call - to <code>FT_Glyph_Transform</code> instead - of <code>FT_Glyph_To_Bitmap</code>.</li> - </ul> - - <p>It is possible to call this function several times to - render the string with different angles, or even change - the way <code>start</code> is computed in order to move it - to different place.</p> - - <p>This code is the basis of the FreeType 2 - demonstration program - named <a href="http://git.savannah.gnu.org/cgit/freetype/freetype2-demos.git/tree/src/ftstring.c"><code>ftstring.c</code></a>. - It could be easily extended to perform advanced text - layout or word-wrapping in the first part, without - changing the second one.</p> - - <p>Note, however, that a normal implementation would use a - glyph cache in order to reduce memory needs. For example, - let us assume that our text string is - ‘FreeType’. We would store three identical - glyph images in our table for the letter ‘e’, - which isn't optimal (especially when you consider longer - lines of text, or even whole pages).</p> - - <p>A FreeType demo program that shows how glyph caching can - be implemented - is <a href="http://git.savannah.gnu.org/cgit/freetype/freetype2-demos.git/tree/src/ftview.c"><code>ftview.c</code></a>. - In general, ‘ftview’ is the main program used - by the FreeType developer team to check the validity of - loading, parsing, and rendering fonts.</p> - - <p>Another very useful demo program - is <a href="http://git.savannah.gnu.org/cgit/freetype/freetype2-demos.git/tree/src/ftdiff.c"><code>ftdiff.c</code></a>, - demonstrating the use and the optical results of the - various rendering and hinting modes provided by FreeType. - In particular, it also demonstrates how to do sub-pixel - positioning (for unhinted glyphs and ‘light’ - hinting mode) – all code in this tutorial assumes - integer coordinates.</p> - - - <h3 id="section-6">6. Accessing Metrics in Design Font - Units, and Scaling Them</h3> - - <p>Scalable font formats usually store a single vectorial - image, called an <em>outline</em>, for each glyph in a - face. Each outline is defined in an abstract grid called - the <em>design space</em>, with coordinates expressed in - <em>font units</em>. When a glyph image is loaded, the - font driver usually scales the outline to device space - according to the current character pixel size found in - an <a href="../reference/ft2-base_interface.html#ft_size"><code>FT_Size</code></a> - object. The driver may also modify the scaled outline in - order to significantly improve its appearance on a - pixel-based surface (a process known as <em>hinting</em> - or <em>grid-fitting</em>).</p> - - <p>This section describes how design coordinates are scaled - to the device space, and how to read glyph outlines and - metrics in font units. This is important for a number of - things.</p> - - <ul> - <li>‘True’ WYSIWYG text layout.</li> - <li>Accessing font content for conversion or analysis - purposes.</li> - </ul> - - <h4>a. Scaling Distances to Device Space</h4> - - <p>Design coordinates are scaled to the device space using a - simple scaling transformation whose coefficients are - computed with the help of the <em>character pixel - size</em>.</p> - - <pre class="example"> - device_x = design_x * x_scale - device_y = design_y * y_scale - - x_scale = pixel_size_x / EM_size - y_scale = pixel_size_y / EM_size</pre> - - <p>Here, the value <code>EM_size</code> is font-specific and - corresponds to the size of an abstract square of the - design space (called the <em>EM</em>), which is used by - font designers to create glyph images. It is thus - expressed in font units. It is also accessible directly - for scalable font formats - as <code>face->units_per_EM</code>. You should check - that a font face contains scalable glyph images by using - the <code>FT_IS_SCALABLE</code> macro, which returns true - if appropriate.</p> - - <p>When you call the - function <a href="../reference/ft2-base_interface.html#ft_set_pixel_sizes"><code>FT_Set_Pixel_Sizes</code></a>, - you are specifying integer values - of <code>pixel_size_x</code> and - <code>pixel_size_y</code> FreeType shall use. The library - will immediately compute the values - of <code>x_scale</code> and - <code>y_scale</code>.</p> - - <p>When you call the - function <a href="../reference/ft2-base_interface.html#ft_set_char_size"><code>FT_Set_Char_Size</code></a>, - you are specifying the character size in - physical <em>points</em>, which is used, along with the - device's resolutions, to compute the character pixel size - and the corresponding scaling factors. Here, the scaling - factors can correspond to fractional ppem values.</p> - - <p>Note that after calling any of these two functions, you - can access the values of the character pixel size and - scaling factors as fields of - the <code>face->size->metrics</code> structure.</p> - - <dl> - <dt>x_ppem</dt> - <dd>The field name stands for ‘x pixels per - EM’; this is the horizontal size rounded to - integer pixels of the EM square, which also is - the <em>horizontal character pixel size</em>, - called <code>pixel_size_x</code> in the above - example.</dd> - - <dt>y_ppem</dt> - <dd>The field name stands for ‘y pixels per - EM’; this is the vertical size rounded to integer - pixels of the EM square, which also is the <em>vertical - character pixel size</em>, - called <code>pixel_size_y</code> in the above - example.</dd> - - <dt>x_scale</dt> - <dd>This is a 16.16 fixed-point scale to directly scale - horizontal distances from design space to 1/64th of - device pixels.</dd> - - <dt>y_scale</dt> - <dd>This is a 16.16 fixed-point scale to directly scale - vertical distances from design space to 1/64th of device - pixels.</dd> - </dl> - - <p>You can scale a distance expressed in font units to 26.6 - pixel format directly with the help of - the <a href="../reference/ft2-computations.html#ft_mulfix"><code>FT_MulFix</code></a> - function.</p> - - <pre> -<span class="comment">/* convert design distances to 1/64th of pixels */</span> -pixels_x = FT_MulFix( design_x, face->size->metrics.x_scale ); -pixels_y = FT_MulFix( design_y, face->size->metrics.y_scale );</pre> - - <p>Alternatively, you can also scale the value directly by - using doubles.</p> - - <pre> -FT_Size_Metrics* metrics = &face->size->metrics; <span class="comment">/* shortcut */</span> -double pixels_x, pixels_y; -double x_scale, y_scale; - - -<span class="comment">/* compute floating point scale factors */</span> -x_scale = face->size->metrics.x_scale / 65536.0; -y_scale = face->size->metrics.y_scale / 65536.0; - -<span class="comment">/* convert design distances to floating point pixels */</span> -pixels_x = design_x * x_scale; -pixels_y = design_y * y_scale;</pre> - - <h4>b. Accessing Design Metrics (Glyph & Global)</h4> - - <p>You can access glyph metrics in font units simply by - specifying the <code>FT_LOAD_NO_SCALE</code> bit flag - in <code>FT_Load_Glyph</code> - or <code>FT_Load_Char</code>. The metrics returned - in <code>face->glyph->metrics</code> will all be in - font units.</p> - - <p>You can access unscaled kerning data using the - <code>FT_KERNING_MODE_UNSCALED</code> mode.</p> - - <p>Finally, a few global metrics are available directly in - font units as fields of the <code>FT_Face</code> handle, - as described in <a href="#section-3">section 3</a> of - this part.</p> - - - <h3 id="conclusion">Conclusion</h3> - - <p>This is the end of the second part of the FreeType - tutorial. You are now able to access glyph metrics, - manage glyph images, and render text much more - intelligently (kerning, measuring, transforming & - caching); this is sufficient knowledge to build a pretty - decent text service on top of FreeType.</p> - - <p>The demo programs in the ‘ft2demos’ bundle - (especially ‘ftview’) are a kind of reference - implementation, and are a good resource to turn to for - answers. They also show how to use additional features, - such as the glyph stroker and cache.</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Tutorial</a> - </li> - <li class="tertiary"> - <a href="step1.html">Simple Glyph Loading</a> - </li> - <li class="tertiary"> - <a href="step2.html" class="current">Managing Glyphs</a> - </li> - <li class="tertiary"> - <a href="step3.html">Examples</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> diff --git a/lib/freetype/docs/tutorial/step3.html b/lib/freetype/docs/tutorial/step3.html deleted file mode 100644 index 2eaf920a9..000000000 --- a/lib/freetype/docs/tutorial/step3.html +++ /dev/null @@ -1,189 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> - -<head> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"> - <meta http-equiv="Content-Style-Type" - content="text/css"> - <meta http-equiv="Content-Script-Type" - content="text/javascript"> - <meta name="description" - content="FreeType Documentation"> - <meta name="Author" - content="David Turner"> - - <link rel="icon" - href="../image/favicon_-90.ico"> - <link rel="shortcut icon" - href="../image/favicon_-90.ico"> - <link rel="stylesheet" - type="text/css" - href="../css/freetype2_-90.css"> - - <script type="text/javascript" - src="../../../js/jquery-1.11.0.min.js"> - </script> - <script type="text/javascript" - src="../../../js/jquery.ba-resize.min.js"> - </script> - <script type="text/javascript" - src="../../../js/freetype2.js"> - </script> - - <title>FreeType Tutorial / III</title> -</head> - - -<body> - -<div id="top" - class="bar"> - <h1><a href="http://freetype.org/index.html">FreeType</a> - Tutorial / III</h1> -</div> - - -<div id="wrapper"> - -<div class="colmask leftmenu"> - <div class="colright"> - <div class="col1wrap"> - <div class="col1"> - - - <!-- ************************************************** --> - - <div id="examples"> - <h2>III. Examples</h2> - - <p>For completeness, here again a link to - the <a href="example1.c">example</a> used and explained in - the <a href="step1.html">first part of the - tutorial</a>.</p> - - <p><a href="mailto:erik@timetrap.se">Erik Möller</a> - contributed a very nice C++ example that shows renderer - callbacks in action to draw a coloured glyph with a - differently coloured outline. The source code can be - found <a href="example2.cpp">here</a>.</p> - - <p><a href="example3.cpp">Another example</a> demonstrates - how to use FreeType's stand-alone B/W rasterizer, - <tt>ftraster.c</tt>. You need files from FreeType version - 2.3.10 or newer.</p> - - <p><a href="mailto:gsmiko@gmail.com">Róbert Márki</a> - contributed a small - <a href="example4.cpp">Qt demonstration program</a> - (together with its <a href="example4.pro">qmake file</a>) - that shows both direct rendering with a callback and - rendering with a buffer, yielding the same result. You - need FreeType 2.4.3 or newer.</p> - - <p><a href="example5.cpp">Here</a> is some simple C++ code - (contributed - by <a href="https://www.staticjobs.com">Static Jobs - LLC</a>) that - uses <a href="../reference/ft2-outline_processing.html#ft_outline_decompose"><tt>FT_Outline_Decompose</tt></a> - to convert a glyph outline to the SVG format. As an - example, here is the <a href="example5.svg">resulting - file</a> of the call</p> - - <pre> -example5 LiberationSerif-Bold.ttf @ > example5.svg</pre> - - <p>(you can find the Liberation font - family <a href="https://fedorahosted.org/liberation-fonts/">here</a>).</p> - </div> - - <!-- ************************************************** --> - - <div class="updated"> - <p>Last update: 13-Feb-2018</p> - </div> - </div> - </div> - - - <!-- ************************************************** --> - - <div class="col2"> - </div> - </div> -</div> - - -<!-- ************************************************** --> - -<div id="TOC"> - <ul> - <li class="funding"> - <form action="https://www.paypal.com/cgi-bin/webscr" - method="post" - target="_top"> - <input type="hidden" - name="cmd" - value="_s-xclick"> - <input type="hidden" - name="hosted_button_id" - value="SK827YKEALMT4"> - <input type="image" - src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" - name="submit" - alt="PayPal - The safer, easier way to pay online!"> - <img alt="" - border="0" - src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" - width="1" - height="1"> - </form> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html">Home</a> - </li> - <li class="primary"> - <a href="http://freetype.org/index.html#news">News</a> - </li> - <li class="primary"> - <a href="../index.html">Overview</a> - </li> - <li class="primary"> - <a href="../documentation.html">Documentation</a> - </li> - <li class="primary"> - <a href="http://freetype.org/developer.html">Development</a> - </li> - <li class="primary"> - <a href="http://freetype.org/contact.html" - class="emphasis">Contact</a> - </li> - - <li> - <!-- separate primary from secondary entries --> - </li> - - <li class="secondary"> - <a href="index.html">FreeType Tutorial</a> - </li> - <li class="tertiary"> - <a href="step1.html">Simple Glyph Loading</a> - </li> - <li class="tertiary"> - <a href="step2.html">Managing Glyphs</a> - </li> - <li class="tertiary"> - <a href="step3.html" class="current">Examples</a> - </li> - </ul> -</div> - -</div> <!-- id="wrapper" --> - -<div id="TOC-bottom"> -</div> - -</body> -</html> |