Some issues in mitered Stroking

Check the output of the following code, Some lines are crossing the path.

Font font(T("Arial"), 320.0, Font::plain);

GlyphArrangement arr;
arr.addLineOfText(font, T("M"), 0, 0);

juce::PositionedGlyph glyph(arr.getGlyph(0));

float x = 0, y = 0, width = 0, height = 0;
juce::Path glyphFillPath;
glyphFillPath.getBounds(x, y, width, height);

Image* pImage = new Image(Image::ARGB, width + 128, height + 128, true);
Graphics g(*pImage);
int deltaX = (pImage->getWidth() - width)/2 - x;
int deltaY = (pImage->getHeight() - height)/2 - y;
g.fillPath(glyphFillPath, AffineTransform::translation(deltaX, deltaY));
g.strokePath(glyphFillPath, PathStrokeType(30.0, PathStrokeType::mitered ), AffineTransform::translation(deltaX, deltaY));

PNGImageFormat format;
FileOutputStream fos(File::createTempFile(T("Sample.png")));
format.writeImageToStream(*pImage, fos); 

It doesn’t look like there’s actually anything technically wrong with that - the maths is all doing its job correctly, but if you draw paths that are thicker than the width of the shape, of course you can expect to see a few bits overshooting! Try it with a thinner stroke and it looks fine to me.

But , Why stroked line is crossing only on the right side of “M” where as the left side is stroked on the path exactly.
It is happenning only for shapes like "V’ inverted “V”. That too only on mitered style.
Curved and Bevelled are not producing such lines even the Stroke thickness is more.
Is it the correct behavior of mitered.

I think that the two inner joints of the M are made up of slightly different points - most likely one of them has a double point on the curve where the path starts and ends, and this would create a different stroke outline. I really don’t think it’s a failure in the algorithm, just an artifact caused by this particular path.