void CL_GlyphCache::insert_glyph(CL_FontEngine *font_engine, CL_GraphicContext &gc, const CL_StringRef &text) { for (CL_String::size_type p = 0; p < text.length(); ++p) { insert_glyph(font_engine, gc, text[p]); } }
void GlyphCache::insert_glyph(FontEngine *font_engine, GraphicContext &gc, const std::string &text) { for (std::string::size_type p = 0; p < text.length(); ++p) { insert_glyph(font_engine, gc, text[p]); } }
void CL_GlyphCache::insert_glyph(CL_FontEngine *font_engine, CL_GraphicContext &gc, int glyph) { if (enable_subpixel) { CL_FontPixelBuffer pb = font_engine->get_font_glyph_subpixel(glyph); if (pb.glyph) // Ignore invalid glyphs { insert_glyph(gc, pb); } } else { CL_FontPixelBuffer pb = font_engine->get_font_glyph_standard(glyph, anti_alias); if (pb.glyph) // Ignore invalid glyphs { insert_glyph(gc, pb); } } }
CL_Font_TextureGlyph *CL_GlyphCache::get_glyph(CL_FontEngine *font_engine, CL_GraphicContext &gc, unsigned int glyph) { std::vector< CL_Font_TextureGlyph * >::size_type size = glyph_list.size(); for (int cnt=0; cnt<size; cnt++) { if (glyph_list[cnt]->glyph == glyph) return &(*glyph_list[cnt]); } // If glyph does not exist, create one automatically insert_glyph(font_engine, gc, glyph); // Search for the glyph again size = glyph_list.size(); for (int cnt=0; cnt<size; cnt++) { if (glyph_list[cnt]->glyph == glyph) return &(*glyph_list[cnt]); } return NULL; }
Font_TextureGlyph *GlyphCache::get_glyph(const CanvasPtr &canvas, FontEngine *font_engine, unsigned int glyph) { auto size = glyph_list.size(); for (int cnt = 0; cnt < size; cnt++) { if (glyph_list[cnt]->glyph == glyph) return &(*glyph_list[cnt]); } // If glyph does not exist, create one automatically FontPixelBuffer pb = font_engine->get_font_glyph(glyph); if (pb.glyph) // Ignore invalid glyphs insert_glyph(canvas, pb); // Search for the glyph again size = glyph_list.size(); for (int cnt = 0; cnt < size; cnt++) { if (glyph_list[cnt]->glyph == glyph) return &(*glyph_list[cnt]); } return nullptr; }