private static bool containsLtrCharactersOnly(PdfTextData data, string textLogical)
        {
            // A simple trick to detect right-to-left / bidirectional text.
            // Compare logical and visual representations of text to detect directionality.
            var noBidiOptions = new PdfTextConversionOptions {
                UseBidi = false
            };
            string textVisual = data.GetText(noBidiOptions);

            return(textLogical == textVisual);
        }
        private static void drawText(Graphics gr, PdfTextData td, float userUnit)
        {
            if (td.RenderingMode == PdfTextRenderingMode.NeitherFillNorStroke ||
                td.RenderingMode == PdfTextRenderingMode.AddToPath)
            {
                return;
            }

            double fontSizeAbs = Math.Abs(td.FontSize);

            if (fontSizeAbs < 0.001)
            {
                return;
            }

            if (Math.Abs(td.Bounds.Width) < 0.001 || Math.Abs(td.Bounds.Height) < 0.001)
            {
                return;
            }

            saveStateAndDraw(gr, td.ClipRegion, userUnit, () =>
            {
                using (Font font = toGdiFont(td.Font, fontSizeAbs))
                {
                    using (Brush brush = toGdiBrush(td.Brush))
                    {
                        gr.TranslateTransform((float)td.Position.X, (float)td.Position.Y);
                        concatMatrix(gr, td.TransformationMatrix);
                        if (Math.Sign(td.FontSize) < 0)
                        {
                            gr.ScaleTransform(1, -1);
                        }

                        gr.DrawString(td.GetText(), font, brush, PointF.Empty);
                    }
                }
            });
        }