| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
| <title>FTGL: FTGlyphContainer.cpp Source File</title> |
| <link href="doxygen.css" rel="stylesheet" type="text/css"> |
| </head><body> |
| <!-- Generated by Doxygen 1.3.6 --> |
| <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div> |
| <h1>FTGlyphContainer.cpp</h1><a href="FTGlyphContainer_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#include "<a class="code" href="FTGlyphContainer_8h.html">FTGlyphContainer.h</a>"</span> |
| 00002 <span class="preprocessor">#include "<a class="code" href="FTGlyph_8h.html">FTGlyph.h</a>"</span> |
| 00003 <span class="preprocessor">#include "<a class="code" href="FTFace_8h.html">FTFace.h</a>"</span> |
| 00004 <span class="preprocessor">#include "<a class="code" href="FTCharmap_8h.html">FTCharmap.h</a>"</span> |
| 00005 |
| 00006 |
| <a name="l00007"></a><a class="code" href="classFTGlyphContainer.html#a0">00007</a> <a class="code" href="classFTGlyphContainer.html#a0">FTGlyphContainer::FTGlyphContainer</a>( <a class="code" href="classFTFace.html">FTFace</a>* f) |
| 00008 : face(f), |
| 00009 err(0) |
| 00010 { |
| 00011 glyphs.<a class="code" href="classFTVector.html#a14">push_back</a>( NULL); |
| 00012 charMap = <span class="keyword">new</span> <a class="code" href="classFTCharmap.html">FTCharmap</a>( face); |
| 00013 } |
| 00014 |
| 00015 |
| <a name="l00016"></a><a class="code" href="classFTGlyphContainer.html#a1">00016</a> <a class="code" href="classFTGlyphContainer.html#a1">FTGlyphContainer::~FTGlyphContainer</a>() |
| 00017 { |
| 00018 GlyphVector::iterator glyphIterator; |
| 00019 <span class="keywordflow">for</span>( glyphIterator = glyphs.<a class="code" href="classFTVector.html#a5">begin</a>(); glyphIterator != glyphs.<a class="code" href="classFTVector.html#a7">end</a>(); ++glyphIterator) |
| 00020 { |
| 00021 <span class="keyword">delete</span> *glyphIterator; |
| 00022 } |
| 00023 |
| 00024 glyphs.<a class="code" href="classFTVector.html#a12">clear</a>(); |
| 00025 <span class="keyword">delete</span> charMap; |
| 00026 } |
| 00027 |
| 00028 |
| <a name="l00029"></a><a class="code" href="classFTGlyphContainer.html#a2">00029</a> <span class="keywordtype">bool</span> <a class="code" href="classFTGlyphContainer.html#a2">FTGlyphContainer::CharMap</a>( FT_Encoding encoding) |
| 00030 { |
| 00031 <span class="keywordtype">bool</span> result = charMap-><a class="code" href="classFTCharmap.html#a3">CharMap</a>( encoding); |
| 00032 err = charMap-><a class="code" href="classFTCharmap.html#a7">Error</a>(); |
| 00033 <span class="keywordflow">return</span> result; |
| 00034 } |
| 00035 |
| 00036 |
| <a name="l00037"></a><a class="code" href="classFTGlyphContainer.html#a3">00037</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classFTGlyphContainer.html#a3">FTGlyphContainer::FontIndex</a>( <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> characterCode)<span class="keyword"> const</span> |
| 00038 <span class="keyword"></span>{ |
| 00039 <span class="keywordflow">return</span> charMap-><a class="code" href="classFTCharmap.html#a5">FontIndex</a>( characterCode); |
| 00040 } |
| 00041 |
| 00042 |
| <a name="l00043"></a><a class="code" href="classFTGlyphContainer.html#a4">00043</a> <span class="keywordtype">void</span> <a class="code" href="classFTGlyphContainer.html#a4">FTGlyphContainer::Add</a>( <a class="code" href="classFTGlyph.html">FTGlyph</a>* tempGlyph, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> characterCode) |
| 00044 { |
| 00045 charMap-><a class="code" href="classFTCharmap.html#a6">InsertIndex</a>( characterCode, glyphs.<a class="code" href="classFTVector.html#a3">size</a>()); |
| 00046 glyphs.<a class="code" href="classFTVector.html#a14">push_back</a>( tempGlyph); |
| 00047 } |
| 00048 |
| 00049 |
| <a name="l00050"></a><a class="code" href="classFTGlyphContainer.html#a5">00050</a> <span class="keyword">const</span> <a class="code" href="classFTGlyph.html">FTGlyph</a>* <span class="keyword">const</span> <a class="code" href="classFTGlyphContainer.html#a5">FTGlyphContainer::Glyph</a>( <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> characterCode)<span class="keyword"> const</span> |
| 00051 <span class="keyword"></span>{ |
| 00052 <span class="keywordtype">signed</span> <span class="keywordtype">int</span> index = charMap-><a class="code" href="classFTCharmap.html#a4">GlyphListIndex</a>( characterCode); |
| 00053 <span class="keywordflow">return</span> glyphs[index]; |
| 00054 } |
| 00055 |
| 00056 |
| <a name="l00057"></a><a class="code" href="classFTGlyphContainer.html#a6">00057</a> <a class="code" href="classFTBBox.html">FTBBox</a> <a class="code" href="classFTGlyphContainer.html#a6">FTGlyphContainer::BBox</a>( <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> characterCode)<span class="keyword"> const</span> |
| 00058 <span class="keyword"></span>{ |
| 00059 <span class="keywordflow">return</span> glyphs[charMap-><a class="code" href="classFTCharmap.html#a4">GlyphListIndex</a>( characterCode)]->BBox(); |
| 00060 } |
| 00061 |
| 00062 |
| <a name="l00063"></a><a class="code" href="classFTGlyphContainer.html#a7">00063</a> <span class="keywordtype">float</span> <a class="code" href="classFTGlyphContainer.html#a7">FTGlyphContainer::Advance</a>( <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> characterCode, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nextCharacterCode) |
| 00064 { |
| 00065 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> left = charMap-><a class="code" href="classFTCharmap.html#a5">FontIndex</a>( characterCode); |
| 00066 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> right = charMap-><a class="code" href="classFTCharmap.html#a5">FontIndex</a>( nextCharacterCode); |
| 00067 |
| 00068 <span class="keywordtype">float</span> width = face-><a class="code" href="classFTFace.html#a9">KernAdvance</a>( left, right).<a class="code" href="classFTPoint.html#a7">X</a>(); |
| 00069 width += glyphs[charMap-><a class="code" href="classFTCharmap.html#a4">GlyphListIndex</a>( characterCode)]->Advance().X(); |
| 00070 |
| 00071 <span class="keywordflow">return</span> width; |
| 00072 } |
| 00073 |
| 00074 |
| <a name="l00075"></a><a class="code" href="classFTGlyphContainer.html#a8">00075</a> <a class="code" href="classFTPoint.html">FTPoint</a> <a class="code" href="classFTGlyphContainer.html#a8">FTGlyphContainer::Render</a>( <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> characterCode, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nextCharacterCode, <a class="code" href="classFTPoint.html">FTPoint</a> penPosition) |
| 00076 { |
| 00077 <a class="code" href="classFTPoint.html">FTPoint</a> kernAdvance, advance; |
| 00078 |
| 00079 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> left = charMap-><a class="code" href="classFTCharmap.html#a5">FontIndex</a>( characterCode); |
| 00080 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> right = charMap-><a class="code" href="classFTCharmap.html#a5">FontIndex</a>( nextCharacterCode); |
| 00081 |
| 00082 kernAdvance = face-><a class="code" href="classFTFace.html#a9">KernAdvance</a>( left, right); |
| 00083 |
| 00084 <span class="keywordflow">if</span>( !face-><a class="code" href="classFTFace.html#a12">Error</a>()) |
| 00085 { |
| 00086 advance = glyphs[charMap-><a class="code" href="classFTCharmap.html#a4">GlyphListIndex</a>( characterCode)]->Render( penPosition); |
| 00087 } |
| 00088 |
| 00089 kernAdvance += advance; |
| 00090 <span class="keywordflow">return</span> kernAdvance; |
| 00091 } |
| </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Dec 5 22:24:06 2004 for FTGL by |
| <a href="http://www.doxygen.org/index.html"> |
| <img src="doxygen.png" alt="doxygen" align="middle" border=0 > |
| </a>1.3.6 </small></address> |
| </body> |
| </html> |