I'm currently using the font Carlito to render some FormattedText
in WPF, in order to then print an eventual image as so:
DrawingVisual vis = new DrawingVisual();
DrawingContext dc = vis.RenderOpen();
...
FormattedText someText = new FormattedText("Delightful", System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typefaceCarlito, 52, brushBlack);
dc.DrawText(someText, new Point(rightX - someText.Width, 2900 - (someText.Height / 2)));
...
dlg.PrintVisual(vis, "Test print"));
I've chosen the text "Delightful" specifically here, as it contains one of the ligatures ('tf') that seem to give me an odd problem. Printing works fine without such ligatures, and printing to a PDF shows it being sent as a vector:
However, if I (re)introduce the ligature, the following happens:
The text becomes rasterised (ignore the pixelated line, that's a background image), and finishes short. In some cases, it stops at the ligature position. In others, it cuts off shortly afterward.
It does not happen with all fonts - most system fonts are fine, as is another third-party font I have chosen to use - but I still need the ability to stop this happening. The pixelation is not so much of an issue, but the cutoff is.
Is there a way I can force FormattedText
to not transform consecutive characters into their ligature equivalent, or better still stop this happening?
dc.close()
) then printed it to a pdf file and everything looks just fine. I used Chrome to view the pdf. – Dative