• Sure saeed,

    1) If you will look at the code in the article you can use the following exerpt to identify the correct location for changing the code.  The code you quoted is what you are suppose to change it to.

                    ' See if any characters will fit.

                    If characters_fitted > 0 Then

                        ' start accumulating the print location

                        varWord(varWord.GetUpperBound(0) - 1) = layout_rect

                        ' ************Draw the word when finished.************

    ...

                        '' Draw a rectangle around the text (for debugging).

    ...

                        ' Increase the location where we can start.

                        xmin += CInt(text_size.Width) - 4

                        ReDim Preserve varWord(varWord.GetUpperBound(0) + 1)

                    ElseIf Asc(smallArray(0, x).Chars(0)) < 30 Then ' make sure to dispose of odd char's in the array

    2) I assume from your post that you also read right to left so you need the entire printing process reversed.  This is much simpler than reading left to right but printing right to left.  I haven't actually tested this but the solution should be as simple as replacing the red code with the green:

                        ' ************Draw the word when finished.************

                        If Asc(smallArray(0, x).Chars(0)) = 32 Or x = smallArray.GetUpperBound(1) - 1 Then

                            Dim z As Integer

                            For z = x - (varWord.GetUpperBound(0) - 1) To x

                                ' Get the font for measurement.

                                the_font = New Font(fntPrintFont.Name, fntPrintFont.Size, CInt(smallArray(1, z)), fntPrintFont.Unit)

                                ' actually print the character on the page.

                                e.Graphics.DrawString(smallArray(0, z), _

                                    the_font, Brushes.Black, _

                                    varWord((z - x) + (varWord.GetUpperBound(0) - 1)), string_format)

                        ' ************Draw the word when finished.************

                        If Asc(smallArray(0, x).Chars(0)) = 32 Or x = smallArray.GetUpperBound(1) - 1 Then

                            Dim z As Integer

                            For z = x - (varWord.GetUpperBound(0) - 1) To x

                                ' Get the font for measurement.

                                the_font = New Font(fntPrintFont.Name, fntPrintFont.Size, CInt(smallArray(1, z)), fntPrintFont.Unit)

                                ' actually print the character on the page.

                                e.Graphics.DrawString(smallArray(0, z), _

                                    the_font, Brushes.Black, _

                                    e.MarginBounds.Right - varWord((z - x) + (varWord.GetUpperBound(0) - 1)), string_format)

    One thing that does have me confused though.  If your native language reads right to left then why isn't the input string being put in right to left which would cause it to be printed out correctly?