imagick icon indicating copy to clipboard operation
imagick copied to clipboard

setFont vs setFontFamily?

Open ameenross opened this issue 6 years ago • 2 comments

I'm not sure if this is me missing something or if it's due to unclear documentation, but I seem to have problems understanding what setFontFamily does. The function accepts all fonts that are returns by queryFonts, however it fails to render properly in some cases (not all). See below screenshots.

setFontFamily screenshot from 2019-03-04 12-34-11

setFont screenshot from 2019-03-04 12-34-27

You could argue that Courier-10-Pitch-Bold is not a font-family; Courier-10-Pitch is the font family and bold is just a variant (dependent on setFontStyle I suppose). But then why is Courier-10-Pitch not rendered correctly either? And why is Courier-10-Pitch-Bold accepted?

ameenross avatar Mar 04 '19 11:03 ameenross

I don't really know.

I've just read the upstream documentation for the underlying library here and I still don't really know.

Could you post the code for your example, and if I get a chance I'll dig into it to have a look.

Theoretically, it should be the same as using font vs font-family in SVG drawings, as SVG is used as the intermediate format that all the drawing commands use before being rendered to pixel based formats.

Danack avatar Mar 04 '19 15:03 Danack

Code can be found here: https://gist.github.com/ameenross/e8192222a5414b7de4e99c4bb500a253

Change setFont to setFontFamily for the "broken" one.

ameenross avatar Mar 04 '19 16:03 ameenross