MCPcopy Index your code
hub / github.com/MapServer/MapServer / msDrawTextLine

Function msDrawTextLine

maprendering.c:845–892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

843}
844
845int msDrawTextLine(imageObj *image, char *string, labelObj *label, labelPathObj *labelpath, fontSetObj *fontset, double scalefactor)
846{
847 int nReturnVal = -1;
848 if(image) {
849 if (MS_RENDERER_PLUGIN(image->format)) {
850
851 rendererVTableObj *renderer = image->format->vtable;
852 labelStyleObj s;
853 if (!string || !strlen(string))
854 return (0); // not errors, just don't want to do anything
855 computeLabelStyle(&s, label, fontset, scalefactor);
856 if (label->type == MS_TRUETYPE) {
857 const char* string_ptr = string;
858 int i;
859 double x, y;
860 char glyph[11];
861 if(MS_VALID_COLOR(label->outlinecolor)) {
862 s.outlinecolor = &(label->outlinecolor);
863 s.outlinewidth = s.size/label->size * label->outlinewidth;
864 for (i = 0; i < labelpath->path.numpoints; i++) {
865 if (msGetNextGlyph(&string_ptr, glyph) == -1)
866 break; /* Premature end of string??? */
867 s.rotation = labelpath->angles[i];
868 x = labelpath->path.point[i].x;
869 y = labelpath->path.point[i].y;
870 renderer->renderGlyphs(image, x, y, &s, glyph);
871 }
872 string_ptr = string;
873 }
874 s.outlinecolor = NULL;
875 s.outlinewidth = 0;
876 s.color = &(label->color);
877 for (i = 0; i < labelpath->path.numpoints; i++) {
878 if (msGetNextGlyph(&string_ptr, glyph) == -1)
879 break; /* Premature end of string??? */
880
881 s.rotation = labelpath->angles[i];
882 x = labelpath->path.point[i].x;
883 y = labelpath->path.point[i].y;
884
885 renderer->renderGlyphs(image, x, y, &s, glyph);
886 }
887 }
888 }
889 }
890
891 return nReturnVal;
892}
893
894
895/************************************************************************/

Callers 1

msDrawLabelCacheFunction · 0.85

Calls 3

computeLabelStyleFunction · 0.85
msGetNextGlyphFunction · 0.85
renderGlyphsMethod · 0.45

Tested by

no test coverage detected