I've edited a code I found to gets all the outline data of a text so I can manually draw it as lines in some other program. My code works great in English, but when I try to send Hebrew text the outlines turn to be in gibberish font.
The main steps of the code are: Typeface -> GlyphTypeface -> GlyphRun
And the main code is
Private m_gtf As System.Windows.Media.GlyphTypeface
Private m_glypText As GlyphRun
Private m_textFont As System.Drawing.Font
textFont = New Font("Aharoni", 12, FontStyle.Regular, GraphicsUnit.World, 177, False)
m_typeface = New Typeface(New System.Windows.Media.FontFamily(m_textFont.Name), m_fontStyle, _
m_fontWeight, New System.Windows.FontStretch())
m_typeface.TryGetGlyphTypeface(m_gtf)
'then use m_gtf to crate the m_glyphIndices and advanceWidths vectors
m_glypText = New GlyphRun(m_gtf, bidiLevel, False, m_height, m_glyphIndices, origin, advanceWidths, _
Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)
I think that my problem is with the "m_typeface = New Typeface(…" In this command there is no way to send the font gdiCharSet value.
Is there a way to get the typeface straight from the m_textFont? Or is there another way to do this?
Zohar
Found the problem.
I was using:
Dim glyphIndex As UShort = m_gtf.CharacterToGlyphMap(Asc(m_textString(n)))
but I had to use AscW to get the correct ascii code:
Dim glyphIndex As UShort = m_gtf.CharacterToGlyphMap(AscW(m_textString(n)))
now it works! Zohar