MCPcopy Create free account
hub / github.com/MapServer/MapServer / agg2RenderTruetypeSymbol

Function agg2RenderTruetypeSymbol

mapagg.cpp:569–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567}
568
569int agg2RenderTruetypeSymbol(imageObj *img, double x, double y,
570 symbolObj *symbol, symbolStyleObj * style) {
571 AGG2Renderer *r = AGG_RENDERER(img);
572 aggRendererCache *cache = (aggRendererCache*)MS_RENDERER_CACHE(MS_IMAGE_RENDERER(img));
573 if (!cache->m_feng.load_font(symbol->full_font_path, 0, mapserver::glyph_ren_outline)) {
574 msSetError(MS_TTFERR, "AGG error loading font (%s)", "agg2RenderTruetypeSymbol()", symbol->full_font_path);
575 return MS_FAILURE;
576 }
577
578 int unicode;
579 cache->m_feng.hinting(true);
580 cache->m_feng.height(style->scale);
581 cache->m_feng.resolution(96);
582 cache->m_feng.flip_y(true);
583 font_curve_type m_curves(cache->m_fman.path_adaptor());
584
585 msUTF8ToUniChar(symbol->character, &unicode);
586 const mapserver::glyph_cache* glyph = cache->m_fman.glyph(unicode);
587 double ox = (glyph->bounds.x1 + glyph->bounds.x2) / 2.;
588 double oy = (glyph->bounds.y1 + glyph->bounds.y2) / 2.;
589
590 mapserver::trans_affine mtx = mapserver::trans_affine_translation(-ox, -oy);
591 if(style->rotation)
592 mtx *= mapserver::trans_affine_rotation(-style->rotation);
593 mtx *= mapserver::trans_affine_translation(x, y);
594
595 mapserver::path_storage glyphs;
596
597 cache->m_fman.init_embedded_adaptors(glyph, 0,0);
598 mapserver::conv_transform<font_curve_type, mapserver::trans_affine> trans_c(m_curves, mtx);
599 glyphs.concat_path(trans_c);
600 if (style->outlinecolor) {
601 r->m_rasterizer_aa.reset();
602 r->m_rasterizer_aa.filling_rule(mapserver::fill_non_zero);
603 mapserver::conv_contour<mapserver::path_storage> cc(glyphs);
604 cc.auto_detect_orientation(true);
605 cc.width(style->outlinewidth + 1);
606 r->m_rasterizer_aa.add_path(cc);
607 r->m_renderer_scanline.color(aggColor(style->outlinecolor));
608 mapserver::render_scanlines(r->m_rasterizer_aa, r->sl_line, r->m_renderer_scanline);
609 }
610
611 if (style->color) {
612 r->m_rasterizer_aa.reset();
613 r->m_rasterizer_aa.filling_rule(mapserver::fill_non_zero);
614 r->m_rasterizer_aa.add_path(glyphs);
615 r->m_renderer_scanline.color(aggColor(style->color));
616 mapserver::render_scanlines(r->m_rasterizer_aa, r->sl_line, r->m_renderer_scanline);
617 }
618 return MS_SUCCESS;
619
620}
621
622int agg2RenderTile(imageObj *img, imageObj *tile, double x, double y) {
623 /*

Callers

nothing calls this directly

Calls 15

msSetErrorFunction · 0.85
msUTF8ToUniCharFunction · 0.85
render_scanlinesFunction · 0.85
glyphMethod · 0.80
concat_pathMethod · 0.80
load_fontMethod · 0.45
hintingMethod · 0.45
heightMethod · 0.45
resolutionMethod · 0.45

Tested by

no test coverage detected