~ubuntu-branches/ubuntu/trusty/openscenegraph/trusty

« back to all changes in this revision

Viewing changes to OpenSceneGraph/src/osgPlugins/txf/TXFFont.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cyril Brulebois
  • Date: 2008-07-29 04:34:38 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20080729043438-no1h9h0dpsrlzp1y
* Non-maintainer upload.
* No longer try to detect (using /proc/cpuinfo when available) how many
  CPUs are available, fixing the FTBFS (due to -j0) on various platforms
  (Closes: #477353). The right way to do it is to support parallel=n in
  DEB_BUILD_OPTIONS (see Debian Policy §4.9.1), and adequate support has
  been implemented.
* Add patch to fix FTBFS due to the build system now refusing to handle
  whitespaces (Policy CMP0004 say the logs), thanks to Andreas Putzo who
  provided it (Closes: #482239):
   - debian/patches/fix-cmp0004-build-failure.dpatch
* Remove myself from Uploaders, as requested a while ago, done by Luk in
  his 2.2.0-2.1 NMU, which was never acknowledged.

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
    return _filename;
82
82
}
83
83
 
84
 
void
85
 
TXFFont::setFontResolution(unsigned int, unsigned int)
86
 
{
87
 
    osg::notify(osg::INFO) << "TXFFont::setFontResolution(,) call is ignored." << std::endl;
88
 
}
89
 
 
90
84
osgText::Font::Glyph*
91
 
TXFFont::getGlyph(unsigned int charcode)
 
85
TXFFont::getGlyph(const osgText::FontResolution&, unsigned int charcode)
92
86
{
93
87
    GlyphMap::iterator i = _chars.find(charcode);
94
88
    if (i != _chars.end())
102
96
        if (i != _chars.end())
103
97
        {
104
98
            _chars[charcode] = i->second;
105
 
            addGlyph(i->second->s(), i->second->t(), charcode, i->second.get());
 
99
            addGlyph(osgText::FontResolution(i->second->s(), i->second->t()), charcode, i->second.get());
106
100
            return i->second.get();
107
101
        }
108
102
    }
112
106
        if (i != _chars.end())
113
107
        {
114
108
            _chars[charcode] = i->second;
115
 
            addGlyph(i->second->s(), i->second->t(), charcode, i->second.get());
 
109
            addGlyph(osgText::FontResolution(i->second->s(), i->second->t()), charcode, i->second.get());
116
110
            return i->second.get();
117
111
        }
118
112
    }
127
121
}
128
122
 
129
123
osg::Vec2
130
 
TXFFont::getKerning(unsigned int, unsigned int, osgText::KerningType)
 
124
TXFFont::getKerning(const osgText::FontResolution&, unsigned int, unsigned int, osgText::KerningType)
131
125
{
132
126
    return osg::Vec2(0, 0);
133
127
}
159
153
 
160
154
    unsigned w = texwidth;
161
155
    unsigned h = texheight;
 
156
    
 
157
    osgText::FontResolution fontResolution(maxheight, maxheight);
162
158
 
163
159
    std::vector<GlyphData> glyphs;
164
160
    for (unsigned i = 0; i < num_glyphs; ++i)
179
175
        glyphs.push_back(glyphData);
180
176
    }
181
177
 
182
 
    setFontWidth(maxwidth);
183
 
    setFontHeight(maxheight);
184
 
 
185
178
    unsigned ntexels = w * h;
186
179
    osg::ref_ptr<osg::Image> image = new osg::Image;
187
180
    image->allocateImage(w, h, 1, GL_ALPHA, GL_UNSIGNED_BYTE);
274
267
                                            - glyphs[i].height*texToVertY));
275
268
 
276
269
        _chars[glyphs[i].ch] = glyph;
277
 
        addGlyph(width, height, glyphs[i].ch, glyph);
 
270
        addGlyph(fontResolution, glyphs[i].ch, glyph);
278
271
    }
279
272
 
280
273
    // insert a trivial blank character
294
287
        }
295
288
    }
296
289
 
297
 
    glyph->setHorizontalAdvance(0.5f*_facade->getFontHeight());
298
 
    glyph->setHorizontalBearing(osg::Vec2(0, 0));
299
 
    glyph->setVerticalAdvance(_facade->getFontHeight());
300
 
    glyph->setVerticalBearing(osg::Vec2(0, 0));
 
290
    glyph->setHorizontalAdvance(0.5f*float(fontResolution.second));
 
291
    glyph->setHorizontalBearing(osg::Vec2(0.0f, 0.0f));
 
292
    glyph->setVerticalAdvance(float(fontResolution.second));
 
293
    glyph->setVerticalBearing(osg::Vec2(0.0f, 0.0f));
301
294
    _chars[' '] = glyph;
302
 
    addGlyph(width, height, ' ', glyph);
 
295
    addGlyph(fontResolution, ' ', glyph);
303
296
 
304
297
    return true;
305
298
}