~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to extern/bFTGL/src/FTCharmap.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "FTFace.h"
 
2
#include "FTCharmap.h"
 
3
 
 
4
 
 
5
FTCharmap::FTCharmap( FTFace* face)
 
6
:   ftFace( *(face->Face())),
 
7
    err(0)
 
8
{
 
9
    if( !ftFace->charmap)
 
10
    {
 
11
        err = FT_Set_Charmap( ftFace, ftFace->charmaps[0]);
 
12
    }
 
13
    
 
14
    ftEncoding = ftFace->charmap->encoding;
 
15
}
 
16
 
 
17
 
 
18
FTCharmap::~FTCharmap()
 
19
{
 
20
    charMap.clear();
 
21
}
 
22
 
 
23
 
 
24
bool FTCharmap::CharMap( FT_Encoding encoding)
 
25
{
 
26
    if( ftEncoding == encoding)
 
27
    {
 
28
        return true;
 
29
    }
 
30
    
 
31
    err = FT_Select_Charmap( ftFace, encoding );
 
32
    
 
33
    if( !err)
 
34
    {
 
35
        ftEncoding = encoding;
 
36
    }
 
37
    else
 
38
    {
 
39
        ftEncoding = ft_encoding_none;
 
40
    }
 
41
        
 
42
    charMap.clear();
 
43
    return !err;
 
44
}
 
45
 
 
46
 
 
47
unsigned int FTCharmap::GlyphListIndex( unsigned int characterCode )
 
48
{
 
49
    return charMap.find( characterCode);
 
50
}
 
51
 
 
52
 
 
53
unsigned int FTCharmap::FontIndex( unsigned int characterCode )
 
54
{
 
55
    return FT_Get_Char_Index( ftFace, characterCode);
 
56
}
 
57
 
 
58
 
 
59
void FTCharmap::InsertIndex( const unsigned int characterCode, const unsigned int containerIndex)
 
60
{
 
61
    charMap.insert( characterCode, containerIndex);
 
62
}