2015-09-04 46 views
1

我編輯了一個代碼,我發現可以獲取文本的所有大綱數據,所以我可以手動將其作爲其他程序中的線條繪製。 我的代碼在英文中效果很好,但是當我嘗試發送希伯來文時,輪廓會變成亂碼字體。獲取希伯來文字體大綱

代碼的主要步驟是: 字樣 - > GlyphTypeface - > GlyphRun

和主代碼

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) 

我認爲我的問題是與「m_typeface =新的字體( ......」 在此命令是沒有辦法送字體gdiCharSet值。

有沒有辦法從m_textFont得到字樣直? 還是有另一種方法做這個?

Zohar

回答

0

發現問題。

我所用:

Dim glyphIndex As UShort = m_gtf.CharacterToGlyphMap(Asc(m_textString(n))) 

,但我不得不使用ASCW以獲得正確的ASCII碼:

Dim glyphIndex As UShort = m_gtf.CharacterToGlyphMap(AscW(m_textString(n))) 

現在的作品! Zohar