Kind of RTF question

I use ‘Outline’ as an attribute (or as one of the attributes).
Everything is okay up to a certain outline width. Depending on font I’ll get the joint-spikes like with a W and Arial.

Is there a way to use ‘miterLimit’ or ‘lineJoinStyle’ here?

Thanks in advance for any hints on that & stay safe!

The first thing I’d try would be a different font.

Good idea :smile:
But it’s not up to me. Arial is a standard for what I’m doing (or try to do)

Nonetheless, trying another font will tell you whether it’s a font-specific issue, or something else you’re doing.

It’s just a Bezier specific issue with any vector path drawn, not a specific font issue.
The Arial capital ‘W’ is just a very obvious example. That’s why there are ‘miter limits’ and ‘join types’
Here an example where obviously a miter limit is applied


You see the effect on the upper left edge of the W.
Probably it’s a kind of ‘post process’ since outline text needs 2 strings stacked upon each other to work.

I understand what it is — I’m just trying to establish when it’s happening, and trying another font may help answer the question.

This is totally independent from the font - any font where a character has edges is affected. The miter length grows bigger as the angle of the corner gets smaller.

OK, how are you drawing the text?

Here the base parts of the script.
Assuming that theATS is an attributed string.

set theStrokedATS to theATS's mutableCopy()
theStrokedATS's addAttribute:(cA's NSStrokeColorAttributeName) value:(strokeClrVal) range:({0, theATS's |length|()})
theStrokedATS's addAttribute:(cA's NSStrokeWidthAttributeName) value:(strokeWidthVal) range:({0, theATS's |length|()})

set tmpImg1 to my makeImg(bgrWidth, bgrHeight, edgeRadius, fillColor)
set tmpImg2 to my stringOnImg(tmpImg1, theStrokedATS, xPos, yPos)
# to make the fill work correctly
set tmpImg2 to my stringOnImg(tmpImg2, theATS, xPos, yPos)

on makeNSColor(zValueType, clrComps)
	# clrComps/type can be like {1, 1, 1, 1} = 1 or {255, 255, 255, 255} = 255
	if count of clrComps = 3
		set end of clrComps to (zValueType as integer)
	set {redValue, greenValue, blueValue, alphaValue} to clrComps
	set zValueType to zValueType as integer
	set aRedCocoa to (redValue / zValueType) as real
	set aGreenCocoa to (greenValue / zValueType) as real
	set aBlueCocoa to (blueValue / zValueType) as real
	set aAlphaCocoa to (alphaValue / zValueType) as real
	set aColor to cA's NSColor's colorWithCalibratedRed:aRedCocoa green:aGreenCocoa blue:aBlueCocoa alpha:aAlphaCocoa
	return aColor
end makeNSColor

on stringOnImg(someImage, someAttrStr, xPos, yPos)
	someImage's lockFocus()
	someAttrStr's drawAtPoint:(cA's NSMakePoint(xPos, yPos))
	someImage's unlockFocus()
	return someImage
end stringOnImg

on makeImg(aWidth, aHeight, aRadius, aFillColor)
	set someImage to cA's NSImage's alloc()'s initWithSize:(cA's NSMakeSize(aWidth, aHeight))
	someImage's lockFocus()
	set aRect to {{x:0, y:0}, {width:aWidth, height:aHeight}}
	set theNSBezierPath to cA's NSBezierPath's bezierPath
	if aRadius = 0 then
		theNSBezierPath's appendBezierPathWithRect:aRect
		theNSBezierPath's appendBezierPathWithRoundedRect:aRect xRadius:aRadius yRadius:aRadius
	end if
	aFillColor's |set|()
	theNSBezierPath's fill()
	someImage's unlockFocus()
	return someImage
end makeImg

Maybe the:

is the correct thing to use - but how to use?

For anyone else following along, the short answer is that it can’t be done. The only solution is to render the type as bezier path outlines.