/** Traces all glyphs of the current font and stores them in the cache. If caching is disabled, nothing happens. * @param[in] includeCached if true, glyphs already cached are traced again * @param[in] cb optional callback methods called by the tracer * @return number of glyphs traced */ int PhysicalFont::traceAllGlyphs (bool includeCached, GFGlyphTracer::Callback *cb) const { int count = 0; if (type() == MF && CACHE_PATH) { if (const FontMetrics *metrics = getMetrics()) { int fchar = metrics->firstChar(); int lchar = metrics->lastChar(); string gfname; Glyph glyph; if (createGF(gfname)) { _cache.read(name().c_str(), CACHE_PATH); double ds = getMetrics() ? getMetrics()->getDesignSize() : 1; GFGlyphTracer tracer(gfname, unitsPerEm()/ds, cb); tracer.setGlyph(glyph); for (int i=fchar; i <= lchar; i++) { if (includeCached || !_cache.getGlyph(i)) { glyph.clear(); tracer.executeChar(i); glyph.closeOpenSubPaths(); _cache.setGlyph(i, glyph); ++count; } } _cache.write(CACHE_PATH); } } } return count; }